jwo.utils.syntaxhighlighter
Class Symbol

java.lang.Object
  extended by jwo.utils.syntaxhighlighter.Symbol

public class Symbol
extends Object

A Symbol represents the information shared between similar tokens, that is their type and spelling.

Version:
1.0, February, 2006 modified 15th February, 2006.
Author:
Henk Muller, Minor modifications, Jo Wood.

Field Summary
 String name
          The spelling.
 int type
          Classifies the symbol and distinguishes different symbols with the same spelling, where necessary.
 
Constructor Summary
Symbol(int type, String name)
          Creates a symbol from its type and name.
 
Method Summary
 boolean equals(Object obj)
          Compares the type and name with some other symbol.
 int hashCode()
          Creates a unique hash value from the type and name.
 String toString()
          Reports the name of the symbol.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public int type
Classifies the symbol and distinguishes different symbols with the same spelling, where necessary.


name

public String name
The spelling.

Constructor Detail

Symbol

public Symbol(int type,
              String name)
Creates a symbol from its type and name.

Parameters:
type - Type of symbol to create.
name - Name (spelling) of symbol.
Method Detail

toString

public String toString()
Reports the name of the symbol.

Overrides:
toString in class Object
Returns:
Name (spelling) of symbol.

hashCode

public int hashCode()
Creates a unique hash value from the type and name.

Overrides:
hashCode in class Object
Returns:
Hashcode representing object.

equals

public boolean equals(Object obj)
Compares the type and name with some other symbol.

Overrides:
equals in class Object
Parameters:
obj - Other object with which to compare this one.
Returns:
True if other object matches this one, otherwise false.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009