org.abora.gold.collection.tables
Class IntegerTable

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.IntegerTable
Direct Known Subclasses:
MuArray, OberIntegerTable

public class IntegerTable
extends MuTable

The IntegerTable class is used for tables that have arbitrary XuInteger keys in their
domain. Since ScruTable & MuTable already provide all the unboxed versions of the table
protocol, there is little need for this class to be a type. However, this class does
provide a bit of extra protocol convenience: highestIndex & lowestIndex. Unless these are
retired, we cannot retire this class from type status.
Note that there may be tables with XuInteger keys (i.e., IntegerSpace domains) which are
not kinds of IntegerTables. In particular it is perfectly sensible to create a HashTable
with XuInteger keys when the domain region is likely to be sparse.


Field Summary
 
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
IntegerTable()
          Create a new table with an unspecified number of initial domain positions.
 
Method Summary
 void atIntIntroduce(IntegerVar key, Heaper value)
          Unboxed version.
 void atIntReplace(IntegerVar key, Heaper value)
          Unboxed version.
 void atIntroduce(Position key, Heaper value)
          Associate key with value unless key is already associated with another value.
 Heaper atIntStore(IntegerVar key, Heaper value)
          Unboxed version.
 void atReplace(Position key, Heaper value)
          Associate key with value only if key is already associated with a value.
 Heaper atStore(Position key, Heaper value)
          Associate value with key, whether or not there is a previous association.
Return the old range element if the position was previously occupied, NULL otherwise
 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'.
 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.
 Heaper fetch(Position key)
          Return the range element at the domain position key.
 IntegerVar highestIndex()
          Given that the table is non-empty, 'intTab->highestIndex()' is equivalent to
'CAST(IntegerRegion,intTab->domain())->upperBound() -1'.
 boolean includesIntKey(IntegerVar aKey)
          Unboxed version.
 boolean includesKey(Position aKey)
          includesKey is used to test for the presence of a key->value pair in the
table.
 Heaper intFetch(IntegerVar key)
          Unboxed version.
 void intRemove(IntegerVar anIdx)
          Unboxed version.
 boolean intWipe(IntegerVar anIdx)
          Unboxed version.
 boolean isEmpty()
          Is there anything in the table?
'table->isEmpty()' iff 'table->domain()->isEmpty()'.
 IntegerVar lowestIndex()
          Given that the table is non-empty, 'intTab->lowestIndex()' is equivalent to
'CAST(IntegerRegion,intTab->domain())->lowerBound()'.
static Heaper make()
          A new empty IntegerTable
static Heaper make(Heaper something)
           
static Heaper make(IntegerRegion reg)
          Hint that the domain of the new table will eventually be (or at least resemble)
'reg'.
static Heaper make(IntegerVar someSize)
          A new empty IntegerTable.
static Heaper make(IntegerVar fromIdx, IntegerVar toIdx)
          Hint that the domain's lowerBound (inclusive) will eventually be 'fromIdx', and
the domain's upperBound (exclusive) will eventually be 'toIdx'.
static Heaper make(MuWordArray wv)
          Make a copy of 'wv' as an IntegerTable.
static Heaper make(ScruTable table)
          A new IntegerTable initialized from 'table' in a wierd and screwy way
 ScruTable offsetSubTableBetween(IntegerVar startIndex, IntegerVar stopIndex, IntegerVar firstIndex)
          Return a table which contains the elements from start to stop, starting at
firstIndex.
 void remove(Position aPos)
          Remove a key->value association from the table.
Blast if the key is not present.
 XnRegion runAt(Position key)
          Return the length of the run starting at position key.
 XnRegion runAtInt(IntegerVar key)
          Unboxed version.
 TableStepper stepper(OrderSpec order)
          Return a TableStepper which will enumerate my key->value mappings.
 ScruTable subTable(XnRegion reg)
          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.
 ScruTable subTableBetween(IntegerVar startIndex, IntegerVar stopIndex)
          Hack for C++ overloading problem
 boolean wipe(Position anIdx)
          Remove a key->value association from the table.
Do not blast (or do anything else) if the key is not in my current domain.
Return TRUE if the association was present and removed,
Return FALSE if the association was not there
 
Methods inherited from class org.abora.gold.collection.tables.MuTable
actualHashForEqual, asImmuTable, asMuTable, initTimeNonInherited, introduceAll, introduceAll, introduceAll, isEqual, make, make, problems, removeAll, replaceAll, replaceAll, replaceAll, sendSelfTo, storeAll, storeAll, storeAll, test, wipeAll
 
Methods inherited from class org.abora.gold.collection.tables.ScruTable
asOrderedCollection, backfollowFrom, contentsEqual, contentsHash, dox, get, intGet, isEqual, printOn, printOnWithSimpleSyntax, printOnWithSyntax, range, stepper, theOne, 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, destruct, 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, inspect, 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
 

Constructor Detail

IntegerTable

public IntegerTable()
Create a new table with an unspecified number of initial domain positions.

Method Detail

atIntIntroduce

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

Overrides:
atIntIntroduce in class MuTable

atIntReplace

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

Overrides:
atIntReplace in class MuTable

atIntStore

public Heaper atIntStore(IntegerVar key,
                         Heaper value)
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 MuTable

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 MuTable

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 MuTable

highestIndex

public IntegerVar highestIndex()
Given that the table is non-empty, 'intTab->highestIndex()' is equivalent to
'CAST(IntegerRegion,intTab->domain())->upperBound() -1'. The reason for the
'-1' is that the 'upperBound' is an exclusive upper bound (see
IntegerRegion::upperBound), whereas 'highestIndex' is the highest index which is
in my domain. I need to here specify what 'highestIndex' does if I am empty.


intFetch

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

Overrides:
intFetch in class MuTable

intRemove

public void intRemove(IntegerVar anIdx)
Description copied from class: MuTable
Unboxed version. See class comment for XuInteger

Overrides:
intRemove in class MuTable

intWipe

public boolean intWipe(IntegerVar anIdx)
Description copied from class: MuTable
Unboxed version. See class comment for XuInteger

Overrides:
intWipe in class MuTable

lowestIndex

public IntegerVar lowestIndex()
Given that the table is non-empty, 'intTab->lowestIndex()' is equivalent to
'CAST(IntegerRegion,intTab->domain())->lowerBound()'. 'lowestIndex' is the
lowest index which is in my domain. I need to here specify what 'lowestIndex'
does if I am empty.


subTable

public ScruTable subTable(XnRegion reg)
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 MuTable

atIntroduce

public void atIntroduce(Position key,
                        Heaper value)
Description copied from class: MuTable
Associate key with value unless key is already associated with another value. If so,
blast.

Overrides:
atIntroduce in class MuTable

atReplace

public void atReplace(Position key,
                      Heaper value)
Description copied from class: MuTable
Associate key with value only if key is already associated with a value. Otherwise blast.

Overrides:
atReplace in class MuTable

atStore

public Heaper atStore(Position key,
                      Heaper value)
Description copied from class: MuTable
Associate value with key, whether or not there is a previous association.
Return the old range element if the position was previously occupied, NULL otherwise

Overrides:
atStore in class MuTable

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 MuTable

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 MuTable

remove

public void remove(Position aPos)
Description copied from class: MuTable
Remove a key->value association from the table.
Blast if the key is not present.

Overrides:
remove in class MuTable

runAt

public XnRegion runAt(Position key)
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 MuTable

wipe

public boolean wipe(Position anIdx)
Description copied from class: MuTable
Remove a key->value association from the table.
Do not blast (or do anything else) if the key is not in my current domain.
Return TRUE if the association was present and removed,
Return FALSE if the association was not there

Overrides:
wipe in class MuTable

includesIntKey

public boolean includesIntKey(IntegerVar aKey)
Description copied from class: ScruTable
Unboxed version. See class comment for XuInteger

Overrides:
includesIntKey in class MuTable

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 MuTable

stepper

public TableStepper stepper(OrderSpec order)
Description copied from class: ScruTable
Return a TableStepper which will enumerate my key->value mappings. The
Stepper component of the TableStepper protocol will just enumerate my values
(as that is what I'm a container *of*--the keys are simply how I organize my
contents). TableStepper provides additional protocol to ascetain the current
key. See TableStepper and XuRegion::stepper. The TableStepper I produce given
an order must enumerate keys according to the same rules which specify how
XuRegion::stepper must enumerate positions. I am not asserting that the actual
orders are the same, only that the correctness criteria on the allowable orders
are the same.
Keeping in mind that we are talking about equivalence of specification
and not equivalence of particular behavior, the following two statements
are equivalent:
{
SPTR(TableStepper) stomp = table->stepper(o);
SPTR(Position) key;
FOR_EACH(Heaper,val,stomp, {
key = stomp->key();
doSomethingWith(key, val);
});
}
and
{
SPTR(Heaper) val;
SPTR(ImmuTable) snapShot = table->asImmuTable();
FOR_EACH(Position,key,(snapShot->domain()->stepper(o)), {
val = snapShot->get (key);
doSomethingWith(key, val);
});
}

Overrides:
stepper in class MuTable

runAtInt

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

Overrides:
runAtInt in class MuTable

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 MuTable

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 MuTable

offsetSubTableBetween

public ScruTable offsetSubTableBetween(IntegerVar startIndex,
                                       IntegerVar stopIndex,
                                       IntegerVar firstIndex)
Return a table which contains the elements from start to stop, starting at
firstIndex. Zero-based subclasses will blast if firstIndex is non-zero


subTableBetween

public ScruTable subTableBetween(IntegerVar startIndex,
                                 IntegerVar stopIndex)
Hack for C++ overloading problem


make

public static Heaper make(Heaper something)

make

public static Heaper make()
A new empty IntegerTable


make

public static Heaper make(IntegerVar someSize)
A new empty IntegerTable. 'someSize' is a hint about how big the table is likely
to need to be ('highestIndex - lowestIndex + 1', not 'count').


make

public static Heaper make(IntegerVar fromIdx,
                          IntegerVar toIdx)
Hint that the domain's lowerBound (inclusive) will eventually be 'fromIdx', and
the domain's upperBound (exclusive) will eventually be 'toIdx'.


make

public static Heaper make(IntegerRegion reg)
Hint that the domain of the new table will eventually be (or at least resemble)
'reg'.


make

public static Heaper make(ScruTable table)
A new IntegerTable initialized from 'table' in a wierd and screwy way


make

public static Heaper make(MuWordArray wv)
Make a copy of 'wv' as an IntegerTable. The IntegerTable starts out with the
same state as 'wv', but unlike 'wv' is not obligated to maintain MuArray
constraints.



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