Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess.io
Class ChessAnnotation

java.lang.Object
  extended byictk.boardgame.chess.io.ChessAnnotation
All Implemented Interfaces:
Annotation

public class ChessAnnotation
extends java.lang.Object
implements Annotation

ChessAnnotation - typicall annotations and comments on a move. Primarily these are Numeric Annotation Glyphs and String comments.


Constructor Summary
ChessAnnotation()
           
ChessAnnotation(java.lang.String comment)
           
 
Method Summary
 void addNAG(int nag)
          add a new NumericAnnotationGlyph (NAG) to the annotation.
 void appendComment(java.lang.String com)
          appends to the current comment
 java.lang.String dump()
          used for diagnostics only
 boolean equals(java.lang.Object obj)
          this is an exact, one for one, comparison
 java.lang.String getComment()
          returns the verbose comment/
 short getNAG(int i)
           
 short[] getNAGs()
          returns a short array of NAGs for this annotation.
 java.lang.String getNAGString()
          calls getNAGString(false)
 java.lang.String getNAGString(boolean allNumeric)
          returns the array of NAGs as a string delimited by .
 short getSuffix()
          this returns the first nag in the nags list only if it is one of the nags that can be used as a suffix to a move.
 int hashCode()
          hashes on the comment and the nags
 void removeNAG(int i)
          removes the NAG from the NAG list.
 void setComment(java.lang.String com)
          sets the comment, erasing any old comment.
 void setNAG(int i, int nag)
          sets a nag to a specific value.
 java.lang.String toString()
          only useful for diagnostics.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChessAnnotation

public ChessAnnotation()

ChessAnnotation

public ChessAnnotation(java.lang.String comment)
Method Detail

getSuffix

public short getSuffix()
this returns the first nag in the nags list only if it is one of the nags that can be used as a suffix to a move. Such as (?,!!,??,!?,?!) If not, then 0 is returned, even if nags[0] has a value.


addNAG

public void addNAG(int nag)
add a new NumericAnnotationGlyph (NAG) to the annotation. There is no theoretical limit on the max number of NAGs for a particular annotation.


setNAG

public void setNAG(int i,
                   int nag)
sets a nag to a specific value.

Throws:
java.lang.ArrayIndexOutOfBoundsException

getNAG

public short getNAG(int i)

getNAGs

public short[] getNAGs()
returns a short array of NAGs for this annotation. NOTE: this is a reference to the original array, not a copy. However this might change at any time, so don't rely on this.


getNAGString

public java.lang.String getNAGString(boolean allNumeric)
returns the array of NAGs as a string delimited by . This will include suffixes and numeric NAGs. Those NAGs that have a non-numeric notation will be represented as such.

Parameters:
allNumeric - represents all NAGs numerically.
Returns:
null if there are no NAGs associated with this annotation

getNAGString

public java.lang.String getNAGString()
calls getNAGString(false)


removeNAG

public void removeNAG(int i)
removes the NAG from the NAG list.


setComment

public void setComment(java.lang.String com)
Description copied from interface: Annotation
sets the comment, erasing any old comment.

Specified by:
setComment in interface Annotation

appendComment

public void appendComment(java.lang.String com)
Description copied from interface: Annotation
appends to the current comment

Specified by:
appendComment in interface Annotation

getComment

public java.lang.String getComment()
Description copied from interface: Annotation
returns the verbose comment/

Specified by:
getComment in interface Annotation

equals

public boolean equals(java.lang.Object obj)
this is an exact, one for one, comparison


hashCode

public int hashCode()
hashes on the comment and the nags


toString

public java.lang.String toString()
only useful for diagnostics.


dump

public java.lang.String dump()
used for diagnostics only

Specified by:
dump in interface Annotation

Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .