org.ourgrid.common.spec.grammar
Class Symbol

java.lang.Object
  extended by org.ourgrid.common.spec.grammar.Symbol
All Implemented Interfaces:
java.io.Serializable

public class Symbol
extends java.lang.Object
implements java.io.Serializable

Project: Caymman(DSC/UFCG) Description: This class represents a symbol formed by (code + value + type), where type can be Symbol.TERMINAL,
Symbol.TERMINAL or Symbol.SEMANTIC_ACTION.

Version:
1.0 Created on Jun 17, 2003 Last update: Jun 19, 2003
See Also:
Serialized Form

Field Summary
static Symbol EMPTY
           
static Symbol EOF
           
static int NON_TERMINAL
           
static int SEMANTIC_ACTION
           
static int TERMINAL
           
 
Constructor Summary
Symbol()
          An empty constructor
Symbol(int code, java.lang.String value, int type)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the object obj is a Symbol and the code = obj.getCode().
 int getCode()
          Gets the code of the symbol
 java.lang.String getValue()
          Gets the symbol
 boolean isNonTerminal()
          Returns true if the symbol is a non terminal
 boolean isSemanticAction()
          Returns true if the symbol is a semantic action
 boolean isTerminal()
          Returns true if the symbol is a terminal
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TERMINAL

public static final int TERMINAL
See Also:
Constant Field Values

NON_TERMINAL

public static final int NON_TERMINAL
See Also:
Constant Field Values

SEMANTIC_ACTION

public static final int SEMANTIC_ACTION
See Also:
Constant Field Values

EMPTY

public static final Symbol EMPTY

EOF

public static final Symbol EOF
Constructor Detail

Symbol

public Symbol(int code,
              java.lang.String value,
              int type)
Constructor

Parameters:
code - The code of the symbol
value - The symbol identifier
type - The code of the type of the symbol

Symbol

public Symbol()
An empty constructor

Method Detail

getCode

public int getCode()
Gets the code of the symbol

Returns:
The code of the symbol

getValue

public java.lang.String getValue()
Gets the symbol

Returns:
The symbol

isTerminal

public boolean isTerminal()
Returns true if the symbol is a terminal

Returns:
True if the symbol is a terminal, false otherwise.

isNonTerminal

public boolean isNonTerminal()
Returns true if the symbol is a non terminal

Returns:
True if the symbol is a non terminal, false otherwise.

isSemanticAction

public boolean isSemanticAction()
Returns true if the symbol is a semantic action

Returns:
True if the symbol is a semantic action, false otherwise.

equals

public boolean equals(java.lang.Object obj)
Returns true if the object obj is a Symbol and the code = obj.getCode().

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.