Parsing Engine

danbikel.lisp
Class IntSymbol

java.lang.Object
  extended by danbikel.lisp.Sexp
      extended by danbikel.lisp.Symbol
          extended by danbikel.lisp.IntSymbol
All Implemented Interfaces:
Externalizable, Serializable

public class IntSymbol
extends Symbol
implements Externalizable

IntSymbol objects associate integers with unique references. This association is maintained in Symbol, not in IntSymbol itself. As a consequence, the new operator for IntSymbol cannot be invoked directly. Rather, new symbols are created by calling Symbol.add(Integer) or Symbol.add(int).

See Also:
Symbol, StringSymbol, Serialized Form

Constructor Summary
IntSymbol()
          A public, no-arg constructor, required by the Externalizable interface.
 
Method Summary
 Integer getInteger()
          Gets the internal Integer object for this symbol.
protected  Object getSymKey()
          Returns the key used by the internal symbol map of the class Symbol, which, for this type of symbol, is the Integer object returned by getInteger().
 void readExternal(ObjectInput in)
          Reads this object from an ObjectInput instance.
 Object readResolve()
          Deals with the issue of uniqueness when we are dealing with more than one VM by adding the read symbol to the symbol map, if it is not already there.
 String toString()
          Gets a string representation of this symbol.
 void writeExternal(ObjectOutput out)
          Writes this object to an ObjectOutput instance.
 
Methods inherited from class danbikel.lisp.Symbol
add, add, add, clean, deepCopy, get, get, get, isList, isSymbol
 
Methods inherited from class danbikel.lisp.Sexp
getCanonical, list, main, read, read, read, symbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntSymbol

public IntSymbol()
A public, no-arg constructor, required by the Externalizable interface.

IntSymbol objects should not be created via this constructor.

Method Detail

toString

public String toString()
Gets a string representation of this symbol.

Specified by:
toString in class Symbol
Returns:
a string representation of this symbol, by calling Integer.toString() on this object's internal Integer object.

getInteger

public Integer getInteger()
Gets the internal Integer object for this symbol.

Specified by:
getInteger in class Symbol
Returns:
the internal Integer object for this symbol.

getSymKey

protected Object getSymKey()
Returns the key used by the internal symbol map of the class Symbol, which, for this type of symbol, is the Integer object returned by getInteger().

Specified by:
getSymKey in class Symbol
Returns:
the object returned by getInteger()

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Writes this object to an ObjectOutput instance.

Specified by:
writeExternal in interface Externalizable
Specified by:
writeExternal in class Sexp
Parameters:
out - the object stream to which to write an object of this class
Throws:
IOException - if the underlying write operation throws an IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Reads this object from an ObjectInput instance.

Specified by:
readExternal in interface Externalizable
Specified by:
readExternal in class Sexp
Parameters:
in - the object stream from which to read objects of this class
Throws:
IOException - if the underlying read operation throws an IOException
ClassNotFoundException - if the underlying read operation throws an ClassNotFoundException

readResolve

public Object readResolve()
                   throws ObjectStreamException
Deals with the issue of uniqueness when we are dealing with more than one VM by adding the read symbol to the symbol map, if it is not already there.

Returns:
the canonical version of this symbol
Throws:
ObjectStreamException - if there is a problem with the underlying read operation

Parsing Engine

Author: Dan Bikel.