edu.isi.stella
Class StellaHashTable

java.lang.Object
  extended by edu.isi.stella.Stella_Object
      extended by edu.isi.stella.StandardObject
          extended by edu.isi.stella.AbstractCollection
              extended by edu.isi.stella.AbstractDictionary
                  extended by edu.isi.stella.AbstractHashTable
                      extended by edu.isi.stella.StellaHashTable

public class StellaHashTable
extends AbstractHashTable


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 edu.isi.stella.StandardObject
arrayTypeSpecifierP, baseTypeToTypeSpec, cantOverwriteActiveCollectionSlot, compatibleParameterTypesP, computeAnchoredTypeSpec, computeRelativeTypeSpec, conformingTypeSpecP, copyWrappedLiteral, cppNonPointerTypeP, cppReferenceTypeP, cppReferencizeType, cppTranslateAndPointerizeTypeSpec, cppTranslateAndReferencizeTypeSpec, cppTranslateTypeSpec, cppTypeWithoutInteriorPointersP, dropSlotValue, extractParameterType, extractRequiredArgumentValues, getSlot, hashCode_, idlTranslateTypeSpec, inverseSlotDemon, javaLiteralP, javaNativeLiteralWrapperNames, javaSpecialSetterName, javaTranslateArrayOfTypeSpec, javaTranslateTypeSpec, javaTranslateTypeSpecForFunction, javaTranslateTypeSpecHelper, javaYieldClassObjectArrayExpression, javaYieldClassObjectExpression, javaYieldFullyQualifiedTypeName, javaYieldTranslatedClassAndMethodNames, listifyTypeSpec, lookupClTypeFromStellaType, objectEqlP, putSlotValue, readSlotValue, runConstructorDemons, runDestructorDemons, runSlotDemons, runSlotGuardDemonsP, standardObjectP, subTypeSpecOfP, twoArgumentLeastCommonSupertype, typeSpecToBaseType, typeSpecToClass, typeToWalkedNullValueTree, validateTypeSpecifier, voidP, walkTypeSpecIsNativeTypeP, writeSlotValue, yieldTypeSpecTree
 
Methods inherited from class edu.isi.stella.Stella_Object
_, accessInContext, addPropertyValue, amPm, anchoredTypeSpecifierP, andOrNotTreeP, applyCoercionMethod, atomicExpressionP, bindToSurrogateP, booleanP, bootstrapIsaP, bquotify, cast, characterP, chooseSortPredicate, clConditionalizeTypeDeclarationTree, clTranslateAtomicTree, clTranslateATree, clTranslateBooleanTest, clTranslatePlainBooleanTest, clTranslateVerbatimBodySymbols, clYieldTypedExpressionTree, coerceATree, coerceEvaluatedTree, coerceMvTree, coerceOptionValue, coerceToBoolean, coerceToFloat, coerceToHashSet, coerceToModule, coerceToModuleName, coerceToString, coerceToSymbol, coerceToXmlElement, coerceValueToBoolean, coerceValueToFloat, coerceValueToString, coerceValueToType, coercibleP, collectFeatureList, collectKeyValueList, commonLispSymbolP, computeExpressionType, consifyListsAndIterators, consP, consTreeMatchP, convertToLiteral, copyConsTree, cppArgumentIsStreamP, cppBinaryOperatorP, cppBlockP, cppMaybeOutputStatementWithParentheses, cppOperatorP, cppOutputAtomicExpression, cppOutputLiteral, cppOutputOneActualParameter, cppOutputStatement, cppOutputTypedEntity, cppPrognifyStatement, cppPrognP, cppStatementToList, cppStreamIsStandardOutputP, cpptrans, cppTranslateAtomicTree, cppTranslateATree, cppTranslatedArrayTypeP, csValueP, dateDivider, dateTimeDivider, day, dealWithAmPm, dealWithEra, dealWithNoonMidn, decrementReferenceCount, defaultOptionHandler, defineSystem, defmodule, deletedP, describe, describeObject, describeTersely, destructureMethodNameTree, deUglifyParseTree, either, eqlP, eqlToBooleanP, eqlToCharacterP, eqlToFloatP, eqlToIntegerP, eqlToLongIntegerP, eqlToStringP, equalConsTreesP, equalP, era, estimatedEvaluationCost, evaluate, evaluateArgumentTree, evaluateAtomicTree, evaluateCommand, expandBquoteTree, filterModuleP, floatP, free, get, getObject, getProperty, hashlist, hashMemoizedArguments, helpBquotify, helpClTranslateATree, helpCoerceATree, helpLptrans, helpPrintOutline, helpTransformBooleanProceduralExpression, helpWalkATree, homeModule, hour, idlOutputAtomicExpression, idlOutputLiteral, idlOutputStatement, idlTranslateAtomicTree, idlTranslateATree, illegalTreeP, implodePathname, incrementallyTranslate, incrementReferenceCount, inlineUnwrapBoolean, inlineWrapBoolean, inModule, integerP, isaP, javaBinaryOperatorP, javaBlockP, javaEndOfLineTokenP, javaHelpOutputPrintStream, javaMaybeOutputStatementWithParentheses, javaOperatorP, javaOutputLiteral, javaOutputStatement, javaPrognP, javaStreamIsStandardOutputP, javaSymbolCaseP, javaTranslateAtomicTree, javaTranslateATree, javaTranslateWithNativeWrapper, jptrans, keywordP, legalTokenizerFromStateP, legalTokenizerStateP, legalTokenizerToStateP, literalEqlP, logLevelLE, longIntegerP, lptrans, makeEvaluatableBquoteTree, makeFileNameFromRelativePath, makeMemoizedValueEntry, makeMemoizedValueEntryn, matchConsTree, methodSlotP, minute, month, nameToString, nilP, noonMidn, numberWrapperToFloat, objectHashCode, one, oneI, onlyIf, parametricTypeSpecifierP, parseArrayDimensionsSpec, parseOptions, parseTokenizerCharacterSpec, parseTokenizerStateModifiers, permanentCopy, permanentify, permanentifyForm, po, prettyPrintLiteral, primaryClass, printObject, printOutline, printStellaCode, printStellaDefinition, printUndefinedSuperClasses, proceduralExpressionP, ptrans, publicSlots, registerRecycledItem, runOptionHandlerP, safeEqualHashCode, safeHashCode, safePrimaryType, safeYieldTypeSpecifier, searchConsTreeP, searchConsTreeWithFilterP, searchForObject, secondp, setProperty, sideEffectFreeExpressionP, simplifyBquoteTree, specialp, stella_Increment, stellaClassP, stellaCollectionP, stellaNeedToCompileP, stellaNeedToTranslateP, stellaObjectP, stellify, storageSlotP, stringifyInModule, stringP, substituteConsTree, substituteOnce, surrogateP, surrogatify, sweep, symbolCaseP, symbolP, sysTree, targetLanguageType, taxonomyIsaP, timeDivider, timeMultiply, tokenizerIncludeSpecP, tokenizerToStateAlias, tokenizerToStateName, toString, traceIf, traceKeywordP, transientifyForm, transientObjectP, transientSymbolP, translateWalkedTree, treeSize, treeToTrees, trueOptionP, tryToEvaluate, typeP, typify, unmake, unregisterRecycledItem, updateInContext, valuesTreeP, variableExpressionP, verbatimStringP, verbatimTreeP, vetOptions, vrletExpressionP, walkAtomicTree, walkATree, walkCollectionTree, walkDontCallMeTree, walkedExpressionExpression, walkedExpressionType, walkExpressionTree, walkMvExpressionTree, walkMvTree, walkStatement, walkTopLevelExpression, walkWithoutTypeTree, warnAboutUnknownSourceType, weekday, withinContext, withinModule, withinWorld, withStellaTokenizer, withSystemDefinition, withTokenizer, wrapperP, wrapWhereTest, xmlAttributeP, xmlBaseAttributeP, xmlCdataFormP, xmlCdataP, xmlDeclarationFormP, xmlDeclarationP, xmlDoctypeFormP, xmlElementFormP, xmlElementP, xmlGlobalAttributeP, xmlLocalAttributeP, xmlnsAttributeP, xmlProcessingInstructionFormP, xmlProcessingInstructionP, xmlTagCase, year, yieldCondTest, yieldCondTestOrTests, yieldHardcodedCaseSymbolIdOrIds, yieldInCursorClausesForArgumentList, yieldInCursorClausesForGeneralCollection, yieldInCursorClausesForVector, yieldTypeSpecifier, zone, zoneMinute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theTable

public KvCons[] theTable

size

public int size

initialSize

public int initialSize
If supplied, the initial hash table will be sized to hold at least that many elements.


freeElements

public int freeElements

equalTestP

public boolean equalTestP
If true use equalP as the equality test and equalHashCode as the hash function, otherwise, use eqlP and hashCode (the default).

Constructor Detail

StellaHashTable

public StellaHashTable()
Method Detail

newStellaHashTable

public static StellaHashTable newStellaHashTable()

allocateIterator

public AbstractIterator allocateIterator()
Allocate an iterator for self.

Overrides:
allocateIterator in class AbstractDictionary
Returns:
AbstractIterator

equalHashCode

public int equalHashCode()
Return an equalP hash code for self. Note that this is O(N) in the number of entries of self.

Overrides:
equalHashCode in class Stella_Object
Returns:
int

objectEqualP

public boolean objectEqualP(Stella_Object y)
Return TRUE if x and y represent the same set of key/value pairs.

Overrides:
objectEqualP in class Stella_Object
Parameters:
y -
Returns:
boolean

consify

public Cons consify()
Collect all entries of self into a cons list of _LkeyGLvalueG_ pairs and return the result.

Overrides:
consify in class Stella_Object
Returns:
Cons

clear

public void clear()
Remove all entries from self. This will result in a re-initialization of the table upon the first insertion into self.


copy

public StellaHashTable copy()
Return a copy of the hash table 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.).

Returns:
StellaHashTable

nonEmptyP

public boolean nonEmptyP()
Return TRUE if self has at least 1 entry.

Returns:
boolean

emptyP

public boolean emptyP()
Return TRUE if self has zero entries.

Returns:
boolean

length

public int length()
Return the number of entries in self.

Overrides:
length in class AbstractCollection
Returns:
int

removeAt

public void removeAt(Stella_Object key)
Remove the entry identified by key from self. Uses an eqlP test by default or equalP if equalTestP of self is TRUE.

Parameters:
key -

insertAt

public 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. Uses an eqlP test by default or equalP if equalTestP of self is TRUE.

Parameters:
key -
value -

lookup

public 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. Uses an eqlP test by default or equalP if equalTestP of self is TRUE.

Parameters:
key -
Returns:
Stella_Object

stellaStringHashTableLookup

public static Stella_Object stellaStringHashTableLookup(StellaHashTable self,
                                                        java.lang.String key)

stellaHashTableLookup

public static Stella_Object stellaHashTableLookup(StellaHashTable self,
                                                  Stella_Object key)

stellaHashTableRemoveAt

public static void stellaHashTableRemoveAt(StellaHashTable self,
                                           Stella_Object key)

stellaHashTableInsertAt

public static void stellaHashTableInsertAt(StellaHashTable self,
                                           Stella_Object key,
                                           Stella_Object value)

rehashStellaHashTable

public static void rehashStellaHashTable(StellaHashTable self,
                                         int newsize)

initializeHashTable

public void initializeHashTable()
Initialize the STELLA hash table 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.

Overrides:
initializeHashTable in class AbstractHashTable

initializeStellaHashTable

public static void initializeStellaHashTable(StellaHashTable self)

accessStellaHashTableSlotValue

public static Stella_Object accessStellaHashTableSlotValue(StellaHashTable self,
                                                           Symbol slotname,
                                                           Stella_Object value,
                                                           boolean setvalueP)

primaryType

public Surrogate primaryType()
Description copied from class: Stella_Object
Returns the primary type of self. Gets defined automatically for every non-abstract subclass of OBJECT.

Overrides:
primaryType in class Stella_Object
Returns:
Surrogate