|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object becker.robots.Sim becker.robots.Thing becker.robots.Light becker.robots.Flasher
public class Flasher
A flasher is commonly used to mark construction hazards on streets and avenues. Flashers are small enough for a robot to pick up and carry. They do not obstruct the movement of robots. Like all lights, they can be turned on and off. Unlike some kinds of lights, when flashers are "on" their lights cycle on and off. When flashers are turned "off" their lights stay off.
Constructor Summary | |
---|---|
Flasher(City city,
int avenue,
int street)
Construct a new flasher, initially turned off. |
|
Flasher(City city,
int avenue,
int street,
boolean isOn)
Construct a new flasher. |
|
Flasher(Robot heldBy)
Construct a new flasher held by a robot. |
Method Summary | |
---|---|
protected void |
save(String indent,
PrintWriter out)
Save a representation of this flasher to an output stream. |
String |
toString()
Print this object represented as a string. |
void |
turnOff()
Turn the flasher off. |
void |
turnOn()
Turn the flasher on so that it begins to flash. |
Methods inherited from class becker.robots.Light |
---|
isOn |
Methods inherited from class becker.robots.Thing |
---|
blocksIntersectionEntry, blocksIntersectionExit, canBeCarried, getIntersection, setBlocksEntry, setBlocksEntry, setBlocksExit, setBlocksExit, setCanBeCarried |
Methods inherited from class becker.robots.Sim |
---|
getCity, getColor, getIcon, keyTyped, notifyObservers, notifyObservers, setColor, setIcon |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Flasher(City city, int avenue, int street)
city
- The city in which the flasher will exist.avenue
- The flasher's initial avenue within the city.street
- The flasher's initial street within the city.public Flasher(City city, int avenue, int street, boolean isOn)
city
- The city in which the flasher will exist.avenue
- The flasher's initial avenue within the city.street
- The flasher's initial street within the city.isOn
- True if the flasher is on; false otherwise.public Flasher(Robot heldBy)
heldBy
- the robot holding the flasher.Method Detail |
---|
public void turnOn()
turnOn
in class Light
public void turnOff()
turnOff
in class Light
protected void save(String indent, PrintWriter out)
save
in class Thing
indent
- the indentation, for formatting purposesout
- the output streampublic String toString()
toString
in class Thing
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |