sisc.data
Class Symbol

java.lang.Object
  extended by sisc.util.Util
      extended by sisc.data.Expression
          extended by sisc.data.Value
              extended by sisc.data.Symbol
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Immediate, ExpressionVisitee, Version
Direct Known Subclasses:
MemoizedSymbol

public class Symbol
extends Value

See Also:
Serialized Form

Field Summary
 java.lang.String symval
           
 
Fields inherited from class sisc.data.Expression
annotations, EMPTYSET
 
Fields inherited from class sisc.util.Util
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV
 
Fields inherited from interface sisc.util.Version
VERSION
 
Constructor Summary
Symbol()
           
Symbol(java.lang.String symval)
           
 
Method Summary
 void deserialize(Deserializer s)
          All Expressions must implement a default (no-argument) constructor.
 void display(ValueWriter w)
           
static Symbol get(java.lang.String str)
          Retrieves the value of the symbol with the given name.
static Symbol get(java.lang.String str, boolean caseSensitive)
          Retrieves the value of the symbol with the given name.
static Symbol getUnique(java.lang.String str)
           
static Symbol intern(java.lang.String str)
          Interns the symbol with the given name.
 Symbol normalize()
           
 void serialize(Serializer s)
          All Expressions must implement a default (no-argument) constructor.
 boolean valueEqual(Value v)
          Compares this value to another for semantic equality.
 int valueHashCode()
          a hashCode function consistent with valueEqual
 void write(ValueWriter w)
           
 
Methods inherited from class sisc.data.Value
apply, displayNamedOpaque, equals, eqv, eval, express, getValue, synopsis, synopsis, toString, writeReplace
 
Methods inherited from class sisc.data.Expression
deserializeAnnotations, getAnnotation, getAnnotation, getAnnotationKeys, getAnnotations, getName, readExternal, readResolve, serializeAnnotations, setAnnotation, setAnnotation, setName, visit, visitAnnotations, writeExternal
 
Methods inherited from class sisc.util.Util
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

symval

public java.lang.String symval
Constructor Detail

Symbol

public Symbol(java.lang.String symval)

Symbol

public Symbol()
Method Detail

getUnique

public static Symbol getUnique(java.lang.String str)

intern

public static Symbol intern(java.lang.String str)
Interns the symbol with the given name.

Returns:
the value of the symbol, or null if it is not defined

get

public static Symbol get(java.lang.String str)
Retrieves the value of the symbol with the given name. Equivalent to get(str,false).

Returns:
the value of the symbol, or null if it is not defined

get

public static Symbol get(java.lang.String str,
                         boolean caseSensitive)
Retrieves the value of the symbol with the given name.

Parameters:
str - the name of the symbol
caseSensitive - true if the case of the symbol name is to be respected
Returns:
the value of the symbol, or null if it is not defined

normalize

public Symbol normalize()

display

public void display(ValueWriter w)
             throws java.io.IOException
Specified by:
display in class Value
Throws:
java.io.IOException

valueHashCode

public int valueHashCode()
Description copied from class: Value
a hashCode function consistent with valueEqual

Overrides:
valueHashCode in class Value
Returns:
hash code

valueEqual

public boolean valueEqual(Value v)
Description copied from class: Value
Compares this value to another for semantic equality. Used to implement Scheme's 'equal?'. Subclasses must test for pointer equality as well as semantic equality, so that infinite loops on recursive structures are less likely.

Overrides:
valueEqual in class Value
Parameters:
v - the other Value

write

public void write(ValueWriter w)
           throws java.io.IOException
Overrides:
write in class Value
Throws:
java.io.IOException

serialize

public void serialize(Serializer s)
               throws java.io.IOException
Description copied from class: Expression
All Expressions must implement a default (no-argument) constructor. Those that wish to be serialized to a heap must implement both this and the deserialize method. The Expression may use any method of the Serializer, which implements java.io.DataOutput to write its state.

Overrides:
serialize in class Expression
Parameters:
s - the Serializer
Throws:
java.io.IOException

deserialize

public void deserialize(Deserializer s)
                 throws java.io.IOException
Description copied from class: Expression
All Expressions must implement a default (no-argument) constructor. Those that wish to b serialized to a heap must implement both this and the serialize method. The Expression may use any method of the DataInput stream and the Deserializer serialization context to read its state.

Overrides:
deserialize in class Expression
Parameters:
s - the Deserializer
Throws:
java.io.IOException