Class SGFToken

  • Direct Known Subclasses:
    PlacementToken, TextToken

    public abstract class SGFToken
    extends java.lang.Object
    The 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
      boolean parse​(java.io.StreamTokenizer st)
      Called to parse itself.
      protected abstract boolean parseContent​(java.io.StreamTokenizer st)
      Subclasses must read all of the content and the final closing bracket.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SGFToken

        public SGFToken()
    • Method Detail

      • parse

        public boolean parse​(java.io.StreamTokenizer st)
                      throws java.io.IOException,
                             SGFException
        Called 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.IOException
        SGFException
      • parseContent

        protected abstract boolean parseContent​(java.io.StreamTokenizer st)
                                         throws java.io.IOException,
                                                SGFException
        Subclasses 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