Jatha Software

org.jatha.dynatype
Class StandardLispHashTable

java.lang.Object
  extended by org.jatha.dynatype.StandardLispValue
      extended by org.jatha.dynatype.StandardLispHashTable
All Implemented Interfaces:
Comparable, LispHashTable, LispValue

public class StandardLispHashTable
extends StandardLispValue
implements LispHashTable

Implements the Common LISP 'hashtable' type, including all four types: eq, eql, equal, and equalp has tables. The functions gethash, remhash, and setf-gethash are used to perform operatios on hash tables.

See Also:
LispValue

Field Summary
(package private)  LispReal DEFAULT_REHASH_SIZE
          Default rehash size is 1.2.
(package private)  LispReal DEFAULT_REHASH_THRESHOLD
          Default rehash threshold is 640777/999999.
(package private)  LispInteger DEFAULT_SIZE
          Default size is 103.
(package private)  LispValue DEFAULT_TYPE
          Default to an EQL hash table.
(package private)  LispValue EQ
          Use this value to create an EQ hash table.
(package private)  LispValue EQL
          Use this value to create an EQL hash table.
(package private)  LispValue EQUAL
          Use this value to create an EQUAL hash table.
(package private)  LispValue EQUALP
          Use this value to create an EQUALP hash table.
protected  LispValue rehashSize
           
protected  LispValue rehashThreshold
           
protected  LispValue size
           
protected  HashMap theHashTable
          The actual hash table.
protected  LispValue type
           
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
StandardLispHashTable()
           
StandardLispHashTable(Jatha lisp)
          Creates an eql hash table with default sizes and rehash thresholds.
StandardLispHashTable(Jatha lisp, LispValue typeArg, LispValue sizeArg, LispValue rehashSizeArg, LispValue rehashThresholdArg)
          Send in the test type, size, rehash-size, and rehash-threshold or NIL for any of the parameters.
StandardLispHashTable(StandardLispHashTable input)
           
 
Method Summary
 void assign(StandardLispHashTable value)
           
 boolean basic_atom()
          Returns Java true if the object is an atom.
 LispValue clrhash()
          Clears a hash table.
 LispValue gethash(LispValue key)
          Retrieves values from a hash table.
 LispValue gethash(LispValue key, LispValue defawlt)
          Retrieves values from a hash table, returning a default value if the key is not in the table.
 LispValue hash_table_count()
          Returns the number of items in the hash table.
 LispValue hash_table_rehash_size()
          This should return the rehash-threshold, but Java 1.1 doesn't let us access that number.
 LispValue hash_table_rehash_threshold()
          Java 1.1 doesn't let us access this number.
 LispValue hash_table_size()
          This should return the number of possible entries until the table is full, but Java 1.1 doesn't give us access to that number.
 LispValue hash_table_test()
          Returns the function used when comparing keys in the hash table.
 LispValue hashtablep()
          Returns T if the object is a floating-point number.
 void initializeConstants()
           
 void internal_prin1(PrintStream os)
           
 void internal_princ(PrintStream os)
           
 void internal_print(PrintStream os)
           
 LispValue remhash(LispValue key)
          Removes an element from a hash table.
 LispValue setf_gethash(LispValue key, LispValue value)
          Sets a value in a hash table.
 Collection toCollection()
          Returns the Hash Table as a Collection.
 Object toJava()
          Returns a Java HashMap containing the contents of this HashTable.
 LispValue type_of()
           
 LispValue typep(LispValue type)
           
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, 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, basic_symbolp, bignump, boundp, butlast, car, cdr, ceiling, characterp, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, documentation, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, getLisp, greaterThan, greaterThanOrEqual, integerp, internal_getName, 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, pop, position, prin1, princ, print, push, radiansToDegrees, rassoc, readFromString, reciprocal, remove, rest, reverse, rplaca, rplacd, sec, second, set_special, setf_documentation, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, showStackTrace, sin, sixth, specialP, sqrt, string, 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, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, 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, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, 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, basic_symbolp, bignump, boundp, butlast, car, cdr, ceiling, characterp, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, documentation, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, getLisp, greaterThan, greaterThanOrEqual, integerp, internal_getName, 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, pop, position, prin1, princ, print, push, radiansToDegrees, rassoc, readFromString, reciprocal, remove, rest, reverse, rplaca, rplacd, sec, second, set_special, setf_documentation, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sin, sixth, specialP, sqrt, string, 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, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toJava, toString, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, uses, zerop
 

Field Detail

EQ

LispValue EQ
Use this value to create an EQ hash table.


EQL

LispValue EQL
Use this value to create an EQL hash table.


EQUAL

LispValue EQUAL
Use this value to create an EQUAL hash table.


EQUALP

LispValue EQUALP
Use this value to create an EQUALP hash table.


DEFAULT_TYPE

LispValue DEFAULT_TYPE
Default to an EQL hash table. From Allegro CL 4.3.


DEFAULT_SIZE

LispInteger DEFAULT_SIZE
Default size is 103. From Allegro CL 4.3.


DEFAULT_REHASH_SIZE

LispReal DEFAULT_REHASH_SIZE
Default rehash size is 1.2. From Allegro CL 4.3.


DEFAULT_REHASH_THRESHOLD

LispReal DEFAULT_REHASH_THRESHOLD
Default rehash threshold is 640777/999999. From Allegro CL 4.3.


type

protected LispValue type

size

protected LispValue size

rehashSize

protected LispValue rehashSize

rehashThreshold

protected LispValue rehashThreshold

theHashTable

protected HashMap theHashTable
The actual hash table.

See Also:
HashMap
Constructor Detail

StandardLispHashTable

public StandardLispHashTable()

StandardLispHashTable

public StandardLispHashTable(Jatha lisp)
Creates an eql hash table with default sizes and rehash thresholds. The defaults are from Allegro Common Lisp 4.3


StandardLispHashTable

public StandardLispHashTable(StandardLispHashTable input)

StandardLispHashTable

public StandardLispHashTable(Jatha lisp,
                             LispValue typeArg,
                             LispValue sizeArg,
                             LispValue rehashSizeArg,
                             LispValue rehashThresholdArg)
Send in the test type, size, rehash-size, and rehash-threshold or NIL for any of the parameters.

Method Detail

initializeConstants

public void initializeConstants()

basic_atom

public boolean basic_atom()
Description copied from interface: LispValue
Returns Java true if the object is an atom.

Specified by:
basic_atom in interface LispValue
Overrides:
basic_atom 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_prin1

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

internal_print

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

toJava

public Object toJava()
Returns a Java HashMap containing the contents of this HashTable.

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

assign

public void assign(StandardLispHashTable value)

toCollection

public Collection toCollection()
Returns the Hash Table as a Collection. Creates (key . val) cons pairs and stores them in the collection. Returns an ArrayList.

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

clrhash

public LispValue clrhash()
Description copied from interface: LispValue
Clears a hash table.

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

gethash

public LispValue gethash(LispValue key)
Description copied from interface: LispValue
Retrieves values from a hash table.

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

gethash

public LispValue gethash(LispValue key,
                         LispValue defawlt)
Description copied from interface: LispValue
Retrieves values from a hash table, returning a default value if the key is not in the table.

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

remhash

public LispValue remhash(LispValue key)
Description copied from interface: LispValue
Removes an element from a hash table.

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

setf_gethash

public LispValue setf_gethash(LispValue key,
                              LispValue value)
Description copied from interface: LispValue
Sets a value in a hash table.

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

hashtablep

public LispValue hashtablep()
Description copied from interface: LispValue
Returns T if the object is a floating-point number.

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

hash_table_count

public LispValue hash_table_count()
Description copied from interface: LispValue
Returns the number of items in the hash table.

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

hash_table_size

public LispValue hash_table_size()
This should return the number of possible entries until the table is full, but Java 1.1 doesn't give us access to that number.

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

hash_table_rehash_size

public LispValue hash_table_rehash_size()
This should return the rehash-threshold, but Java 1.1 doesn't let us access that number.

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

hash_table_rehash_threshold

public LispValue hash_table_rehash_threshold()
Java 1.1 doesn't let us access this number.

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

hash_table_test

public LispValue hash_table_test()
Description copied from interface: LispValue
Returns the function used when comparing keys in the hash table. Default is EQL.

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

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 StandardLispValue

Jatha Software