|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbridge.BridgeState
public class BridgeState
This class represents states of the Bridge Crossing problem. It creates new bridge states, tests states for equality, and produces string representations of them.
Constructor Summary | |
---|---|
BridgeState(Position p1Position,
Position p2Position,
Position flashlightPosition,
Position p5Position,
Position p10Position,
int timeSoFar)
Creates a new bridge state. |
Method Summary | |
---|---|
boolean |
equals(BridgeState other)
Tests this bridge state with another for equality. |
Position |
getFlashlightPosition()
Getter (accessor) for the position of the flashlight in this state. |
Position |
getP10Position()
Getter (accessor) for the position of person P10 in this state. |
Position |
getP1Position()
Getter (accessor) for the position of person P1 in this state. |
Position |
getP2Position()
Getter (accessor) for the position of person P2 in this state. |
Position |
getP5Position()
Getter (accessor) for the position of person P5 in this state. |
int |
getTimeSoFar()
Getter (accessor) for the time taken to get to this state. |
java.lang.String |
toString()
Creates a string representation of this state for display to the user trying to solve the problem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BridgeState(Position p1Position, Position p2Position, Position flashlightPosition, Position p5Position, Position p10Position, int timeSoFar)
p1Position
- position of the person who can cross in 1 minutep2Position
- position of the person who can cross in 2 minutesflashlightPosition
- position of the flashlightp5Position
- position of the person who can cross in 5 minutesp10Position
- position of the person who can cross in 10 minutestimeSoFar
- time taken so farMethod Detail |
---|
public boolean equals(BridgeState other)
other
- the other bridge state to be tested against this one.
public java.lang.String toString()
toString
in class java.lang.Object
public Position getFlashlightPosition()
public Position getP10Position()
public Position getP1Position()
public Position getP2Position()
public Position getP5Position()
public int getTimeSoFar()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |