org.abora.white.collection.tables
Class ActualArray

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.collection.tables.ScruTable
              |
              +--org.abora.white.collection.tables.MuTable
                    |
                    +--org.abora.white.collection.tables.IntegerTable
                          |
                          +--org.abora.white.collection.tables.MuArray
                                |
                                +--org.abora.white.collection.tables.ActualArray

public class ActualArray
extends MuArray

Implementation of MuArray.


Field Summary
protected  PtrArray elements
           
protected  int tally
           
 
Constructor Summary
protected ActualArray()
          The optional argument just hints at the number of elements to eventually be added.
protected ActualArray(IntegerValue size)
          The optional argument just hints at the number of elements to eventually be added.
protected ActualArray(PtrArray newElems, int newTally)
           
protected ActualArray(Rcvr receiver)
           
 
Method Summary
 Heaper atIntStore(IntegerValue index, Heaper value)
          store the new value at the specified position.
 Heaper atStore(Position key, Heaper value)
          Associate value with key, whether or not there is a previous association.
 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.
 IntegerValue count()
          Return the number of domain elements, which is to say, the number of associations.
 void destruct()
           
 XnRegion domain()
          Return an XuRegion representing a snapshot of the current domain.
 PtrArray elementsArray()
          return the elements array for rapid processing
 ScruTable emptySize(IntegerValue size)
          Return an empty table just like the current one.
 int endOffset()
          return the size of the elements array for rapid processing
 void enlarge()
          Enlarge the receiver to contain more slots filled with nil.
 int fastHash()
           
 Heaper fetch(Position key)
          Return the range element at the domain position key.
 IntegerValue highestIndex()
          Given that the table is non-empty, 'intTab->highestIndex()' is equivalent to 'CAST(IntegerRegion,intTab->domain())->upperBound() -1'.
 Heaper intFetch(IntegerValue index)
          Unboxed version.
 boolean intWipe(IntegerValue index)
          Remove if the index is the last thing in the table.
 boolean isEmpty()
          Is there anything in the table? 'table->isEmpty()' iff 'table->domain()->isEmpty()'.
 IntegerValue lowestIndex()
          Given that the table is non-empty, 'intTab->lowestIndex()' is equivalent to 'CAST(IntegerRegion,intTab->domain())->lowerBound()'.
 int maxElements()
          return the size of the elements array for rapid processing
 ScruTable offsetSubTableBetween(IntegerValue startIndex, IntegerValue stopIndex, IntegerValue firstIndex)
          Return a table which contains the elements from start to stop, starting at firstIndex.
 void printOn(java.io.PrintWriter aStream)
          This should rarely be overridden.
 XnRegion runAt(Position anIdx)
          Return the length of the run starting at position key.
 XnRegion runAtInt(IntegerValue anIdx)
          Unboxed version.
 IntegerValue search(IntegerValue item)
           
 void sendSelfTo(Xmtr xmtr)
           
 int startOffset()
          return the size of the elements array for rapid processing
 TableStepper stepper(OrderSpec order)
          Return a stepper on this table.
 ScruTable subTable(XnRegion reg)
          Return a table which contains only the intersection of this table's domain and the domain specified by 'region'.
 ScruTable subTableBetween(IntegerValue start, IntegerValue stop)
          Hack for C++ overloading problem
 boolean wipe(Position key)
          Remove a key->value association from the table.
 
Methods inherited from class org.abora.white.collection.tables.MuArray
array, array, array, array, array, arrayAccumulator, arrayAccumulator, includesIntKey, includesKey, make, offsetScruArray, theOne, transformedBy, wipeAll
 
Methods inherited from class org.abora.white.collection.tables.IntegerTable
atIntIntroduce, atIntReplace, atIntroduce, atReplace, intRemove, make, make, make, remove
 
Methods inherited from class org.abora.white.collection.tables.MuTable
actualHashForEqual, asImmuTable, asMuTable, introduceAll, introduceAll, introduceAll, isEqual, make, make, problems, removeAll, replaceAll, replaceAll, replaceAll, storeAll, storeAll, storeAll
 
Methods inherited from class org.abora.white.collection.tables.ScruTable
backfollowFrom, contentsEqual, contentsHash, get, intGet, printOnWithSimpleSyntax, printOnWithSyntax, range, stepper
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, equals, hashForEqual, printContentsOn, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

elements

protected PtrArray elements

tally

protected int tally
Constructor Detail

ActualArray

protected ActualArray()
The optional argument just hints at the number of elements to eventually be added. It makes no difference semantically.


ActualArray

protected ActualArray(IntegerValue size)
The optional argument just hints at the number of elements to eventually be added. It makes no difference semantically.


ActualArray

protected ActualArray(PtrArray newElems,
                      int newTally)

ActualArray

protected ActualArray(Rcvr receiver)
Method Detail

fastHash

public int fastHash()

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 MuArray

atIntStore

public Heaper atIntStore(IntegerValue index,
                         Heaper value)
store the new value at the specified position. Note that this is an insertion iff the index is the same as the tally (that is, we're adding at the first empty position at the end of the array).

Specified by:
atIntStore in class MuArray

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.

Specified by:
coordinateSpace in class MuArray

count

public IntegerValue 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.

Specified by:
count in class MuArray

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'.

Specified by:
domain in class MuArray

highestIndex

public IntegerValue highestIndex()
Description copied from class: IntegerTable
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.

Specified by:
highestIndex in class MuArray

intFetch

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

Specified by:
intFetch in class MuArray

intWipe

public boolean intWipe(IntegerValue index)
Remove if the index is the last thing in the table. Blast if the index is some other element of the table. *Ignore* the request if it is any element not in the table.

Specified by:
intWipe in class MuArray

lowestIndex

public IntegerValue lowestIndex()
Description copied from class: IntegerTable
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.

Specified by:
lowestIndex in class MuArray

offsetSubTableBetween

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

Overrides:
offsetSubTableBetween in class MuArray

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.

Specified by:
subTable in class MuArray

subTableBetween

public ScruTable subTableBetween(IntegerValue start,
                                 IntegerValue stop)
Description copied from class: IntegerTable
Hack for C++ overloading problem

Specified by:
subTableBetween in class MuArray

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

Specified by:
copy in class MuArray

emptySize

public ScruTable emptySize(IntegerValue 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).

Specified by:
emptySize in class MuArray

destruct

public void destruct()
Overrides:
destruct in class Heaper

runAtInt

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

Specified by:
runAtInt in class MuArray

printOn

public void printOn(java.io.PrintWriter aStream)
Description copied from class: Heaper
This should rarely be overridden. In Tofu, it prints ClassName(...), where ... is either produced by printInsideOn or is ??? if printInsideOn it not overridden.

Overrides:
printOn in class ScruTable

elementsArray

public PtrArray elementsArray()
return the elements array for rapid processing


endOffset

public int endOffset()
return the size of the elements array for rapid processing


enlarge

public void enlarge()
Enlarge the receiver to contain more slots filled with nil.


maxElements

public int maxElements()
return the size of the elements array for rapid processing


startOffset

public int startOffset()
return the size of the elements array for rapid processing


search

public IntegerValue search(IntegerValue item)

stepper

public TableStepper stepper(OrderSpec order)
Description copied from class: MuArray
Return a stepper on this table.

Specified by:
stepper in class MuArray

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 MuArray

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 MuArray

runAt

public XnRegion runAt(Position anIdx)
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 MuArray

wipe

public boolean wipe(Position key)
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 MuArray

sendSelfTo

public void sendSelfTo(Xmtr xmtr)
Overrides:
sendSelfTo in class MuTable


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