|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webstersmalley.chessweb.model.Move
public final class Move
Encapsulates a move. Has a source and a destination and a bunch of convenience methods.
Constructor Summary | |
---|---|
Move(Position source,
Position destination)
Constructor. |
Method Summary | |
---|---|
long |
getCreated()
|
Position |
getDestination()
|
int |
getMaximumMagnitude()
Returns the maximum magnitude. |
Position |
getSource()
|
int |
getXDifference()
Return the xDifference. |
int |
getXMagnitude()
Return the xMagnitude. |
int |
getYDifference()
Return the yDifference. |
int |
getYDirection()
Returns the direction (magnitude 1) of the y direction. |
int |
getYMagnitude()
Return the yMagnitude. |
boolean |
isCastling()
|
boolean |
isDiagonal()
Whether the move is a diagonal. |
boolean |
isPathClear(Board board)
Calculates whether the path is clear. |
boolean |
isStraight()
Whether the move is straight. |
void |
setCastling(boolean castling)
|
void |
setDestination(Position destination)
|
void |
setSource(Position source)
|
java.lang.String |
toString()
Returns a String representation of the move. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Move(Position source, Position destination)
source
- the sourcedestination
- the destinationMethod Detail |
---|
public long getCreated()
public boolean isPathClear(Board board)
board
- the current state
public boolean isDiagonal()
public boolean isStraight()
public int getXDifference()
public int getYDifference()
public int getXMagnitude()
public int getYMagnitude()
public int getMaximumMagnitude()
public int getYDirection()
public Position getDestination()
public void setDestination(Position destination)
destination
- The destination to set.public Position getSource()
public void setSource(Position source)
source
- The source to set.public java.lang.String toString()
toString
in class java.lang.Object
public boolean isCastling()
public void setCastling(boolean castling)
castling
- The castling to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |