QJCC homepage

biz.chitec.quarterback.gjsa
Class DynamicChatSymbolHolder

java.lang.Object
  extended bybiz.chitec.quarterback.gjsa.ChatSymbolHolder
      extended bybiz.chitec.quarterback.gjsa.DynamicChatSymbolHolder

public class DynamicChatSymbolHolder
extends ChatSymbolHolder

Dynamic version of a CharSymbolHolder. Can be loaded with number/symbols pairs at runtime. Note that this is not the usual way of defining a ChatSymbolHolder. Normally, they will be defined through a preprocessor so that they contain a list of int constants which can be used in case-clauses. This one is nice for small demo projects or similar applications where the preprocessor overhead would be too complicated.

Version:
$Id: 0a5ea4e9fa305834aedbbef2c5f9e062cde6b58b $
Author:
chitec/Dirk Hillbrecht, 2003

Field Summary
private  java.util.Map byint
           
private  java.util.Map bystring
           
private  java.lang.String symbolsetname
           
 
Constructor Summary
DynamicChatSymbolHolder(java.lang.String ssnx)
          Initialized the holder with a name.
 
Method Summary
 void addSymbol(int ival, java.lang.String sval)
          Adds a int-String pair as content.
 java.lang.String getSymbolSetName()
          Return the name of the symbol set.
 int[] getSymbolSetVersion()
          Version of the symbol set in version-subversion-patchlevel type.
 java.lang.String numericToSymbol(int numeric)
          Return the string-based representation of the symbol.
 int symbolToNumeric(java.lang.String symbol)
          Return the numeric equivalent to a symbol given as String.
 
Methods inherited from class biz.chitec.quarterback.gjsa.ChatSymbolHolder
anyToNumeric, equals, getAllSymbols, getAllSymbolsQIA, getSymbolSetVersionV
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbolsetname

private java.lang.String symbolsetname

byint

private java.util.Map byint

bystring

private java.util.Map bystring
Constructor Detail

DynamicChatSymbolHolder

public DynamicChatSymbolHolder(java.lang.String ssnx)
Initialized the holder with a name.

Method Detail

addSymbol

public void addSymbol(int ival,
                      java.lang.String sval)
Adds a int-String pair as content. Note that neither the int nor the String must be passed twice into the same symbol holder, otherwise a CommandException is raised.

Parameters:
ival - The int value
sval - The symbolic value as a String

symbolToNumeric

public int symbolToNumeric(java.lang.String symbol)
Description copied from class: ChatSymbolHolder
Return the numeric equivalent to a symbol given as String. Usually, this method is implemented in the subclasses by a preprocessor.

Specified by:
symbolToNumeric in class ChatSymbolHolder
Parameters:
symbol - Value of the symbol as String
Returns:
The symbol's integer value.

numericToSymbol

public java.lang.String numericToSymbol(int numeric)
Description copied from class: ChatSymbolHolder
Return the string-based representation of the symbol. Usually, this method is implemented in the subclasses by a preprocessor.

Specified by:
numericToSymbol in class ChatSymbolHolder
Parameters:
numeric - The symbol's integer value.
Returns:
Value of the symbol as String.

getSymbolSetName

public java.lang.String getSymbolSetName()
Description copied from class: ChatSymbolHolder
Return the name of the symbol set. Usually, this method is implemented in the subclasses by a preprocessor.

Specified by:
getSymbolSetName in class ChatSymbolHolder
Returns:
Arbitrary name of the symbol set.

getSymbolSetVersion

public int[] getSymbolSetVersion()
Description copied from class: ChatSymbolHolder
Version of the symbol set in version-subversion-patchlevel type. Usually, this method is implemented in the subclasses by a preprocessor.

Specified by:
getSymbolSetVersion in class ChatSymbolHolder
Returns:
int-array with three elements being version (index 0), subversion (index 1) and patchlevel (index 2) of the symbol set.

QJCC homepage