org.abora.white.collection.tables
Class OffsetImmuTable

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.collection.tables.ScruTable
              |
              +--org.abora.white.collection.tables.ImmuTable
                    |
                    +--org.abora.white.collection.tables.OffsetImmuTable

public class OffsetImmuTable
extends ImmuTable


Field Summary
protected  Dsp myDsp
           
protected  ImmuTable myTable
           
 
Constructor Summary
OffsetImmuTable(ImmuTable table, Dsp dsp)
           
 
Method Summary
 int actualHashForEqual()
          See ScruTable::isEqual
 MuTable asMuTable()
          Return a side-effectable version of the same table.
 ImmuTable combineWith(ImmuTable other)
          Similar to unionWith.
 CoordinateSpace coordinateSpace()
          The kind of elements used to index into the table are Positions of this coordinate space.
 IntegerValue count()
          Return the number of domain elements, which is to say, the number of associations.
 XnRegion domain()
          Return an XuRegion representing a snapshot of the current domain.
 ScruTable emptySize(IntegerValue size)
          The idea of a 'size' argument would seem kind of ridiculous here as the resulting empty table can't be changed.
 Heaper fetch(Position anIndex)
          Return the range element at the domain position key.
 boolean includesIntKey(IntegerValue aKey)
          Unboxed version.
 boolean includesKey(Position aKey)
          includesKey is used to test for the presence of a key->value pair in the table.
 Dsp innerDsp()
           
 ScruTable innerTable()
           
 Heaper intFetch(IntegerValue idx)
          Unboxed version.
 boolean isEmpty()
          Is there anything in the table? 'table->isEmpty()' iff 'table->domain()->isEmpty()'.
 void printOn(java.io.PrintWriter oo)
          This should rarely be overridden.
 XnRegion runAt(Position key)
          Return the length of the run starting at position key.
 XnRegion runAtInt(IntegerValue anIdx)
          Unboxed version.
 TableStepper stepper()
          implement default argument of NULL
 TableStepper stepper(OrderSpec order)
          Return a TableStepper which will enumerate my key->value mappings.
 ScruTable subTable(XnRegion encl)
          Return a table which contains only the intersection of this table's domain and the domain specified by 'region'.
 ScruTable transformedBy(Dsp dsp)
          Return a ScruTable with the domain of the receiver transformed by the Dsp.
 ImmuTable without(Position index)
          Return a new table just like the current one except with the association whose key is 'index'.
 
Methods inherited from class org.abora.white.collection.tables.ImmuTable
asImmuTable, copy, isEqual, make, make, offsetImmuTable
 
Methods inherited from class org.abora.white.collection.tables.ScruTable
backfollowFrom, contentsEqual, contentsHash, get, intGet, printOnWithSimpleSyntax, printOnWithSyntax, problems, range, theOne
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, printContentsOn, sendSelfTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myTable

protected ImmuTable myTable

myDsp

protected Dsp myDsp
Constructor Detail

OffsetImmuTable

public OffsetImmuTable(ImmuTable table,
                       Dsp dsp)
Method Detail

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 ImmuTable

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 ImmuTable

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 ImmuTable

fetch

public Heaper fetch(Position anIndex)
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.

Specified by:
fetch in class ImmuTable

intFetch

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

Overrides:
intFetch in class ImmuTable

subTable

public ScruTable subTable(XnRegion encl)
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 ImmuTable

transformedBy

public ScruTable transformedBy(Dsp dsp)
Description copied from class: ImmuTable
Return a ScruTable with the domain of the receiver transformed by the Dsp. 'table->transformedBy(d)->fetch(p)' is equivalent to 'table->fetch(d->of(p))'. See ScruTable::subTable for caveats regarding whether we return a snapshot or a view. All the same caveats apply. In this case of transforming an ImmuTable, it makes sense to return an ImmuTable.

Overrides:
transformedBy in class ImmuTable

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.

Specified by:
runAt in class ImmuTable

runAtInt

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

Specified by:
runAtInt in class ImmuTable

actualHashForEqual

public int actualHashForEqual()
Description copied from class: ScruTable
See ScruTable::isEqual

Overrides:
actualHashForEqual in class ImmuTable

includesIntKey

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

Overrides:
includesIntKey in class ImmuTable

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

Specified by:
includesKey in class ImmuTable

isEmpty

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

Specified by:
isEmpty in class ImmuTable

printOn

public void printOn(java.io.PrintWriter oo)
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

emptySize

public ScruTable emptySize(IntegerValue size)
Description copied from class: ImmuTable
The idea of a 'size' argument would seem kind of ridiculous here as the resulting empty table can't be changed.

Specified by:
emptySize in class ImmuTable

asMuTable

public MuTable asMuTable()
Description copied from class: ScruTable
Return a side-effectable version of the same table. See ScruSet::asMuSet.

Specified by:
asMuTable in class ImmuTable

stepper

public TableStepper stepper()
Description copied from class: ScruTable
implement default argument of NULL

Overrides:
stepper in class ScruTable

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); }); }

Specified by:
stepper in class ImmuTable

innerDsp

public Dsp innerDsp()

innerTable

public ScruTable innerTable()

combineWith

public ImmuTable combineWith(ImmuTable other)
Description copied from class: ImmuTable
Similar to unionWith. In particular, if 'a = b->combineWith(c);', then: 'a->domain()->isEqual(b->domain()->unionWith(c->domain())' and 'a->range()->isSubsetOf(b->range()->unionWith(c->range())'. (Note that the domain case uses XuRegion::unionWith, while the range case uses ImmuSet::unionWith.) Despite this correspondence, unionWith is symmetrical while combineWith is not. Given that the two input tables have different associations for a given key, one gets to dominate. I need to specify which one here, but the code seems inconsistent on this question. Until this is resolved, console youself with the thought that if the tables don't conflict we have a simple unionWith of the two sets of associations (and the 'isSubsetOf' above can be replaced with 'isEqual').

Specified by:
combineWith in class ImmuTable

without

public ImmuTable without(Position index)
Description copied from class: ImmuTable
Return a new table just like the current one except with the association whose key is 'index'.

Specified by:
without in class ImmuTable


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