Parsing Engine

danbikel.lisp
Class StringSymbol

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

public class StringSymbol
extends Symbol
implements Externalizable

StringSymbol objects associate strings with unique references. This association is maintained in Symbol, not in StringSymbol itself. As a consequence, the new operator for StringSymbol cannot be invoked directly. Rather, new symbols should be created by calling Symbol.add(String).

See Also:
Symbol, IntSymbol, Serialized Form

Constructor Summary
StringSymbol()
          A public, no-arg constructor, required by the Externalizable interface.
 
Method Summary
 Integer getInteger()
          Returns null, since this extension of Symbol only stores strings.
protected  Object getSymKey()
          Returns the key used by the internal symbol map of the class Symbol, which, for this type of symbol, is the String object returned by toString().
 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()
          Returns the print name 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

StringSymbol

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

StringSymbol objects should not be created via this constructor.

Method Detail

toString

public String toString()
Returns the print name of this Symbol.

Specified by:
toString in class Symbol
Returns:
the print name of this Symbol.

getInteger

public Integer getInteger()
Returns null, since this extension of Symbol only stores strings.

Specified by:
getInteger in class Symbol
Returns:
null

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 String object returned by toString().

Specified by:
getSymKey in class Symbol
Returns:
the object returned by toString(). <

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 instance of the StringSymbol that was read from an ObjectInput instance
Throws:
ObjectStreamException - if there is a problem with the underlying read operation

Parsing Engine

Author: Dan Bikel.