Internet Chess ToolKit
v0.2.0

ictk.boardgame.chess.io
Class NAG

java.lang.Object
  extended byictk.boardgame.chess.io.NAG

public class NAG
extends java.lang.Object

Numeric Annotation Glyph (NAG) - this class is used to translate, and parse, NAG into verbose annotations. The verbose annotations can be fed by Locale specific resource bundles. The NAGs supported are the offical standard NAGs, the Informant proposed NAGs (N, RR), and the Scid NAGs (D).
NOTE: if your native language is not available and you'd like to contribute it please send me a translation.


Field Summary
static short MAX_NAG
           
 
Constructor Summary
NAG()
           
NAG(java.util.Locale locale)
           
 
Method Summary
 java.util.Locale getLocale()
          NOT IMPLEMENTED YET
static boolean isSuffix(int s)
          checks to see if the NAG is qualified to be a suffix for a move.
static boolean isSuffix(java.lang.String str)
          checks to see if the NAG is qualified to be a suffix for a move.
static boolean isSymbol(int s)
          checks to see if the number matches of the recognized symbols.
static boolean isSymbol(java.lang.String str)
          checks to see if the String exactly matches of the recognized symbols.
 java.lang.String numberToDescription(int nag)
          converts a NAG into its verbose string interpretation
static java.lang.String numberToString(int nag)
          translates the NAG number into its String representation.
static java.lang.String numberToString(int nag, boolean allNumeric)
          translates the NAG number into its String representation.
 boolean setLocale(java.util.Locale locale)
          NOT IMPLEMENTED YET
static short stringToNumber(java.lang.String str)
          converts move suffix annotations to their NAG values.
static short[] stringToNumbers(java.lang.String s)
           
static short symbolToNumber(java.lang.String str)
          Similar to stringToNumber() but only works for recognized symbols.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_NAG

public static short MAX_NAG
Constructor Detail

NAG

public NAG()

NAG

public NAG(java.util.Locale locale)
Method Detail

setLocale

public boolean setLocale(java.util.Locale locale)
NOT IMPLEMENTED YET


getLocale

public java.util.Locale getLocale()
NOT IMPLEMENTED YET


stringToNumbers

public static short[] stringToNumbers(java.lang.String s)

stringToNumber

public static short stringToNumber(java.lang.String str)
converts move suffix annotations to their NAG values.

Returns:
0 if it is not a recognized string.

isSuffix

public static boolean isSuffix(java.lang.String str)
checks to see if the NAG is qualified to be a suffix for a move. Such as !,?,!!,??,!?,?!. Only an exact match should be true.


isSuffix

public static boolean isSuffix(int s)
checks to see if the NAG is qualified to be a suffix for a move. Such as !,?,!!,??,!?,?!


isSymbol

public static boolean isSymbol(int s)
checks to see if the number matches of the recognized symbols. Such as !, ?!, +=, RR, D.

Returns:
true if the String exactly matches one of the standard symbols.

isSymbol

public static boolean isSymbol(java.lang.String str)
checks to see if the String exactly matches of the recognized symbols. Such as !, ?!, +=.

Returns:
true if the String exactly matches one of the standard symbols.

symbolToNumber

public static short symbolToNumber(java.lang.String str)
Similar to stringToNumber() but only works for recognized symbols. For all other NAGs and non-symbols zero is returned.


numberToString

public static java.lang.String numberToString(int nag)
translates the NAG number into its String representation. This would include !, ?, +=, and $123 when appropriate.


numberToString

public static java.lang.String numberToString(int nag,
                                              boolean allNumeric)
translates the NAG number into its String representation. This would include !, ?, +=, and $123 when appropriate.

Parameters:
allNumeric - if true will only return the numeric format. If false will return symbols and numbers.
Returns:
null if nag is out of range.

numberToDescription

public java.lang.String numberToDescription(int nag)
converts a NAG into its verbose string interpretation


Submit a bug or feature
Visit the Website
Internet Chess ToolKit is licensed under the GPL v2 .