Class IntSymbol

java.lang.Object
  extended byAbstractSymbol
      extended byIntSymbol

class IntSymbol
extends AbstractSymbol

String table entry for integer constants

See Also:
AbstractSymbol

Field Summary
protected  int index
          The index of this entry in the string table
protected  java.lang.String str
          The stored string
 
Constructor Summary
IntSymbol(java.lang.String str, int len, int index)
           
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this symbol
 void codeDef(int intclasstag, java.io.PrintStream s)
          Generates code for the integer constant definition.
 void codeRef(java.io.PrintStream s)
          Emits a reference to this integer constant.
 boolean equals(java.lang.Object another)
          Tests if two symbols are equal.
 boolean equalsIndex(int index)
          Tests if the index argument is equal to the index of this symbol.
 boolean equalString(java.lang.String str, int len)
          Tests if the string argument is equal to the string in this symbol.
 java.lang.String getString()
          Returns the string representation of this symbol.
 java.lang.String toString()
          Returns a printable representation of this symbol.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

str

protected java.lang.String str
The stored string


index

protected int index
The index of this entry in the string table

Constructor Detail

IntSymbol

public IntSymbol(java.lang.String str,
                 int len,
                 int index)
Method Detail

codeDef

public void codeDef(int intclasstag,
                    java.io.PrintStream s)
Generates code for the integer constant definition. This method is incomplete; you get to finish it up in programming assignment 5.

Parameters:
intclasstag - the class tag for string object
s - the output stream

codeRef

public void codeRef(java.io.PrintStream s)
Emits a reference to this integer constant.

Parameters:
s - the output stream

clone

public java.lang.Object clone()
Returns a copy of this symbol

Specified by:
clone in class AbstractSymbol

equalString

public boolean equalString(java.lang.String str,
                           int len)
Tests if the string argument is equal to the string in this symbol.

Parameters:
str - the string to compare
Returns:
true if the strings are equal

equalsIndex

public boolean equalsIndex(int index)
Tests if the index argument is equal to the index of this symbol. It is only meaningful to compare indecies of symbols from the same string table.

Parameters:
index - the index to compare
Returns:
true if the indecies are equal

equals

public boolean equals(java.lang.Object another)
Tests if two symbols are equal. Symbol equality is equivalent to equality of their indecies, so it is only meaningful to compare symbols that came from the same string table.

Parameters:
another - the other symbol
Returns:
true if the symbols are equal

getString

public java.lang.String getString()
Returns the string representation of this symbol.


toString

public java.lang.String toString()
Returns a printable representation of this symbol.