Class NumberToken
- java.lang.Object
-
- com.barrybecker4.ca.dj.jigo.sgf.tokens.SGFToken
-
- com.barrybecker4.ca.dj.jigo.sgf.tokens.TextToken
-
- com.barrybecker4.ca.dj.jigo.sgf.tokens.NumberToken
-
- Direct Known Subclasses:
DoubleToken,FileFormatToken,GameTypeToken,HandicapToken,KomiToken,MoveNumberToken,PrintModeToken,SizeToken,SpeciesToken,StonesLeftToken,TimeLimitToken
public abstract class NumberToken extends TextToken
Represents a token that has a number. The number is a float because that's the general case for all numbers in an SGF file.Typically, most numbers are integers, however since Komi usually ends in 0.5, we have to make the number token hold a float by default. Also, sometimes seconds have tenths of a second to them, which are given after the decimal.
Subclasses must implement getDefault().
-
-
Constructor Summary
Constructors Constructor Description NumberToken()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract floatgetDefault()floatgetNumber()Returns the number associated with this token.protected booleanparseContent(java.io.StreamTokenizer st)Reads the text in between the first opening '[' and closing ']'.
-
-
-
Method Detail
-
parseContent
protected boolean parseContent(java.io.StreamTokenizer st) throws java.io.IOException, SGFExceptionDescription copied from class:TextTokenReads the text in between the first opening '[' and closing ']'. This takes into consideration carriage returns, new lines, escaping ('\'), and special punctuation.- Overrides:
parseContentin classTextToken- Parameters:
st- - The stream which contains characters from an SGF file.- Returns:
- true - The content was parsed successfully.
- Throws:
SGFException- - Something quite nasty happened.java.io.IOException
-
getDefault
protected abstract float getDefault()
-
getNumber
public float getNumber()
Returns the number associated with this token.
-
-