ix.util.lisp
Class Symbol

java.lang.Object
  extended by ix.util.lisp.Symbol
All Implemented Interfaces:
LispObject, SemiPrimitive, java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
DelimitedSymbol, ItemVar, Keyword

public class Symbol
extends java.lang.Object
implements LispObject, SemiPrimitive, java.lang.Comparable, java.io.Serializable

The root class for Lisp symbols.

The correct way to create a new symbol is to call intern(String name). It will return an instance of Symbol or of an appropriate subclass, typically depending on the first character of the name.

See Also:
Serialized Form

Field Summary
protected  java.lang.String name
          This Symbol's name.
protected static java.util.Hashtable obTable
          The mapping from names to Symbols used to ensure that there is at most one symbol with any given name.
 
Constructor Summary
protected Symbol(java.lang.String name)
          Constructs a Symbol with the specified name and records it as the Symbol that corresponds to that name.
 
Method Summary
 int compareTo(java.lang.Object o)
           
static boolean exists(java.lang.String name)
          Returns true iff a symbol with the specified name exists.
static Symbol intern(java.lang.String s)
          Returns the Symbol that has the specified string as its name, creating a new one only if one does not already exist.
(package private) static Symbol quickIntern(java.lang.String s)
          A simple, faster version of intern(String) that is used internally when it's known that the string does not contain any characters that need escaping.
protected  java.lang.Object readResolve()
           
 java.lang.String toString()
           
static Symbol valueOf(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

obTable

protected static java.util.Hashtable obTable
The mapping from names to Symbols used to ensure that there is at most one symbol with any given name.


name

protected java.lang.String name
This Symbol's name.

Constructor Detail

Symbol

protected Symbol(java.lang.String name)
Constructs a Symbol with the specified name and records it as the Symbol that corresponds to that name. This Symbol will then be returned by intern(String) whenever it is given that name. This constructor should not normally be called directly. Call intern(String) instead.

Method Detail

intern

public static Symbol intern(java.lang.String s)
Returns the Symbol that has the specified string as its name, creating a new one only if one does not already exist. Thus, there is always at most one Symbol with a given name. This is a factory method that should be called instead of calling any constructor directly. It returns an instance of Symbol, or of an appropriate subclass of Symbol, depending on the characters in the name.


quickIntern

static Symbol quickIntern(java.lang.String s)
A simple, faster version of intern(String) that is used internally when it's known that the string does not contain any characters that need escaping.


exists

public static boolean exists(java.lang.String name)
Returns true iff a symbol with the specified name exists.


compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

valueOf

public static Symbol valueOf(java.lang.String name)