Jatha Software

org.jatha.dynatype
Class StandardLispSymbol

java.lang.Object
  extended by org.jatha.dynatype.StandardLispValue
      extended by org.jatha.dynatype.StandardLispAtom
          extended by org.jatha.dynatype.StandardLispSymbol
All Implemented Interfaces:
Comparable, LispAtom, LispSymbol, LispValue
Direct Known Subclasses:
SECDRegister, StandardLispConstant

public class StandardLispSymbol
extends StandardLispAtom
implements LispSymbol

LispSymbol implements LISP Symbols, including provisions for special bindings.

See Also:
LispValue, LispAtom

Field Summary
protected  Map f_documentation
           
protected  LispValue f_function
           
protected  boolean f_isExternalInPackage
           
protected  boolean f_isSpecial
           
protected  boolean f_mixedCase
           
protected  LispString f_name
           
protected  LispPackage f_package
           
protected  LispValue f_plist
           
protected  int f_specialCount
           
protected  LispValue f_value
           
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
StandardLispSymbol()
           
StandardLispSymbol(Jatha lisp, LispString symbolNameString)
           
StandardLispSymbol(Jatha lisp, String symbolName)
           
 
Method Summary
 void adjustSpecialCount(int amount)
           
 LispValue apply(LispValue args)
          Apply a function to an argument list.
 void apropos_print(PrintWriter out)
          Prints information for the APROPOS function
 boolean basic_symbolp()
          Returns Java true if the object is a symbol.
 LispValue boundp()
          Returns T if the symbol has been assigned a value.
 LispValue documentation(LispValue type)
          Returns the documentation string for this symbol, of the type specified.
 boolean equals(LispSymbol otherSymbol)
           
 boolean externalP()
          Returns true if the symbol is external in its package.
 LispValue fboundp()
          Returns T if the symbol has an assigned function.
 LispValue funcall(LispValue args)
          Calls a functio non a list of arguments.
 int get_specialCount()
           
 String internal_getName()
          Returns the Java String representing the symbol's name, without any quoting.
 void internal_prin1(PrintStream os)
           
 void internal_princ(PrintStream os)
           
 void internal_print(PrintStream os)
           
 LispValue pop()
          Pops a list and returns the first element.
 LispValue push(LispValue newValue)
          Pushes an element onto a list and returns the list.
 void set_special(boolean value)
           
 void setExternal(boolean value)
          Sets whether the symbol is external in its package.
 LispValue setf_documentation(LispValue type, LispValue value)
          Sets the documentation string for this symbol of the type specified.
 LispValue setf_symbol_function(LispValue newCode)
          Sets the function of a symbol.
 LispValue setf_symbol_plist(LispValue newPlist)
          Sets the property list of a symbol.
 LispValue setf_symbol_value(LispValue newValue)
          Sets the value of a symbol.
 void setPackage(LispPackage newPackage)
           
 LispValue setq(LispValue newValue)
          Assigns a value to a symbol.
 boolean specialP()
           
 LispValue string()
          Converts a String, Symbol or Character to a string.
 LispValue symbol_function()
          Returns the function assigned to a symbol.
 LispValue symbol_name()
          Returns a string containing the name of a symbol.
 LispValue symbol_package()
          Returns the package of a symbol.
 LispValue symbol_plist()
          Returns the property list of a symbol.
 LispValue symbol_value()
          Returns the value of a symbol.
 LispValue symbolp()
          Returns T if the object is a symbol.
 Object toJava()
          Returns a Java String containing a printed representation of this symbol.
 String toString()
          Returns this symbol as a string, including the package.
 String toStringSimple()
          Strips or-bars from a LispSymbol name.
 LispValue type_of()
           
 LispValue typep(LispValue type)
           
 
Methods inherited from class org.jatha.dynatype.StandardLispAtom
atom, basic_atom
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, append, asin, assoc, atan, atan2, basic_bignump, basic_consp, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_numberp, basic_stringp, bignump, butlast, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fifth, first, floatp, floor, fourth, functionp, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_prin1_as_cdr, internal_princ_as_cdr, internal_print_as_cdr, iterator, keywordp, last, length, lessThan, lessThanOrEqual, lisp_null, list, listp, max, member, min, multiply, nconc, negate, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, position, prin1, princ, print, radiansToDegrees, rassoc, readFromString, reciprocal, remhash, remove, rest, reverse, rplaca, rplacd, sec, second, setf_gethash, setLisp, seventh, showStackTrace, sin, sixth, sqrt, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, tan, tenth, third, toCollection, toJava, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, uses, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jatha.dynatype.LispValue
abs, acos, add, append, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_consp, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_numberp, basic_stringp, bignump, butlast, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fifth, first, floatp, floor, fourth, functionp, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_prin1_as_cdr, internal_princ_as_cdr, internal_print_as_cdr, iterator, keywordp, last, length, lessThan, lessThanOrEqual, lisp_null, list, listp, max, member, min, multiply, nconc, negate, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, position, prin1, princ, print, radiansToDegrees, rassoc, readFromString, reciprocal, remhash, remove, rest, reverse, rplaca, rplacd, sec, second, setf_gethash, setLisp, seventh, sin, sixth, sqrt, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, tan, tenth, third, toCollection, toJava, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, uses, zerop
 

Field Detail

f_function

protected LispValue f_function

f_name

protected LispString f_name

f_value

protected LispValue f_value

f_plist

protected LispValue f_plist

f_package

protected LispPackage f_package

f_isExternalInPackage

protected boolean f_isExternalInPackage

f_isSpecial

protected boolean f_isSpecial

f_specialCount

protected int f_specialCount

f_mixedCase

protected boolean f_mixedCase

f_documentation

protected Map f_documentation
Constructor Detail

StandardLispSymbol

public StandardLispSymbol()

StandardLispSymbol

public StandardLispSymbol(Jatha lisp,
                          String symbolName)

StandardLispSymbol

public StandardLispSymbol(Jatha lisp,
                          LispString symbolNameString)
Method Detail

basic_symbolp

public boolean basic_symbolp()
Description copied from interface: LispValue
Returns Java true if the object is a symbol.

Specified by:
basic_symbolp in interface LispValue
Overrides:
basic_symbolp in class StandardLispValue

equals

public boolean equals(LispSymbol otherSymbol)

internal_getName

public String internal_getName()
Returns the Java String representing the symbol's name, without any quoting.

Specified by:
internal_getName in interface LispValue
Overrides:
internal_getName in class StandardLispValue

internal_prin1

public void internal_prin1(PrintStream os)
Specified by:
internal_prin1 in interface LispValue
Overrides:
internal_prin1 in class StandardLispValue

internal_princ

public void internal_princ(PrintStream os)
Specified by:
internal_princ in interface LispValue
Overrides:
internal_princ in class StandardLispValue

internal_print

public void internal_print(PrintStream os)
Specified by:
internal_print in interface LispValue
Overrides:
internal_print in class StandardLispValue

apropos_print

public void apropos_print(PrintWriter out)
Description copied from interface: LispValue
Prints information for the APROPOS function

Specified by:
apropos_print in interface LispValue
Overrides:
apropos_print in class StandardLispValue

toJava

public Object toJava()
Returns a Java String containing a printed representation of this symbol.

Specified by:
toJava in interface LispValue
Overrides:
toJava in class StandardLispValue

toString

public String toString()
Returns this symbol as a string, including the package.

Specified by:
toString in interface LispValue
Overrides:
toString in class StandardLispValue
Returns:
String The value in a string.

toStringSimple

public String toStringSimple()
Strips or-bars from a LispSymbol name. Leaves a colon on the front of keyword symbols.

Specified by:
toStringSimple in interface LispValue
Overrides:
toStringSimple in class StandardLispValue

set_special

public void set_special(boolean value)
Specified by:
set_special in interface LispValue
Overrides:
set_special in class StandardLispValue

specialP

public boolean specialP()
Specified by:
specialP in interface LispValue
Overrides:
specialP in class StandardLispValue

adjustSpecialCount

public void adjustSpecialCount(int amount)
Specified by:
adjustSpecialCount in interface LispValue
Overrides:
adjustSpecialCount in class StandardLispValue

get_specialCount

public int get_specialCount()
Specified by:
get_specialCount in interface LispValue
Overrides:
get_specialCount in class StandardLispValue

setPackage

public void setPackage(LispPackage newPackage)
Specified by:
setPackage in interface LispValue
Overrides:
setPackage in class StandardLispValue

setExternal

public void setExternal(boolean value)
Description copied from interface: LispSymbol
Sets whether the symbol is external in its package.

Specified by:
setExternal in interface LispSymbol

externalP

public boolean externalP()
Description copied from interface: LispSymbol
Returns true if the symbol is external in its package.

Specified by:
externalP in interface LispSymbol

apply

public LispValue apply(LispValue args)
Description copied from interface: LispValue
Apply a function to an argument list.

Specified by:
apply in interface LispValue
Overrides:
apply in class StandardLispValue

boundp

public LispValue boundp()
Description copied from interface: LispValue
Returns T if the symbol has been assigned a value.

Specified by:
boundp in interface LispValue
Overrides:
boundp in class StandardLispValue

fboundp

public LispValue fboundp()
Description copied from interface: LispValue
Returns T if the symbol has an assigned function.

Specified by:
fboundp in interface LispValue
Overrides:
fboundp in class StandardLispValue

funcall

public LispValue funcall(LispValue args)
Description copied from interface: LispValue
Calls a functio non a list of arguments.

Specified by:
funcall in interface LispValue
Overrides:
funcall in class StandardLispValue

pop

public LispValue pop()
Description copied from class: StandardLispValue
Pops a list and returns the first element. NOTE: Because Java's variable values aren't accessible to Jatha, the following doesn't work as expected:
   LispValue l1 = lisp.makeList(A, B);
   l1.pop();   // works correctly, l1 is now (B)
   l1.pop();   // doesn't work correctly.  l1 is now (NIL . NIL)
 
Jatha can't reassign l1 as expected.

However, the following does work:

   LispValue l1 = new LispSymbol(lisp, "L1");
   l1.setq(lisp.makeList(A, B));
   l1.pop();  // works correctly.  The value of L1 is now (B).
   l1.pop();  // works correctly.  The value of L1 is now NIL.
   l1.push(A); // works correctly.  The value of L1 is now (A).
   assert(l1.symbol_value().equal(lisp.makeList(A)) == lisp.T);
 

Specified by:
pop in interface LispValue
Overrides:
pop in class StandardLispValue
Returns:
the first element of the list

push

public LispValue push(LispValue newValue)
Description copied from class: StandardLispValue
Pushes an element onto a list and returns the list. NOTE: Because Java's variable values aren't accessible to Jatha, the following doesn't work as expected:
   LispValue l1 = LispValue.NIL;
   l1.push(A); // doesn't work correctly.  l1 is still NIL.
   l1 = l1.push(A);  // works correctly.
 
Jatha can't reassign l1 as expected.

However, the following does work:

   LispValue l1 = new LispSymbol("L1");
   l1.setq(LispValue.NIL);
   l1.push(B); // works correctly.  The value of L1 is now (B).
   l1.push(A); // works correctly.  The value of L1 is now (A B).
   assert(l1.symbol_value().equal(LispValueFactory.makeList(A, B)) == LispValue.T);
 

Specified by:
push in interface LispValue
Overrides:
push in class StandardLispValue
Returns:
the new list.

setf_symbol_function

public LispValue setf_symbol_function(LispValue newCode)
Description copied from interface: LispValue
Sets the function of a symbol.

Specified by:
setf_symbol_function in interface LispValue
Overrides:
setf_symbol_function in class StandardLispValue

setf_symbol_plist

public LispValue setf_symbol_plist(LispValue newPlist)
Description copied from interface: LispValue
Sets the property list of a symbol.

Specified by:
setf_symbol_plist in interface LispValue
Overrides:
setf_symbol_plist in class StandardLispValue

setf_symbol_value

public LispValue setf_symbol_value(LispValue newValue)
Description copied from interface: LispValue
Sets the value of a symbol.

Specified by:
setf_symbol_value in interface LispValue
Overrides:
setf_symbol_value in class StandardLispValue

setq

public LispValue setq(LispValue newValue)
Description copied from interface: LispValue
Assigns a value to a symbol.

Specified by:
setq in interface LispValue
Overrides:
setq in class StandardLispValue

string

public LispValue string()
Converts a String, Symbol or Character to a string.

Specified by:
string in interface LispValue
Overrides:
string in class StandardLispValue

symbolp

public LispValue symbolp()
Description copied from interface: LispValue
Returns T if the object is a symbol.

Specified by:
symbolp in interface LispValue
Overrides:
symbolp in class StandardLispValue

symbol_function

public LispValue symbol_function()
                          throws LispException
Description copied from interface: LispValue
Returns the function assigned to a symbol.

Specified by:
symbol_function in interface LispValue
Overrides:
symbol_function in class StandardLispValue
Throws:
LispException

symbol_name

public LispValue symbol_name()
Description copied from interface: LispValue
Returns a string containing the name of a symbol.

Specified by:
symbol_name in interface LispValue
Overrides:
symbol_name in class StandardLispValue

symbol_package

public LispValue symbol_package()
Description copied from interface: LispValue
Returns the package of a symbol.

Specified by:
symbol_package in interface LispValue
Overrides:
symbol_package in class StandardLispValue

symbol_plist

public LispValue symbol_plist()
Description copied from interface: LispValue
Returns the property list of a symbol.

Specified by:
symbol_plist in interface LispValue
Overrides:
symbol_plist in class StandardLispValue

symbol_value

public LispValue symbol_value()
                       throws LispException
Description copied from interface: LispValue
Returns the value of a symbol.

Specified by:
symbol_value in interface LispValue
Overrides:
symbol_value in class StandardLispValue
Throws:
LispException

type_of

public LispValue type_of()
Specified by:
type_of in interface LispValue
Overrides:
type_of in class StandardLispValue

typep

public LispValue typep(LispValue type)
Specified by:
typep in interface LispValue
Overrides:
typep in class StandardLispAtom

documentation

public LispValue documentation(LispValue type)
Description copied from interface: LispValue
Returns the documentation string for this symbol, of the type specified. The type may be any symbol, but the most common ones are:

Specified by:
documentation in interface LispValue
Overrides:
documentation in class StandardLispValue
Parameters:
type - a symbol
Returns:
a LispString or NIL

setf_documentation

public LispValue setf_documentation(LispValue type,
                                    LispValue value)
Description copied from interface: LispValue
Sets the documentation string for this symbol of the type specified. The type may be any symbol, but the most common ones are:

Specified by:
setf_documentation in interface LispValue
Overrides:
setf_documentation in class StandardLispValue
Parameters:
type - a symbol
value - a lispstring
Returns:
value

Jatha Software