Class SGFToken
- java.lang.Object
-
- com.barrybecker4.ca.dj.jigo.sgf.tokens.SGFToken
-
- Direct Known Subclasses:
PlacementToken,TextToken
public abstract class SGFToken extends java.lang.ObjectThe big daddy of all SGFTokens. All SGFTokens are subclassed from this token. All subclasses must know how to parse themselves. The most common subclass is the generic TextToken (the superclass to nearly all other tokens).
-
-
Constructor Summary
Constructors Constructor Description SGFToken()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanparse(java.io.StreamTokenizer st)Called to parse itself.protected abstract booleanparseContent(java.io.StreamTokenizer st)Subclasses must read all of the content and the final closing bracket.
-
-
-
Method Detail
-
parse
public boolean parse(java.io.StreamTokenizer st) throws java.io.IOException, SGFExceptionCalled to parse itself. Subclasses are responsible for reading everything up to and including the final closing ']'. (Some classes have multiple list items, which means multiple closing ']'.)- Parameters:
st- - The SGF stream from which characters can be read.- Throws:
java.io.IOExceptionSGFException
-
parseContent
protected abstract boolean parseContent(java.io.StreamTokenizer st) throws java.io.IOException, SGFExceptionSubclasses must read all of the content and the final closing bracket. This is cool because all tokens end with a closing bracket anyway, which tells them when to stop reading. That's why there isn't a symmetrical read and validate (int)']' in the parse method, above.- Parameters:
st- - The SGF stream from which characters can be read.- Throws:
SGFException- - Something quite nasty happened.java.io.IOException
-
-