Package api
Class MoveRecord
- java.lang.Object
- 
- api.MoveRecord
 
- 
 public class MoveRecord extends java.lang.ObjectA MoveRecord encapsulates a State along with information about how it might have been shifted or modified during a move in the game.- Author:
- smkautz
 
- 
- 
Constructor SummaryConstructors Constructor Description MoveRecord(State givenState, int currentIndex)Constructs a MoveRecord from the given State and index.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex()Returns the index in this MoveRecord.intgetMovedTo()Returns the (possibly) new index for this MoveRecord's cell.StategetState()Returns the state in this MoveRecord.booleanisClosed()Determines whether this state is an open gate that was closed by a move.booleanisDisappeared()Determines whether this state was deleted.booleanisMoved()Determines whether this cell has been given a new index.voidsetClosed()Sets the closed status of this MoveRecord.voidsetDisappeared()Sets the disappeared status of this MoveRecord.voidsetMovedToIndex(int newIndex)Sets the new index to indicate a state moved to a new location within a state sequence.java.lang.StringtoString()Returns a string representation of this MoveRecord.
 
- 
- 
- 
Constructor Detail- 
MoveRecordpublic MoveRecord(State givenState, int currentIndex) Constructs a MoveRecord from the given State and index. Normally the index is the same as the cell's array index within a valid state sequence. The movedTo index is initially the same as the given index and the disappeared status is false. Index 0 is always the player's initial location.- Parameters:
- givenState- State for this MoveRecord
- currentIndex- index for this MoveRecord
 
 
- 
 - 
Method Detail- 
getStatepublic State getState() Returns the state in this MoveRecord.- Returns:
- state in this MoveRecord
 
 - 
getIndexpublic int getIndex() Returns the index in this MoveRecord.- Returns:
- index in this MoveRecord
 
 - 
setMovedToIndexpublic void setMovedToIndex(int newIndex) Sets the new index to indicate a state moved to a new location within a state sequence. In the case of a cell containing the player, the new index indicates the new location of the player in the sequence.- Parameters:
- newIndex- new index for the current cell (or player)
 
 - 
getMovedTopublic int getMovedTo() Returns the (possibly) new index for this MoveRecord's cell.- Returns:
- new index for this MoveRecord's cell
 
 - 
isMovedpublic boolean isMoved() Determines whether this cell has been given a new index.- Returns:
- true if the new index differs from the original index
 
 - 
isDisappearedpublic boolean isDisappeared() Determines whether this state was deleted.- Returns:
- true if this state was deleted, false otherwise
 
 - 
setDisappearedpublic void setDisappeared() Sets the disappeared status of this MoveRecord.
 - 
isClosedpublic boolean isClosed() Determines whether this state is an open gate that was closed by a move.- Returns:
- true if this state was closed
 
 - 
setClosedpublic void setClosed() Sets the closed status of this MoveRecord.
 - 
toStringpublic java.lang.String toString() Returns a string representation of this MoveRecord.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-