Class ResultToken

  • All Implemented Interfaces:
    InfoToken

    public class ResultToken
    extends TextToken
    implements InfoToken
    The result for this game (jigo, winner: score, resignation, time).

    The constants should be obvious. The "toString" method returns an English-readable string of the game's result.

    • Constructor Summary

      Constructors 
      Constructor Description
      ResultToken()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getReason()
      Returns one of the "reason" constants (BY_SCORE, BY_TIME, BY_FORFEIT, BY_RESIGNATION or BY_UNKNOWN).
      float getScore()
      Provided getReason returns BY_SCORE, this method will return how much the winner won by.
      int getWinner()
      Returns one of the "winner" constants (WHITE_WINS, BLACK_WINS, JIGO, or SUSPENDED).
      protected boolean parseContent​(java.io.StreamTokenizer st)
      The following conventions are used to denote the game result:
      java.lang.String toString()
      Returns a human-readable string of the game's result.
      • Methods inherited from class com.barrybecker4.ca.dj.jigo.sgf.tokens.TextToken

        getText
      • Methods inherited from class com.barrybecker4.ca.dj.jigo.sgf.tokens.SGFToken

        parse
      • Methods inherited from class java.lang.Object

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

      • ResultToken

        public ResultToken()
    • Method Detail

      • parseContent

        protected boolean parseContent​(java.io.StreamTokenizer st)
                                throws java.io.IOException,
                                       SGFException
        The following conventions are used to denote the game result:
           "0" (zero) or "Draw" for a draw (jigo),
           "B+score" for black win
           "W+score" for white win
             e.g. "B+0.5", "W+64", "B+12.5"
        
           "B+R"  | "B+Resign",  "W+R" | "W+Resign" for win by resignation
           "B+T"  | "B+Time",    "W+T" | "W+Time" for win by time
           "B+F"  | "B+Forfeit", "W+F" | "W+Forfeit" for win by forfeit
           "Void" | "?" for no result/suspended play/unknown result
         
        Overrides:
        parseContent in class TextToken
        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
      • getWinner

        public int getWinner()
        Returns one of the "winner" constants (WHITE_WINS, BLACK_WINS, JIGO, or SUSPENDED).
        Returns:
        Who won, tie game, or suspended (check against constants).
      • getReason

        public int getReason()
        Returns one of the "reason" constants (BY_SCORE, BY_TIME, BY_FORFEIT, BY_RESIGNATION or BY_UNKNOWN).
        Returns:
        The reason for winning.
      • getScore

        public float getScore()
        Provided getReason returns BY_SCORE, this method will return how much the winner won by.
        Returns:
        How many points the winner obtained.
      • toString

        public java.lang.String toString()
        Returns a human-readable string of the game's result.
        Overrides:
        toString in class java.lang.Object
        Returns:
        English text stating the game's result.