chesspresso.game
Class GameMoveModel

java.lang.Object
  |
  +--chesspresso.game.GameMoveModel

public class GameMoveModel
extends java.lang.Object

Version:
$Revision: 1.1 $
Author:
Bernhard Seybold

Field Summary
(package private) static short COMMENT_END
           
(package private) static short COMMENT_START
           
(package private) static short LAST_SPECIAL
           
(package private) static short LINE_END
           
(package private) static short LINE_START
           
static int MODE_EVERYTHING
           
(package private) static short NAG_BASE
           
(package private) static short NO_MOVE
           
 
Constructor Summary
GameMoveModel()
           
GameMoveModel(java.io.DataInput in, int mode)
           
 
Method Summary
 boolean addComment(int index, java.lang.String comment)
           
 void addNag(int index, short nag)
           
 int appendAsRightMostLine(int index, short move)
           
 void deleteCurrentLine(int index)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getComment(int index)
           
 long getHashCode()
           
 short getMove(int index)
           
 short[] getNags(int index)
           
 int getNumOfNextMoves(int index)
           
 int getTotalCommentSize()
           
 int getTotalNumOfPlies()
           
 int goBack(int index, boolean gotoMainLine)
           
 int goForward(int index)
          Advances one move in the current line.
 int goForward(int index, int whichLine)
           
 int hashCode()
           
 boolean hasLines()
           
 boolean hasNag(int index, short nag)
           
 boolean hasNextMove(int index)
           
 void load(java.io.DataInput in, int mode)
           
 int pack(int index)
           
 boolean removeComment(int index)
           
 boolean removeNag(int index, short nag)
           
 void save(java.io.DataOutput out, int mode)
           
 boolean setComment(int index, java.lang.String comment)
           
(package private) static java.lang.String valueToString(short value)
           
 void write(java.io.PrintStream out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_EVERYTHING

public static final int MODE_EVERYTHING
See Also:
Constant Field Values

NO_MOVE

static final short NO_MOVE
See Also:
Constant Field Values

LINE_START

static final short LINE_START
See Also:
Constant Field Values

LINE_END

static final short LINE_END
See Also:
Constant Field Values

COMMENT_START

static final short COMMENT_START
See Also:
Constant Field Values

COMMENT_END

static final short COMMENT_END
See Also:
Constant Field Values

NAG_BASE

static final short NAG_BASE
See Also:
Constant Field Values

LAST_SPECIAL

static final short LAST_SPECIAL
Constructor Detail

GameMoveModel

public GameMoveModel()

GameMoveModel

public GameMoveModel(java.io.DataInput in,
                     int mode)
              throws java.io.IOException
Method Detail

hasNag

public boolean hasNag(int index,
                      short nag)

getNags

public short[] getNags(int index)

addNag

public void addNag(int index,
                   short nag)

removeNag

public boolean removeNag(int index,
                         short nag)

getComment

public java.lang.String getComment(int index)

addComment

public boolean addComment(int index,
                          java.lang.String comment)

removeComment

public boolean removeComment(int index)

setComment

public boolean setComment(int index,
                          java.lang.String comment)

hasLines

public boolean hasLines()

getTotalNumOfPlies

public int getTotalNumOfPlies()

getTotalCommentSize

public int getTotalCommentSize()

getMove

public short getMove(int index)

goBack

public int goBack(int index,
                  boolean gotoMainLine)
Returns:
-1 if at the beginning of a line

goForward

public int goForward(int index)
Advances one move in the current line.

Parameters:
index - the index of the current move
Returns:
the index of the next move. If the next move does not exist, the index points to a LINE_END, where a next move should be inserted.

goForward

public int goForward(int index,
                     int whichLine)

getNumOfNextMoves

public int getNumOfNextMoves(int index)

hasNextMove

public boolean hasNextMove(int index)

appendAsRightMostLine

public int appendAsRightMostLine(int index,
                                 short move)

deleteCurrentLine

public void deleteCurrentLine(int index)

pack

public int pack(int index)

load

public void load(java.io.DataInput in,
                 int mode)
          throws java.io.IOException
java.io.IOException

save

public void save(java.io.DataOutput out,
                 int mode)
          throws java.io.IOException
java.io.IOException

valueToString

static java.lang.String valueToString(short value)

write

public void write(java.io.PrintStream out)

getHashCode

public long getHashCode()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object