|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbecker.robots.Sim
becker.robots.Thing
becker.robots.Light
becker.robots.Streetlight
public class Streetlight
A Streetlight is a kind of Light that lights an intersection.
Like all lights, it can be turned on and off. A streetlight
cannot be moved by a robot.
| Constructor Summary | |
|---|---|
Streetlight(City city,
int street,
int avenue,
Direction corner)
Construct a new streetlight. |
|
Streetlight(City city,
int street,
int avenue,
Direction corner,
boolean isOn)
Construct a new streetlight. |
|
| Method Summary | |
|---|---|
protected void |
save(String indent,
PrintWriter out)
Save a representation of this intersection to an output stream. |
String |
toString()
Print this object represented as a string. |
void |
turnOff()
Turn the streetlight off. |
void |
turnOn()
Turn the streetlight on. |
| 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 Streetlight(City city,
int street,
int avenue,
Direction corner,
boolean isOn)
city - The city in which the streetlight will exist.street - The streetlight's initial street within the city.avenue - The streetlight's initial avenue within the city.corner - The corner of the intersection occupied by the
streetlight. One of {Direction.NORTHEAST, SOUTHEAST, SOUTHWEST,
NORTHWEST}.isOn - True if the streetlight is on when constructed.
public Streetlight(City city,
int street,
int avenue,
Direction corner)
city - The city in which the streetlight will exist.street - The streetlight's initial street within the city.avenue - The streetlight's initial avenue within the city.corner - The corner of the intersection occupied by the
streetlight. One of {Direction.NORTHEAST, SOUTHEAST, SOUTHWEST,
NORTHWEST}.| Method Detail |
|---|
public void turnOn()
turnOn in class Lightpublic void turnOff()
turnOff in class Light
protected void save(String indent,
PrintWriter out)
save in class Thingindent - 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 | ||||||||