|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectantichess.MoveHistory<M>
public class MoveHistory<M extends Move>
A linked-list implementation of the history of moves. Null Moves are permitted in the MoveHistory. MoveHistory's are immutable.
lastMove
: M // The last move in the history
lastMoveTime
: String // The timestamp of the last move. This may be empty.
history
: MoveHistoryConstructor Summary | |
---|---|
MoveHistory(M lastMove)
Creates a new MoveHistory m, with lastMove(m) = lastMove and an empty string as a timestamp. |
|
MoveHistory(M lastMove,
String timestamp)
Creates a new MoveHistory with one Move |
Method Summary | |
---|---|
MoveHistory<M> |
addMove(M move)
Adds a move to the MoveHistory. |
MoveHistory<M> |
addMove(M move,
String timestamp)
|
List<M> |
getHistory()
|
M |
getLastMove()
|
String |
getLastMoveTime()
|
List<String> |
getMoveTimes()
|
MoveHistory<M> |
removeLastMove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MoveHistory(M lastMove)
lastMove
and an empty string as a timestamp.
lastMove
- the lastMove to add to the new MoveHistory.lastMove
is a valid Move of type MlastMove
as
its lastMove.public MoveHistory(M lastMove, String timestamp)
lastMove
- the lastMove to add to the new MoveHistory.timestamp
- the timestamp to associate with lastMove
.
lastMove
is a valid Move of type M
timestamp
is not null
lastMove
as
its lastMove, associated with the timestamp
timestamp
.Method Detail |
---|
public MoveHistory<M> addMove(M move)
move
- the new Move to add to the MoveHistory
move
added to the end of the old MoveHistorypublic MoveHistory<M> addMove(M move, String timestamp)
move
- the new Move to add to the MoveHistorytimestamp
- the timestamp to associate with this move.
move
added to
the end of the old MoveHistory.public MoveHistory<M> removeLastMove()
public M getLastMove()
public String getLastMoveTime()
public List<M> getHistory()
public List<String> getMoveTimes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |