Class ResultToken
- 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.ResultToken
-
-
Field Summary
Fields Modifier and Type Field Description static intBLACK_WINSstatic intBY_FORFEITstatic intBY_JIGOstatic intBY_RESIGNATIONstatic intBY_SCOREstatic intBY_TIMEstatic intBY_UNKNOWNstatic intJIGOstatic intSUSPENDEDstatic intWHITE_WINS
-
Constructor Summary
Constructors Constructor Description ResultToken()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetReason()Returns one of the "reason" constants (BY_SCORE, BY_TIME, BY_FORFEIT, BY_RESIGNATION or BY_UNKNOWN).floatgetScore()Provided getReason returns BY_SCORE, this method will return how much the winner won by.intgetWinner()Returns one of the "winner" constants (WHITE_WINS, BLACK_WINS, JIGO, or SUSPENDED).protected booleanparseContent(java.io.StreamTokenizer st)The following conventions are used to denote the game result:java.lang.StringtoString()Returns a human-readable string of the game's result.
-
-
-
Field Detail
-
WHITE_WINS
public static final int WHITE_WINS
- See Also:
- Constant Field Values
-
BLACK_WINS
public static final int BLACK_WINS
- See Also:
- Constant Field Values
-
JIGO
public static final int JIGO
- See Also:
- Constant Field Values
-
SUSPENDED
public static final int SUSPENDED
- See Also:
- Constant Field Values
-
BY_SCORE
public static final int BY_SCORE
- See Also:
- Constant Field Values
-
BY_RESIGNATION
public static final int BY_RESIGNATION
- See Also:
- Constant Field Values
-
BY_TIME
public static final int BY_TIME
- See Also:
- Constant Field Values
-
BY_FORFEIT
public static final int BY_FORFEIT
- See Also:
- Constant Field Values
-
BY_UNKNOWN
public static final int BY_UNKNOWN
- See Also:
- Constant Field Values
-
BY_JIGO
public static final int BY_JIGO
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseContent
protected boolean parseContent(java.io.StreamTokenizer st) throws java.io.IOException, SGFExceptionThe 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:
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
-
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:
toStringin classjava.lang.Object- Returns:
- English text stating the game's result.
-
-