|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbecker.robots.Sim
becker.robots.Robot
becker.robots.RobotSE
public class RobotSE
A new kind of robot with extended capabilities such as turnAround, and turnRight. RobotSE also makes public a number of protected methods in Robot.
| Constructor Summary | |
|---|---|
RobotSE(City theCity,
int street,
int avenue,
Direction dir)
Construct a new RobotSE with nothing in its backpack. |
|
RobotSE(City theCity,
int street,
int avenue,
Direction dir,
int numThings)
Construct a new RobotSE. |
|
| Method Summary | |
|---|---|
int |
countThingsInBackpack(IPredicate pred)
How many of a specific kind of thing are in this robot's backpack? |
boolean |
isBesideThing(IPredicate kindOfThing)
Determine whether this robot is on the same intersection as one or more instances of the specified kind of thing. |
boolean |
isFacingEast()
Determine whether the robot is facing east. |
boolean |
isFacingNorth()
Determine whether the robot is facing north. |
boolean |
isFacingSouth()
Determine whether the robot is facing south. |
boolean |
isFacingWest()
Determine whether the robot is facing west. |
void |
move(int howFar)
Move the given distance. |
void |
pickAllThings()
Pick all the moveable things from the current intersection. |
void |
pickAllThings(IPredicate kindOfThing)
Pick all of the specified kind of things from the current intersection. |
void |
pickThing(IPredicate kindOfThing)
Attempt to pick up a particular kind of thing from the intersection this robot currently occupies. |
void |
pickThing(Thing theThing)
Attempt to pick up a particular thing from the intersection this robot currently occupies. |
void |
putAllThings()
Put all the things in this robot's backpack down on the current intersection. |
void |
putAllThings(IPredicate kindOfThing)
Put all of the specified kind of things from the robot's backpack down on the current intersection. |
void |
putThing(IPredicate kindOfThing)
Attempt to take a particular kind of thing out of this robot's backpack and put it on the intersection currently occupied by this robot. |
void |
putThing(Thing theThing)
Attempt to put down a particular thing on the intersection this robot currently occupies. |
void |
save(String indent,
PrintWriter out)
Save a representation of this robot to an output stream. |
void |
turnAround()
Turn the robot around so it faces the opposite direction. |
void |
turnLeft(int numTimes)
Turn left the given number of times. |
void |
turnRight()
Turn the robot 90 degrees to the right. |
void |
turnRight(int numTimes)
Turn right the given number of times. |
| Methods inherited from class becker.robots.Robot |
|---|
breakRobot, canPickThing, countThingsInBackpack, examineLights, examineRobots, examineThings, examineThings, frontIsClear, getAvenue, getDirection, getIntersection, getLabel, getSpeed, getStreet, getTransparency, makeThing, move, pickThing, putThing, setLabel, setSpeed, setTransparency, toString, turnLeft |
| 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 |
| Methods inherited from interface becker.robots.IColor |
|---|
getColor, setColor |
| Constructor Detail |
|---|
public RobotSE(City theCity,
int street,
int avenue,
Direction dir,
int numThings)
theCity - the city in which the robot will be located.street - the robot's initial streetavenue - the robot's initial avenuedir - the robot's initial directionnumThings - the number of things initially in the robot's backpack
public RobotSE(City theCity,
int street,
int avenue,
Direction dir)
theCity - the city in which the robot will be located.street - the robot's initial streetavenue - the robot's initial avenuedir - the robot's initial direction| Method Detail |
|---|
public void turnAround()
public void turnRight()
public void turnRight(int numTimes)
numTimes - how many times to turn right. Must be >= 0.public void move(int howFar)
howFar - how far to move. Must be >= 0.public void turnLeft(int numTimes)
numTimes - how many times to turn left. Must be >= 0.public void pickAllThings()
public void pickAllThings(IPredicate kindOfThing)
kindOfThing - The kind of things to pick uppublic void putAllThings()
public void putAllThings(IPredicate kindOfThing)
kindOfThing - The kind of things to put downpublic boolean isFacingNorth()
public boolean isFacingEast()
public boolean isFacingSouth()
public boolean isFacingWest()
public int countThingsInBackpack(IPredicate pred)
Robot
countThingsInBackpack in class Robotpred - The kind of thing to count.
public boolean isBesideThing(IPredicate kindOfThing)
Robot
isBesideThing in class RobotkindOfThing - A predicate indicating what kind of thing should
be looked for on the current intersection.
public void pickThing(IPredicate kindOfThing)
Robot
pickThing in class RobotkindOfThing - A predicate indicating what kind of thing should
be picked up.Robot.pickThing(),
Robot.pickThing(Thing)public void pickThing(Thing theThing)
Robot
pickThing in class RobottheThing - The thing to pick up.Robot.pickThing(),
Robot.pickThing(IPredicate)public void putThing(IPredicate kindOfThing)
Robot
putThing in class RobotkindOfThing - A predicate indicating what kind of thing should
be put down.Robot.putThing(),
Robot.putThing(Thing)public void putThing(Thing theThing)
Robot
putThing in class RobottheThing - The thing to put down.Robot.putThing(),
Robot.putThing(IPredicate)
public void save(String indent,
PrintWriter out)
Robot
save in class Robotindent - A string of blanks, for formatting purposes.out - The output stream.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||