org.abora.gold.collection.tables
Class ActualHashTable

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.collection.tables.ScruTable
                    |
                    +--org.abora.gold.collection.tables.MuTable
                          |
                          +--org.abora.gold.collection.tables.HashTable
                                |
                                +--org.abora.gold.collection.tables.ActualHashTable

public class ActualHashTable
extends HashTable

The HashTable is an implementation class that is intended to provide the weakest
Position->Object mapping. It can map from arbitrary Position classes (such as
HeaperAsPosition or TreePosition). HashTable can also be used for very sparse integer
domains.
HashTable, and the entire hashtab module, is private implementation. Not to be included
by clients.


Field Summary
protected  CoordinateSpace myCoordinateSpace
           
protected  SharedPtrArray myHashEntries
           
protected  int myTally
           
 
Fields inherited from class org.abora.gold.collection.tables.MuTable
AlreadyInTableSignal, NotInDomainSignal, NullInsertionSignal
 
Fields inherited from class org.abora.gold.collection.tables.ScruTable
NotInTableSignal, WrongCoordSpaceSignal
 
Fields inherited from class org.abora.gold.xpp.basic.Heaper
AllBlasts, BecomeMap, GarbageCount, InGC, InitializedClasses, InitializingClasses, LastMemory, NextClientRequestNumber, NotOneElementSignal, PackageTable, PromiseNameTable, StringHashSBoxes
 
Fields inherited from class org.abora.gold.java.AboraHeaper
ActiveClubs, CurrentAuthor, CurrentBertCanopyCache, CurrentBertCrum, CurrentChunk, CurrentGrandMap, CurrentKeyMaster, CurrentPacker, CurrentSensorCanopyCache, CurrentServer, CurrentSession, CurrentSessions, CurrentTrace, InitialEditClub, InitialOwner, InitialReadClub, InitialSponsor, InsideTransactionFlag
 
Constructor Summary
ActualHashTable(Rcvr receiver)
           
ActualHashTable(SharedPtrArray entries, int tally, CoordinateSpace cs)
           
 
Method Summary
 void aboutToWrite()
          If my contents are shared, and I'm about to change them, make a copy of them.
 Heaper atIntStore(IntegerVar key, Heaper aHeaper)
          Unboxed version.
 Heaper atStore(Position key, Heaper aHeaper)
          Associate value with key, whether or not
there is a previous association.
 void checkSize()
           
 CoordinateSpace coordinateSpace()
          The kind of elements used to index into the table are Positions of this
coordinate space.
 ScruTable copy()
          A new one whose initial state is my current state, but that doesn't track
changes.
 IntegerVar count()
          Return the number of domain elements, which is to say, the number of associations.
'table->count()' should be equivalent to 'table->domain()->count()'.
Used to say: 'Return the number of range elements'.
 void destruct()
          Classes should implement this message rather than a destructor.
 XnRegion domain()
          Return an XuRegion representing a snapshot of the current domain.
'table->domain()->hasMember(p)' iff 'table->fetch(p) !!= NULL'.
 ScruTable emptySize(IntegerVar size)
          Return an empty table just like the current one.
 int fastHash()
           
 Heaper fetch(Position key)
          Return the range element at the domain position key.
 boolean includesKey(Position aKey)
          includesKey is used to test for the presence of a key->value pair in the
table.
 void inspect()
           
 Heaper intFetch(IntegerVar key)
          Unboxed version.
 boolean isEmpty()
          Is there anything in the table?
'table->isEmpty()' iff 'table->domain()->isEmpty()'.
static Heaper make(CoordinateSpace cs)
          A new empty MuTable whose domain space is 'cs'.
static Heaper make(CoordinateSpace cs, IntegerVar size)
           
 void printOn(java.io.PrintWriter oo)
           
 void receiveHashTable(Rcvr rcvr)
          This currently doesn't take advantage of the optimizations in TableEntries.
 XnRegion runAt(Position index)
          Return the length of the run starting at position key.
 void sendHashTable(Xmtr xmtr)
          This currently doesn't take advantage of the optimizations in TableEntries.
 void sendSelfTo(Xmtr xmtr)
          do nothing
 TableStepper stepper(OrderSpec order)
          ignore order spec for now
 void storeEntry(TableEntry anEntry)
          Store the tableentry into the entry table
 ScruTable subTable(XnRegion region)
          Return a table which contains only the intersection of this table's domain and
the domain specified by 'region'.
table->subTable(r)->domain()->isEqual( table->domain()->intersect(r) ).
It is unspecified whether the resulting table starts as a snapshot of a subset of
me, after which we go our own ways; or whether the resulting table is a view
onto a subset of me, such that changes to me are also visible to him.
 Heaper theOne()
          Iff I contain exactly one range element, return it.
 boolean wipe(Position aKey)
          Remove a key->value association from the table.
Do not blast (or do anything else) if the key is not in my current domain.
 
Methods inherited from class org.abora.gold.collection.tables.HashTable
initTimeNonInherited
 
Methods inherited from class org.abora.gold.collection.tables.MuTable
actualHashForEqual, asImmuTable, asMuTable, atIntIntroduce, atIntReplace, atIntroduce, atReplace, includesIntKey, intRemove, introduceAll, introduceAll, introduceAll, intWipe, isEqual, make, problems, remove, removeAll, replaceAll, replaceAll, replaceAll, runAtInt, storeAll, storeAll, storeAll, test, wipeAll
 
Methods inherited from class org.abora.gold.collection.tables.ScruTable
asOrderedCollection, backfollowFrom, contentsEqual, contentsHash, dox, get, intGet, isEqual, printOnWithSimpleSyntax, printOnWithSyntax, range, stepper, transformedBy
 
Methods inherited from class org.abora.gold.xpp.basic.Heaper
abstractDeclarationFor, abstractTypeFor, addMethodAttributeToInOf, addPackage, addPackageCategory, allClientProtocolOn, argumentTypesFor, arrow, blast, blast, BLAST, cachePromiseNameTable, cachePromiseNameTableIn, canYouBecome, cast, cleanPromiseClasses, cleanupGarbage, clientClassesDo, clientFunctionsOn, clientMethodsOn, clientProtocol, clientProtocolDo, clientProtocolOn, clientProtocolOn, collectibleClasses, compare, compileClientSubclasses, compileConstantPromiseMethods, compileCreateFromRcvr, compileEQ, compileGeneratedClassMethod, compileGeneratedMethod, compileHook, compilePromise, compilePromiseDefaultMethods, compilePromiseFluidDeclarations, compilePromiseHandlers, compilePromiseMethods, compileRequestCreateMsgInArguments, compileRequestEvaluateMsgInReturningArguments, compileRPCSpecialistEvaluateMsgForReturningArguments, compileSendSelfTo, compileSendSelfToSendHook, compileStubbleMethods, compileSubclassStubbleMethods, computeMangle, computePreorder, constantTypeValue, convert, convertCopyDeclarations, convertDeferredDeclarations, convertProxyDeclarations, convertSubclassCopyDeclarations, convertSubclassDeferredDeclarations, convertSubclassProxyDeclarations, copyReferencesToType, create, create, create, create, create, create, create, create, create, create, createRequestClassArguments, definesProxyMethods, delete, deref, destroy, destructor, enum, enumFlags, equals, exportName, fetchAttribute, fetchPackage, fetchSuperCategory, fileOutClientProtocol, findCategory, findSenderAndReceiverMethods, findTailInto, flushPromiseNameTable, foo, freezeClientClasses, freezeClientProtocol, freezeStProtocol, frozenClasses, garbageCollect, garbageCollectFrom, gcOpportunity, gcOpportunity, generatedCategory, generatePromiseNames, getCategory, getOrMakePackage, getSuperCategory, handlerSignaturesFrom, hash, hashForEqual, hasProxyMethods, info_clientClasses, info_clientSideClasses, info_promiseClasses, info_stProtocol, inGC, initializedClasses, initializingClasses, initPackages, initStringHashSBoxes, inspectPieces, instanceSize, IntegerVar, isByProxy, isConstructed, isDestructed, isEqualOrSubclassOf, isGenerated, isIntType, isKindOf, isRawType, isUnlocked, linkTimeNonInherited, make, makeClassTable, makeFillTable, makeRequestTable, mangle, markChildren, markCount, markInstances, mayBecome, mayBecomeAnySubclassOf, new1, newX, nonCopyVariables, notWorking, pack, packageClasses, packagingCategory, parseExportName, passe, pointerToStaticMember, pointerToStaticMember, pointerToVirtualMember, preorderMax, preorderNumber, PROBLEM, promiseClass, promiseDefaultValue, promiseName, promiseNameTable, promiseToAbstract, registerPackageCategory, removeGeneratedCode, removeStubbleMethods, removeSubclassGeneratedCode, removeSubclassStubbleMethods, requestProcedure, requestProceduresFrom, returnTypeFor, rootName, scheduleTermination, sendProxyTo, serverNameFor, setGC, signal, signals, smalltalkSelector, stClientProtocol, stubbleSelectorTokenReturnsArguments, subclassNonCopyVariables, takeOop, togglePromiseName, togglePromiseOfParse, unimplemented, unmangle, verifyFreeze, wipeStubble
 
Methods inherited from class org.abora.gold.java.AboraHeaper
asOop, basicInspect, displayString, error, hack, halt, knownBug, mightNotImplement, REQUIRES, shouldImplement, shouldNotImplement, stubbleForSubclassResponsibility, thingToDo, willNotImplement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myHashEntries

protected SharedPtrArray myHashEntries

myTally

protected int myTally

myCoordinateSpace

protected CoordinateSpace myCoordinateSpace
Constructor Detail

ActualHashTable

public ActualHashTable(SharedPtrArray entries,
                       int tally,
                       CoordinateSpace cs)

ActualHashTable

public ActualHashTable(Rcvr receiver)
Method Detail

atStore

public Heaper atStore(Position key,
                      Heaper aHeaper)
Description copied from class: HashTable
Associate value with key, whether or not
there is a previous association.

Overrides:
atStore in class HashTable

atIntStore

public Heaper atIntStore(IntegerVar key,
                         Heaper aHeaper)
Description copied from class: MuTable
Unboxed version. See class comment for XuInteger

Overrides:
atIntStore in class MuTable

coordinateSpace

public CoordinateSpace coordinateSpace()
Description copied from class: ScruTable
The kind of elements used to index into the table are Positions of this
coordinate space. Therefore, the domain of this table is an XuRegion in this
coordinate space.

Overrides:
coordinateSpace in class HashTable

count

public IntegerVar count()
Description copied from class: ScruTable
Return the number of domain elements, which is to say, the number of associations.
'table->count()' should be equivalent to 'table->domain()->count()'.
Used to say: 'Return the number of range elements'. This seems clearly wrong.

Overrides:
count in class HashTable

domain

public XnRegion domain()
Description copied from class: ScruTable
Return an XuRegion representing a snapshot of the current domain.
'table->domain()->hasMember(p)' iff 'table->fetch(p) !!= NULL'.

Overrides:
domain in class HashTable

fetch

public Heaper fetch(Position key)
Description copied from class: ScruTable
Return the range element at the domain position key. The routine will return
NULL if the position is not in the table.

Overrides:
fetch in class HashTable

intFetch

public Heaper intFetch(IntegerVar key)
Description copied from class: ScruTable
Unboxed version. See class comment for XuInteger

Overrides:
intFetch in class MuTable

subTable

public ScruTable subTable(XnRegion region)
Description copied from class: ScruTable
Return a table which contains only the intersection of this table's domain and
the domain specified by 'region'.
table->subTable(r)->domain()->isEqual( table->domain()->intersect(r) ).
It is unspecified whether the resulting table starts as a snapshot of a subset of
me, after which we go our own ways; or whether the resulting table is a view
onto a subset of me, such that changes to me are also visible to him. Of
course, subclasses may specify more. If you want to ensure snapshot behavior,
do 'table->subTable(r)->asImmuTable()'.
NOTE: In the future we may specify snapshot behavior or we may specify view
behavior. As a client this shouldn't effect you. However, if you implement a
new kind of ScruTable, please let us know. Also, if you have an opinion as to
which way you'd like the specification tightened up, please tell us.

Overrides:
subTable in class HashTable

wipe

public boolean wipe(Position aKey)
Description copied from class: HashTable
Remove a key->value association from the table.
Do not blast (or do anything else) if the key is not in my current domain.

Overrides:
wipe in class HashTable

fastHash

public int fastHash()

includesKey

public boolean includesKey(Position aKey)
Description copied from class: ScruTable
includesKey is used to test for the presence of a key->value pair in the
table. This routine returns true if there is a value present at the specified
key, and false otherwise.
'table->includesKey(p)' iff 'table->domain()->hasMember(p)'.

Overrides:
includesKey in class HashTable

isEmpty

public boolean isEmpty()
Description copied from class: ScruTable
Is there anything in the table?
'table->isEmpty()' iff 'table->domain()->isEmpty()'.

Overrides:
isEmpty in class HashTable

copy

public ScruTable copy()
Description copied from class: ScruTable
A new one whose initial state is my current state, but that doesn't track
changes. Note that there is no implication that these can be 'destroy'ed
separately, because (for example) an ImmuTable just returns itself

Overrides:
copy in class HashTable

emptySize

public ScruTable emptySize(IntegerVar size)
Description copied from class: ScruTable
Return an empty table just like the current one. The 'size' argument is a hint
about how big the count of the table will probably become (so that the new
table can be prepared to grow to that size efficiently).

Overrides:
emptySize in class HashTable

printOn

public void printOn(java.io.PrintWriter oo)
Overrides:
printOn in class ScruTable

runAt

public XnRegion runAt(Position index)
Description copied from class: ScruTable
Return the length of the run starting at position key. A run is defined as a
contiguous (charming) sequence of domain positions mapping to equal (isEqual)
objects. Charming is defined as: Given a charming region R, for all a,c which
are elements of R and a >= b >= c, b is an element of R. Where '>=' is
according to the 'isGE' message.
NOTE: We may retire the above definition of charming. The possible changes
will only effect spaces which aren't fully ordered. OrderedRegions,
TreeRegions, and IntegerRegions will be unaffected, as any future definition of
'runAt' will be equivalent for them.

Overrides:
runAt in class HashTable

stepper

public TableStepper stepper(OrderSpec order)
ignore order spec for now

Overrides:
stepper in class HashTable

theOne

public Heaper theOne()
Description copied from class: ScruTable
Iff I contain exactly one range element, return it. Otherwise BLAST.
The idea for this message is taken from the THE function of ONTIC
(reference McAllester)

Overrides:
theOne in class HashTable

receiveHashTable

public void receiveHashTable(Rcvr rcvr)
This currently doesn't take advantage of the optimizations in TableEntries. It should.


sendHashTable

public void sendHashTable(Xmtr xmtr)
This currently doesn't take advantage of the optimizations in TableEntries. It should.


destruct

public void destruct()
Description copied from class: Heaper
Classes should implement this message rather than a destructor. We use this so
the destruction behavior implemented in abstract superclasses can access the
vtable of the concrete run-time type in C++. Using a message makes C++
parallel the Smalltalk semantics for delete. Destroy will actually call the destructor.

Overrides:
destruct in class Heaper

aboutToWrite

public void aboutToWrite()
If my contents are shared, and I'm about to change them, make a copy of them.


checkSize

public void checkSize()

storeEntry

public void storeEntry(TableEntry anEntry)
Store the tableentry into the entry table


inspect

public void inspect()
Overrides:
inspect in class AboraHeaper

sendSelfTo

public void sendSelfTo(Xmtr xmtr)
Description copied from class: Heaper
do nothing

Overrides:
sendSelfTo in class MuTable

make

public static Heaper make(CoordinateSpace cs)
Description copied from class: MuTable
A new empty MuTable whose domain space is 'cs'.


make

public static Heaper make(CoordinateSpace cs,
                          IntegerVar size)


Translation - Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.