|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPieceMove
public class PieceMove
PieceMove represents the movement of one piece in the puzzle. It holds references to the Piece object that is on the old position and to the piece object that is in the new position.
Field Summary | |
---|---|
private char |
axis
|
private int |
delta
|
private Piece |
destPiece
|
private Piece |
sourcePiece
|
Constructor Summary | |
---|---|
PieceMove(Piece source,
Piece dest,
char axis,
int delta)
Constructor: initializes the data members with the provided values |
Method Summary | |
---|---|
char |
getAxis()
Accessor for axis of movement |
int |
getDelta()
Accessor for distance and direction travelled |
Piece |
getDestPiece()
Accessor for the post-move piece |
Piece |
getSourcePiece()
Accessor for the pre-move piece |
java.lang.String |
prettyString()
Makes a nice human readable string representation of the move |
java.lang.String |
toString()
Makes a compact human readable string representation of the move |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Piece sourcePiece
private Piece destPiece
private char axis
private int delta
Constructor Detail |
---|
public PieceMove(Piece source, Piece dest, char axis, int delta)
source
- the piece before movementdest
- the piece after movementaxis
- the axis of travel (must be H_MOVE or V_MOVE)delta
- the distance and direction travelled on the axis (may not be
zero)Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String prettyString()
public int getDelta()
public char getAxis()
public Piece getSourcePiece()
public Piece getDestPiece()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |