From db7188e79e0c0e43f9ae6677ad0e54fdddcbfd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Santanch=C3=A8?= Date: Tue, 19 Sep 2023 18:31:38 -0300 Subject: [PATCH] update (java): example updates --- .../s03properties/App01ChartSequence.java | 10 +++++-- .../s03properties/chart/BarChart.java | 14 +++++----- .../sequence/GeometricProgression.java | 6 ++--- .../pt/s04components/s01chart/s01push.ipynb | 26 +++++++++---------- .../pt/s04components/s01chart/s02pull.ipynb | 20 +++++++------- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/java/src/pt/c08componentes/s01chartseq/s03properties/App01ChartSequence.java b/java/src/pt/c08componentes/s01chartseq/s03properties/App01ChartSequence.java index 04191ade..40f0fb3b 100644 --- a/java/src/pt/c08componentes/s01chartseq/s03properties/App01ChartSequence.java +++ b/java/src/pt/c08componentes/s01chartseq/s03properties/App01ChartSequence.java @@ -5,10 +5,16 @@ public class App01ChartSequence { public static void main(String args[]) { - GeometricProgression gp = new GeometricProgression(1, 2); + GeometricProgression gp = new GeometricProgression(); + gp.setInitial(1); + gp.setRatio(2); - BarChart bc = new BarChart(true, '#', 5, gp); + BarChart bc = new BarChart(); + bc.setFilled(true); + bc.setCharacter('#'); + bc.setN(7); + bc.connect(gp); bc.plot(); } } diff --git a/java/src/pt/c08componentes/s01chartseq/s03properties/chart/BarChart.java b/java/src/pt/c08componentes/s01chartseq/s03properties/chart/BarChart.java index f69ed256..e505c053 100644 --- a/java/src/pt/c08componentes/s01chartseq/s03properties/chart/BarChart.java +++ b/java/src/pt/c08componentes/s01chartseq/s03properties/chart/BarChart.java @@ -9,12 +9,10 @@ public class BarChart { private GeometricProgression sequence; - public BarChart(boolean filled, char character, int n, - GeometricProgression sequence) { - this.filled = filled; - this.character = character; - this.n = n; - this.sequence = sequence; + public BarChart() { + filled = true; + character = '*'; + n = 3; } public boolean isFilled() { @@ -41,6 +39,10 @@ public void setN(int n) { this.n = n; } + public void connect(GeometricProgression sequence) { + this.sequence = sequence; + } + public void plot() { if (sequence != null) { int value = sequence.first(); diff --git a/java/src/pt/c08componentes/s01chartseq/s03properties/sequence/GeometricProgression.java b/java/src/pt/c08componentes/s01chartseq/s03properties/sequence/GeometricProgression.java index 93f7cad1..963d55df 100644 --- a/java/src/pt/c08componentes/s01chartseq/s03properties/sequence/GeometricProgression.java +++ b/java/src/pt/c08componentes/s01chartseq/s03properties/sequence/GeometricProgression.java @@ -5,9 +5,9 @@ public class GeometricProgression { ratio; private int current; - public GeometricProgression(int initial, int ratio) { - this.initial = initial; - this.ratio = ratio; + public GeometricProgression() { + initial = 1; + ratio = 2; current = initial; } diff --git a/notebooks/pt/s04components/s01chart/s01push.ipynb b/notebooks/pt/s04components/s01chart/s01push.ipynb index c51fea50..685e0f39 100644 --- a/notebooks/pt/s04components/s01chart/s01push.ipynb +++ b/notebooks/pt/s04components/s01chart/s01push.ipynb @@ -30,16 +30,16 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr5c156cc4.BarChart" + "com.twosigma.beaker.javash.bkr3816f8ce.BarChart" ] }, - "execution_count": 1, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -132,16 +132,16 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr5c156cc4.GeometricProgressionPre" + "com.twosigma.beaker.javash.bkr3816f8ce.GeometricProgressionPre" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -236,16 +236,16 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr5c156cc4.GeometricProgression" + "com.twosigma.beaker.javash.bkr3816f8ce.GeometricProgression" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -291,7 +291,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -313,7 +313,7 @@ "null" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -338,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -367,7 +367,7 @@ "null" ] }, - "execution_count": 7, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } diff --git a/notebooks/pt/s04components/s01chart/s02pull.ipynb b/notebooks/pt/s04components/s01chart/s02pull.ipynb index 3d3eb54f..4a602794 100644 --- a/notebooks/pt/s04components/s01chart/s02pull.ipynb +++ b/notebooks/pt/s04components/s01chart/s02pull.ipynb @@ -39,16 +39,16 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr703155f5.GeometricProgression" + "com.twosigma.beaker.javash.bkr7589615f.GeometricProgression" ] }, - "execution_count": 1, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -104,16 +104,16 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr703155f5.BarChart" + "com.twosigma.beaker.javash.bkr7589615f.BarChart" ] }, - "execution_count": 2, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -162,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -184,7 +184,7 @@ "null" ] }, - "execution_count": 3, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -209,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -238,7 +238,7 @@ "null" ] }, - "execution_count": 4, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }