|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--chesspresso.game.Game
Abstraction of a chess game. A chess game consists of the following parts:
GameHeaderModel
cantaining information about the game header,
for instance white name, event, site
GameMoveModel
containing the moves, lines, comments of the game.
GameModel
consisting
of GameHeaderModel
and GameMoveModel
.
The game offers the following groups of operation:
go
traverse(GameListener, boolean)
the game in postfix order
(the order used by PGN
)
Constructor Summary | |
Game()
|
|
Game(GameModel gameModel)
|
Method Summary | |
void |
addChangeListener(GameModelChangeListener listener)
|
void |
addComment(java.lang.String comment)
|
void |
addNag(short nag)
|
boolean |
containsPosition(ImmutablePosition position)
Returns whether the main line of the current game contains the given position. |
void |
deleteCurrentLine()
|
void |
deleteCurrentLine(boolean silent)
|
boolean |
equals(java.lang.Object obj)
Returns whether two games are equal. |
void |
fireMoveModelChanged()
|
java.lang.String |
getBlack()
|
int |
getBlackElo()
|
java.lang.String |
getBlackEloStr()
|
java.lang.String |
getComment()
|
int |
getCurNode()
|
int |
getCurrentMoveNumber()
|
int |
getCurrentPly()
|
java.lang.String |
getDate()
|
java.lang.String |
getECO()
|
java.lang.String |
getEvent()
|
java.lang.String |
getEventDate()
|
java.lang.String |
getHeaderString(int line)
|
java.lang.String |
getInfoString()
|
Move |
getLastMove()
|
java.lang.String |
getLongInfoString()
|
Move[] |
getMainLine()
|
GameModel |
getModel()
|
short[] |
getNags()
|
Move |
getNextMove()
|
Move |
getNextMove(int whichLine)
|
int |
getNextMoveNumber()
|
Move[] |
getNextMoves()
|
short |
getNextShortMove()
|
short |
getNextShortMove(int whichLine)
|
short[] |
getNextShortMoves()
|
int |
getNumOfMoves()
|
int |
getNumOfNextMoves()
|
int |
getNumOfPlies()
|
Position |
getPosition()
|
int |
getResult()
|
java.lang.String |
getResultStr()
|
int |
getRootNode()
|
java.lang.String |
getRound()
|
java.lang.String |
getSite()
|
java.lang.String |
getTag(java.lang.String tagName)
|
java.lang.String[] |
getTags()
|
int |
getTotalNumOfPlies()
|
java.lang.String |
getWhite()
|
int |
getWhiteElo()
|
java.lang.String |
getWhiteEloStr()
|
boolean |
goBack()
|
void |
goBackToLineBegin()
|
void |
goBackToMainLine()
|
boolean |
goForward()
|
boolean |
goForward(int whichLine)
|
void |
gotoEndOfLine()
|
void |
gotoNode(int node)
|
void |
gotoNode(int node,
boolean silent)
|
void |
gotoPosition(ImmutablePosition pos)
|
void |
gotoPosition(ImmutablePosition pos,
boolean silent)
|
void |
gotoStart()
|
int |
hashCode()
Returns the hash code of the game, which is defined as the hash code of the move model. |
boolean |
hasNag(short nag)
|
boolean |
hasNextMove()
|
void |
notifyMoveDone(ImmutablePosition position,
short move)
|
void |
notifyMoveUndone(ImmutablePosition position)
|
void |
notifyPositionChanged(ImmutablePosition position)
|
void |
pack()
|
void |
removeChangeListener(GameModelChangeListener listener)
|
void |
removeComment()
|
void |
removeNag(short nag)
|
void |
save(java.io.DataOutput out,
int headerMode,
int movesMode)
|
void |
setAlwaysAddLine(boolean alwaysAddLine)
|
void |
setComment(java.lang.String comment)
|
void |
setTag(java.lang.String tagName,
java.lang.String tagValue)
|
java.lang.String |
toString()
Returns a string represention of the game. |
void |
traverse(GameListener listener,
boolean withLines)
Method to traverse the game in postfix order (first the lines, then the main line). |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Game()
public Game(GameModel gameModel)
Method Detail |
public GameModel getModel()
public Position getPosition()
public int getCurNode()
public int getRootNode()
public void pack()
public void setAlwaysAddLine(boolean alwaysAddLine)
public void addChangeListener(GameModelChangeListener listener)
public void removeChangeListener(GameModelChangeListener listener)
public void fireMoveModelChanged()
public void notifyPositionChanged(ImmutablePosition position)
notifyPositionChanged
in interface PositionChangeListener
public void notifyMoveDone(ImmutablePosition position, short move)
notifyMoveDone
in interface PositionChangeListener
public void notifyMoveUndone(ImmutablePosition position)
notifyMoveUndone
in interface PositionChangeListener
public java.lang.String getTag(java.lang.String tagName)
public java.lang.String[] getTags()
public void setTag(java.lang.String tagName, java.lang.String tagValue)
public java.lang.String getEvent()
public java.lang.String getSite()
public java.lang.String getDate()
public java.lang.String getRound()
public java.lang.String getWhite()
public java.lang.String getBlack()
public java.lang.String getResultStr()
public java.lang.String getWhiteEloStr()
public java.lang.String getBlackEloStr()
public java.lang.String getEventDate()
public java.lang.String getECO()
public int getResult()
public int getWhiteElo()
public int getBlackElo()
public boolean containsPosition(ImmutablePosition position)
public java.lang.String getInfoString()
public java.lang.String getLongInfoString()
public java.lang.String getHeaderString(int line)
public boolean hasNag(short nag)
public short[] getNags()
public void addNag(short nag)
public void removeNag(short nag)
public java.lang.String getComment()
public void addComment(java.lang.String comment)
public void setComment(java.lang.String comment)
public void removeComment()
public int getCurrentPly()
public int getCurrentMoveNumber()
public int getNextMoveNumber()
public int getNumOfPlies()
public int getNumOfMoves()
public int getTotalNumOfPlies()
public Move getLastMove()
public Move getNextMove()
public short getNextShortMove()
public Move getNextMove(int whichLine)
public short getNextShortMove(int whichLine)
public boolean hasNextMove()
public int getNumOfNextMoves()
public short[] getNextShortMoves()
public Move[] getNextMoves()
public Move[] getMainLine()
public boolean goBack()
public boolean goForward()
public boolean goForward(int whichLine)
public void gotoStart()
public void gotoEndOfLine()
public void goBackToMainLine()
public void goBackToLineBegin()
public void gotoNode(int node)
public void gotoPosition(ImmutablePosition pos)
public void deleteCurrentLine()
public void gotoNode(int node, boolean silent)
public void gotoPosition(ImmutablePosition pos, boolean silent)
public void deleteCurrentLine(boolean silent)
public void traverse(GameListener listener, boolean withLines)
PGN
.
listener
- the listener to receive event when arriving at nodeswithLines
- whether or not to include lines of the current main line.public void save(java.io.DataOutput out, int headerMode, int movesMode) throws java.io.IOException
java.io.IOException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |