jdrew.oo.util
Class SymbolTable

java.lang.Object
  extended by jdrew.oo.util.SymbolTable

public class SymbolTable
extends java.lang.Object

This class is responsible for managing the integer codes that are used by the engine datastructers to represent roles and symbols. Integer codes are used as these values are compared frequently and integer comparisons are consierably more efficent than string comparisons.

Title: OO jDREW

Description: Reasoning Engine for the Semantic Web - Supporting OO RuleML 0.88

Copyright: Copyright (c) 2005


Field Summary
static int genid
          This is used to generate new Skolem constants; ensuring uniqueness of all generated constants.
static int IASSERT
          This integer stores the code for an assert term.
static int IINCONSISTENT
           
static int INAF
          This integer stores the code for a NAF term.
static int INEG
           
static int INOROLE
          This integer stores the integer code that is used for the role of positional parameters.
static int INOSYM
          This symbol takes up the first slot in the symbol table - as we ensure that the integer code 0 is never used.
static int IOID
          This integer stores the integer code that is used for the system oid role.
static int IPLEX
          This integer stores the code for the "constructor" of a plex term.
static int IPREST
          This integer stores the integer code that is used for the role of positional rest parameters.
static int IREST
          This integer stores the integer code that is used for the role of slotted rest parameters.
static java.util.Vector roles
          This vector stores all known roles.
static java.util.Vector symbols
          This vector stores all known symbols.
 
Constructor Summary
SymbolTable()
           
 
Method Summary
static int internRole(java.lang.String role)
          This method is used to initalize a role and assign it an integer code if it has not been used before; or retrieve the integer code of a role if it already has been encountered.
static int internSymbol(java.lang.String sym)
          This method is used to initalize a symbol and assign it an integer code if it has not been used before; or retrieve the integer code of a symbol if it already has been encountered.
static void reset()
          This method is used to reset the symbol table.
static java.lang.String role(int idx)
          This method gets the string representation of a role for the integer code.
static java.lang.String symbol(int idx)
          This method gets the string representation of a symbol for the integer code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbols

public static java.util.Vector symbols
This vector stores all known symbols. The index of the symbol within this vector is the integer code that is used to represent this symbol.


roles

public static java.util.Vector roles
This vector stores all known roles. The index of the role within this vector is the integer code that is used to represent this role.


genid

public static int genid
This is used to generate new Skolem constants; ensuring uniqueness of all generated constants.


IOID

public static final int IOID
This integer stores the integer code that is used for the system oid role.


INOROLE

public static final int INOROLE
This integer stores the integer code that is used for the role of positional parameters.


IPREST

public static final int IPREST
This integer stores the integer code that is used for the role of positional rest parameters.


IREST

public static final int IREST
This integer stores the integer code that is used for the role of slotted rest parameters. This is set equal to Integer.MAX_VALUE to ensure that it will always be the final parameter in the normalized parameter lists.

See Also:
Constant Field Values

INOSYM

public static final int INOSYM
This symbol takes up the first slot in the symbol table - as we ensure that the integer code 0 is never used. This is not else where.


INAF

public static final int INAF
This integer stores the code for a NAF term.


IPLEX

public static final int IPLEX
This integer stores the code for the "constructor" of a plex term.


IASSERT

public static final int IASSERT
This integer stores the code for an assert term.


IINCONSISTENT

public static final int IINCONSISTENT

INEG

public static final int INEG
Constructor Detail

SymbolTable

public SymbolTable()
Method Detail

reset

public static void reset()
This method is used to reset the symbol table. Data structures that were created previous to this should no longer be used.


internSymbol

public static int internSymbol(java.lang.String sym)
This method is used to initalize a symbol and assign it an integer code if it has not been used before; or retrieve the integer code of a symbol if it already has been encountered.

Parameters:
sym - String A string containing the symbol.
Returns:
int The integer code of the symbol.

internRole

public static int internRole(java.lang.String role)
This method is used to initalize a role and assign it an integer code if it has not been used before; or retrieve the integer code of a role if it already has been encountered.

Parameters:
role - String A string containing the role name.
Returns:
int The integer code of the role.

symbol

public static java.lang.String symbol(int idx)
This method gets the string representation of a symbol for the integer code. This is commonly used by output routines.

Parameters:
idx - int The integer code to get the symbol string for.
Returns:
String The symbol string.

role

public static java.lang.String role(int idx)
This method gets the string representation of a role for the integer code. This is commonly used by output routines.

Parameters:
idx - int The integer code to get the role string for.
Returns:
String The role string.