|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.isi.stella.Stella_Object edu.isi.stella.StandardObject edu.isi.stella.AbstractCollection edu.isi.stella.AbstractDictionary edu.isi.stella.AbstractHashTable edu.isi.stella.StellaHashTable
public class StellaHashTable
Field Summary | |
---|---|
boolean |
equalTestP
If true use equalP as the
equality test and equalHashCode as the hash function, otherwise,
use eqlP and hashCode (the default). |
int |
freeElements
|
int |
initialSize
If supplied, the initial hash table will be sized to hold at least that many elements. |
int |
size
|
KvCons[] |
theTable
|
Fields inherited from class edu.isi.stella.AbstractHashTable |
---|
theHashTable, theStellaHashTable |
Constructor Summary | |
---|---|
StellaHashTable()
|
Method Summary | |
---|---|
static Stella_Object |
accessStellaHashTableSlotValue(StellaHashTable self,
Symbol slotname,
Stella_Object value,
boolean setvalueP)
|
AbstractIterator |
allocateIterator()
Allocate an iterator for self . |
void |
clear()
Remove all entries from self . |
Cons |
consify()
Collect all entries of self into a cons list of
_LkeyGLvalueG_ pairs and return the result. |
StellaHashTable |
copy()
Return a copy of the hash table self . |
boolean |
emptyP()
Return TRUE if self has zero entries. |
int |
equalHashCode()
Return an equalP hash code for self . |
void |
initializeHashTable()
Initialize the STELLA hash table self . |
static void |
initializeStellaHashTable(StellaHashTable self)
|
void |
insertAt(Stella_Object key,
Stella_Object value)
Set the value of the entry identified by key in self
to value or add a new entry if no entry with key exists yet. |
int |
length()
Return the number of entries in self . |
Stella_Object |
lookup(Stella_Object key)
Lookup the entry identified by key in self and
return its value, or NULL if no such entry exists. |
static StellaHashTable |
newStellaHashTable()
|
boolean |
nonEmptyP()
Return TRUE if self has at least 1 entry. |
boolean |
objectEqualP(Stella_Object y)
Return TRUE if x and y represent the same set of key/value pairs. |
Surrogate |
primaryType()
Returns the primary type of self . |
static void |
rehashStellaHashTable(StellaHashTable self,
int newsize)
|
void |
removeAt(Stella_Object key)
Remove the entry identified by key from self . |
static void |
stellaHashTableInsertAt(StellaHashTable self,
Stella_Object key,
Stella_Object value)
|
static Stella_Object |
stellaHashTableLookup(StellaHashTable self,
Stella_Object key)
|
static void |
stellaHashTableRemoveAt(StellaHashTable self,
Stella_Object key)
|
static Stella_Object |
stellaStringHashTableLookup(StellaHashTable self,
java.lang.String key)
|
Methods inherited from class edu.isi.stella.AbstractHashTable |
---|
accessAbstractHashTableSlotValue, freeHashTableValues |
Methods inherited from class edu.isi.stella.AbstractDictionary |
---|
dictionary |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public KvCons[] theTable
public int size
public int initialSize
public int freeElements
public boolean equalTestP
equalP
as the
equality test and equalHashCode
as the hash function, otherwise,
use eqlP
and hashCode
(the default).
Constructor Detail |
---|
public StellaHashTable()
Method Detail |
---|
public static StellaHashTable newStellaHashTable()
public AbstractIterator allocateIterator()
self
.
allocateIterator
in class AbstractDictionary
public int equalHashCode()
equalP
hash code for self
. Note that this
is O(N) in the number of entries of self
.
equalHashCode
in class Stella_Object
public boolean objectEqualP(Stella_Object y)
x
and y
represent the same set of key/value pairs.
objectEqualP
in class Stella_Object
y
-
public Cons consify()
self
into a cons list of
_LkeyGLvalueG_
pairs and return the result.
consify
in class Stella_Object
public void clear()
self
. This will result in a
re-initialization of the table upon the first insertion into self
.
public StellaHashTable copy()
self
. The bucket table
and buckets are freshly allocated, however, the keys and values of entries
are not copied themselves (similar to what we do for lists, etc.).
public boolean nonEmptyP()
self
has at least 1 entry.
public boolean emptyP()
self
has zero entries.
public int length()
self
.
length
in class AbstractCollection
public void removeAt(Stella_Object key)
key
from self
. Uses an
eqlP
test by default or equalP
if equalTestP
of self
is TRUE.
key
- public void insertAt(Stella_Object key, Stella_Object value)
key
in self
to value
or add a new entry if no entry with key
exists yet. Uses an
eqlP
test by default or equalP
if equalTestP
of self
is TRUE.
key
- value
- public Stella_Object lookup(Stella_Object key)
key
in self
and
return its value, or NULL if no such entry exists. Uses an eqlP
test by default or equalP
if equalTestP
of self
is TRUE.
key
-
public static Stella_Object stellaStringHashTableLookup(StellaHashTable self, java.lang.String key)
public static Stella_Object stellaHashTableLookup(StellaHashTable self, Stella_Object key)
public static void stellaHashTableRemoveAt(StellaHashTable self, Stella_Object key)
public static void stellaHashTableInsertAt(StellaHashTable self, Stella_Object key, Stella_Object value)
public static void rehashStellaHashTable(StellaHashTable self, int newsize)
public void initializeHashTable()
self
. This is a
no-op and primarily exists to shadow the standard initializer inherited
from ABSTRACT-HASH-TABLE. STELLA hash tables are initialized at the
first insertion operation.
initializeHashTable
in class AbstractHashTable
public static void initializeStellaHashTable(StellaHashTable self)
public static Stella_Object accessStellaHashTableSlotValue(StellaHashTable self, Symbol slotname, Stella_Object value, boolean setvalueP)
public Surrogate primaryType()
Stella_Object
self
.
Gets defined automatically for every non-abstract subclass of OBJECT.
primaryType
in class Stella_Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |