Skip to content

Commit 445db0e

Browse files
committed
rename act to step
1 parent b395aa4 commit 445db0e

10 files changed

Lines changed: 17 additions & 17 deletions

ch16/Actor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
*/
66
public interface Actor {
77

8-
/**
9-
* Updates the state of the simulation element.
10-
*/
11-
void act();
12-
138
/**
149
* Draws the simulation element in the context.
1510
*
1611
* @param g graphics context
1712
*/
1813
void draw(Graphics g);
1914

15+
/**
16+
* Updates the state of the simulation element.
17+
*/
18+
void step();
19+
2020
}

ch16/BlinkingPolygon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public BlinkingPolygon(int nsides, int length, Color color) {
2020
}
2121

2222
@Override
23-
public void act() {
23+
public void step() {
2424
if (color != onColor) {
2525
color = onColor;
2626
} else {

ch16/Drawing.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public Object[] getActors() {
4242
}
4343

4444
/**
45-
* Calls the act method of each actor and updates the drawing.
45+
* Calls the step method of each actor and updates the drawing.
4646
*/
47-
public void next() {
47+
public void step() {
4848
for (Actor actor : actors) {
49-
actor.act();
49+
actor.step();
5050
}
5151
repaint();
5252
}

ch16/Mole.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public Mole(int x, int y) {
2222
}
2323

2424
@Override
25-
public void act() {
25+
public void step() {
2626
// blink on/off at random times
2727
if (alive && Math.random() < 0.5) {
28-
super.act();
28+
super.step();
2929
}
3030
}
3131

ch16/MovingPolygon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setDy(int dy) {
3333
}
3434

3535
@Override
36-
public void act() {
36+
public void step() {
3737

3838
// edge detection
3939
for (int i = 0; i < npoints; i++) {

ch16/RegularPolygon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public RegularPolygon(int nsides, int length, Color color) {
8080
}
8181

8282
@Override
83-
public void act() {
83+
public void step() {
8484
// nothing to do
8585
}
8686

ch16/RotatingPolygon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void center() {
5050
}
5151

5252
@Override
53-
public void act() {
53+
public void step() {
5454
// update the rotation angle
5555
angle = (angle + 1) % 360;
5656
final double RAD = Math.toRadians(angle);

ch16/Sim2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static void main(String[] args) {
4444

4545
// update the drawing
4646
toolkit.sync();
47-
drawing.next();
47+
drawing.step();
4848

4949
// delay the simulation
5050
try {

ch16/Sim3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static void main(String[] args) {
5757
@Override
5858
public void actionPerformed(ActionEvent e) {
5959
toolkit.sync();
60-
drawing.next();
60+
drawing.step();
6161
}
6262

6363
}

ch16/WhackAMole.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void main(String[] args) {
4848
@Override
4949
public void actionPerformed(ActionEvent e) {
5050
toolkit.sync();
51-
drawing.next();
51+
drawing.step();
5252
}
5353

5454
}

0 commit comments

Comments
 (0)