Skip to content

Commit

Permalink
update (java): example updates
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Sep 19, 2023
1 parent cda3ac9 commit db7188e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
26 changes: 13 additions & 13 deletions notebooks/pt/s04components/s01chart/s01push.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -291,7 +291,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -313,7 +313,7 @@
"null"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -338,7 +338,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -367,7 +367,7 @@
"null"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
20 changes: 10 additions & 10 deletions notebooks/pt/s04components/s01chart/s02pull.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -162,7 +162,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -184,7 +184,7 @@
"null"
]
},
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -209,7 +209,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -238,7 +238,7 @@
"null"
]
},
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit db7188e

Please sign in to comment.