public XnRegion runAtInt(int anIdx) {
   return myDsp.ofAll((myTable.runAtInt((myDsp.inverseOfInt(anIdx)))));
   /*
   udanax-top.st:47581:OffsetImmuTable methodsFor: 'runs'!
   {XnRegion} runAtInt: anIdx {IntegerVar}
   	^myDsp ofAll: (myTable runAtInt: (myDsp inverseOfInt: anIdx))!
   */
 }
Beispiel #2
0
 /**
  * 'MuTable::introduceAll is to 'MuTable::introduce' as 'MuTable::storeAll' is to
  * 'MuTable::store'. See MuTable::storeAll. In addition to the functionality provided by
  * MuTable::storeAll, I BLAST *if* all the associations I'm being asked to store override existing
  * associations of mine. If I BLAST for this reason, then I guarantee that I haven't changed
  * myself at all.
  */
 public void introduceAll(ScruTable table, Dsp dsp, XnRegion region) {
   /* Since this function checks the relavent regions, it can call the potentially
   more efficient store: */
   if (!(table.coordinateSpace().isEqual(coordinateSpace()))) {
     throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
   }
   if (dsp == null) {
     if (domain().intersects(table.domain())) {
       throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
     }
   } else {
     if (region == null) {
       if (domain().intersects((dsp.ofAll(table.domain())))) {
         throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
       }
     } else {
       if (domain().intersects((dsp.ofAll((table.domain().intersect(region)))))) {
         throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
       }
     }
   }
   storeAll(table, dsp, region);
   /*
   udanax-top.st:47858:MuTable methodsFor: 'bulk operations'!
   {void} introduceAll: table {ScruTable}
   	with: dsp {Dsp default: NULL}
   	with: region {XnRegion default: NULL}
   	"'MuTable::introduceAll is to 'MuTable::introduce' as 'MuTable::storeAll' is to
   	'MuTable::store'.  See MuTable::storeAll.  In addition to the functionality
   	provided by MuTable::storeAll, I BLAST *if* all the associations I'm being
   	asked to store override existing associations of mine.  If I BLAST for this
   	reason, then I guarantee that I haven't changed myself at all."
   	"Since this function checks the relavent regions, it can call the potentially
   	more efficient store:"
   	(table coordinateSpace isEqual: self coordinateSpace) ifFalse:
   		[ Heaper BLAST: #WrongCoordSpace ].
   	dsp == NULL
   		ifTrue:
   			[(self domain intersects: table domain) ifTrue:
   				[ Heaper BLAST: #AlreadyInTable ]]
   		ifFalse:
   			[region == NULL
   				ifTrue:
   					[(self domain intersects: (dsp ofAll: table domain)) ifTrue:
   						[ Heaper BLAST: #AlreadyInTable ]]
   				ifFalse:
   					[(self domain intersects: (dsp ofAll: (table domain intersect: region))) ifTrue:
   						[ Heaper BLAST: #AlreadyInTable ]]].
   	self storeAll: table with: dsp with: region!
   */
 }
 public ScruTable transformedBy(Dsp dsp) {
   if (myDsp.inverse().isEqual(dsp)) {
     return myTable;
   } else {
     return new OffsetScruTable(myTable, (dsp.compose(myDsp)));
   }
   /*
   udanax-top.st:47567:OffsetImmuTable methodsFor: 'accessing'!
   {ScruTable} transformedBy: dsp {Dsp}
   	(myDsp inverse isEqual: dsp)
   		ifTrue: [^myTable]
   		ifFalse: [^OffsetScruTable create: myTable with: (dsp compose: myDsp)]!
   */
 }
Beispiel #4
0
  /**
   * I 'store' into myself (see MuTable::store) all the associations from 'table'. If 'region' is
   * provided, then I only store those associations from 'table' whose key is inside 'region'. If
   * 'dsp' is provided, then I transform the keys (from the remaining associations) by dsp before
   * storing into myself.
   */
  public void storeAll(ScruTable table, Dsp dsp, XnRegion region) {
    TableStepper stepper;
    if (!(table.coordinateSpace().isEqual(coordinateSpace()))) {
      throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
    }
    if (dsp == null) {
      Stepper stomper = (stepper = table.stepper());
      for (; stomper.hasValue(); stomper.step()) {
        Heaper e = (Heaper) stomper.fetch();
        if (e == null) {
          continue;
        }
        store(stepper.position(), e);
      }
      stomper.destroy();
    } else {
      ScruTable localTable;
      if (region != null) {
        localTable = table.subTable(region);
      } else {
        localTable = table;
      }
      Stepper stomper2 = (stepper = localTable.stepper());
      for (; stomper2.hasValue(); stomper2.step()) {
        Heaper x = (Heaper) stomper2.fetch();
        if (x == null) {
          continue;
        }
        store((dsp.of(stepper.position())), x);
      }
      stomper2.destroy();
    }
    /*
    udanax-top.st:47924:MuTable methodsFor: 'bulk operations'!
    {void} storeAll: table {ScruTable}
    	with: dsp {Dsp default: NULL}
    	with: region {XnRegion default: NULL}
    	"I 'store' into myself (see MuTable::store) all the associations from 'table'.
    	If 'region' is provided, then I only store those associations from 'table' whose
    	key is inside 'region'.  If 'dsp' is provided, then I transform the keys (from
    	the remaining associations) by dsp before storing into myself."

    	| stepper {TableStepper} |
    	(table coordinateSpace isEqual: self coordinateSpace) ifFalse:
    		[ Heaper BLAST: #WrongCoordSpace ].
    	dsp == NULL
    		ifTrue:
    			[(stepper _ table stepper) forEach:
    				[ :e {Heaper} |
    				self at: stepper position store: e]]
    		ifFalse:
    			[| localTable {ScruTable} |
    			region ~~ NULL ifTrue: [ localTable _ table subTable: region ]
    							ifFalse: [ localTable _ table ].
    			(stepper _ localTable stepper) forEach:
    				[ :x {Heaper} |
    				self at: (dsp of: stepper position) store: x]]!
    */
  }
 public boolean includesIntKey(int aKey) {
   return myTable.includesIntKey((myDsp.inverseOfInt(aKey)));
   /*
   udanax-top.st:47589:OffsetImmuTable methodsFor: 'testing'!
   {BooleanVar} includesIntKey: aKey {IntegerVar}
   	^myTable includesIntKey: (myDsp inverseOfInt: aKey)!
   */
 }
 public int actualHashForEqual() {
   return HashHelper.hashForEqual(this.getClass()) + myTable.hashForEqual() + myDsp.hashForEqual();
   /*
   udanax-top.st:47586:OffsetImmuTable methodsFor: 'testing'!
   {UInt32} actualHashForEqual
   	^#cat.U.OffsetImmuTable hashForEqual + myTable hashForEqual + myDsp hashForEqual!
   */
 }
 public ImmuTable without(Position index) {
   return new OffsetImmuTable((myTable.without((myDsp.inverseOf(index)))), myDsp);
   /*
   udanax-top.st:47657:OffsetImmuTable methodsFor: 'SEF manipulation'!
   {ImmuTable} without: index {Position}
   	^OffsetImmuTable create: (myTable without: (myDsp inverseOf: index)) with: myDsp!
   */
 }
 public ScruTable subTable(XnRegion encl) {
   return new OffsetScruTable((myTable.subTable((myDsp.inverseOfAll(encl)))), myDsp);
   /*
   udanax-top.st:47563:OffsetImmuTable methodsFor: 'accessing'!
   {ScruTable} subTable: encl {XnRegion}
   	^OffsetScruTable create: (myTable subTable: (myDsp inverseOfAll: encl)) with: myDsp.!
   */
 }
 public Heaper intFetch(int idx) {
   return myTable.intFetch((myDsp.inverseOfInt(idx)));
   /*
   udanax-top.st:47560:OffsetImmuTable methodsFor: 'accessing'!
   {Heaper} intFetch: idx {IntegerVar}
   	^myTable intFetch: (myDsp inverseOfInt: idx)!
   */
 }
 public Heaper fetch(Position anIndex) {
   return myTable.intFetch((myDsp.inverseOfInt(((IntegerPos) anIndex).asIntegerVar())));
   /*
   udanax-top.st:47556:OffsetImmuTable methodsFor: 'accessing'!
   {Heaper} fetch: anIndex {Position}
   	^myTable intFetch: (myDsp inverseOfInt: (anIndex cast: IntegerPos) asIntegerVar)!
   */
 }
 public XnRegion domain() {
   return myDsp.ofAll(myTable.domain());
   /*
   udanax-top.st:47552:OffsetImmuTable methodsFor: 'accessing'!
   {XnRegion} domain
   	^myDsp ofAll: myTable domain!
   */
 }
  public boolean includesKey(Position aKey) {
    return myTable.includesKey((myDsp.inverseOf(aKey)));
    /*
    udanax-top.st:47592:OffsetImmuTable methodsFor: 'testing'!
    {BooleanVar} includesKey: aKey {Position}

    	^ myTable includesKey: (myDsp inverseOf: aKey)!
    */
  }
Beispiel #13
0
 public void introduceAll(ScruTable table, Dsp dsp) {
   TableStepper stepper;
   if (!(table.coordinateSpace().isEqual(coordinateSpace()))) {
     throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
   }
   if (domain().intersects((dsp.ofAll(table.domain())))) {
     throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
   }
   if (dsp == null) {
     Stepper stomper = (stepper = table.stepper());
     for (; stomper.hasValue(); stomper.step()) {
       Heaper d = (Heaper) stomper.fetch();
       if (d == null) {
         continue;
       }
       introduce(stepper.position(), d);
     }
     stomper.destroy();
   } else {
     Stepper stomper2 = (stepper = table.stepper());
     for (; stomper2.hasValue(); stomper2.step()) {
       Heaper e = (Heaper) stomper2.fetch();
       if (e == null) {
         continue;
       }
       introduce((dsp.of(stepper.position())), e);
     }
     stomper2.destroy();
   }
   /*
   udanax-top.st:48046:MuTable methodsFor: 'smalltalk: defaults'!
   {void} introduceAll: table {ScruTable} with: dsp {Dsp default: NULL}
   	| stepper {TableStepper} |
   	(table coordinateSpace isEqual: self coordinateSpace)
   		ifFalse: [Heaper BLAST: #WrongCoordSpace].
   	(self domain intersects: (dsp ofAll: table domain))
   		ifTrue: [Heaper BLAST: #AlreadyInTable].
   	dsp == NULL
   		ifTrue: [(stepper _ table stepper) forEach: [:d {Heaper} |
   				self at: stepper position introduce: d]]
   		ifFalse: [(stepper _ table stepper) forEach: [:e {Heaper} |
   				self at: (dsp of: stepper position) introduce: e]]!
   */
 }
 public XnRegion runAt(Position key) {
   if (includesKey((myDsp.inverseOf(key)))) {
     return key.asRegion();
   } else {
     return myTable.coordinateSpace().emptyRegion();
   }
   /*
   udanax-top.st:47575:OffsetImmuTable methodsFor: 'runs'!
   {XnRegion} runAt: key {Position}
   	(self includesKey: (myDsp inverseOf: key))
   		ifTrue: [^ key asRegion]
   		ifFalse: [^ myTable coordinateSpace emptyRegion]!
   */
 }
Beispiel #15
0
 public void storeAll(ScruTable table, Dsp dsp) {
   TableStepper stepper;
   if (!(table.coordinateSpace().isEqual(coordinateSpace()))) {
     throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
   }
   if (dsp == null) {
     Stepper stomper = (stepper = table.stepper());
     for (; stomper.hasValue(); stomper.step()) {
       Heaper e = (Heaper) stomper.fetch();
       if (e == null) {
         continue;
       }
       store((dsp.of(stepper.position())), e);
     }
     stomper.destroy();
   } else {
     Stepper stomper2 = (stepper = table.stepper());
     for (; stomper2.hasValue(); stomper2.step()) {
       Heaper x = (Heaper) stomper2.fetch();
       if (x == null) {
         continue;
       }
       store(stepper.position(), x);
     }
     stomper2.destroy();
   }
   /*
   udanax-top.st:48077:MuTable methodsFor: 'smalltalk: defaults'!
   {void} storeAll: table {ScruTable} with: dsp {Dsp default: NULL}
   	| stepper {TableStepper} |
   	(table coordinateSpace isEqual: self coordinateSpace)
   		ifFalse: [Heaper BLAST: #WrongCoordSpace].
   	dsp == NULL
   		ifTrue: [(stepper _ table stepper) forEach: [:e {Heaper} |
   				self at: (dsp of: stepper position) store: e]]
   		ifFalse: [(stepper _ table stepper) forEach: [:x {Heaper} |
   				self at: stepper position store: x]]!
   */
 }
 public MuTable asMuTable() {
   MuTable newTab;
   TableStepper s;
   newTab = (myTable.emptySize(myTable.count())).asMuTable();
   Stepper stomper = (s = myTable.stepper());
   for (; stomper.hasValue(); stomper.step()) {
     Heaper e = (Heaper) stomper.fetch();
     if (e == null) {
       continue;
     }
     newTab.store((myDsp.of(s.position())), e);
   }
   stomper.destroy();
   return newTab;
   /*
   udanax-top.st:47617:OffsetImmuTable methodsFor: 'conversion'!
   {MuTable} asMuTable
   	| newTab {MuTable} s {TableStepper} |
   	newTab _ (myTable emptySize: myTable count) asMuTable.
   	(s _ myTable stepper) forEach: [ :e {Heaper} |
   		newTab at: (myDsp of: s position) store: e].
   	^ newTab!
   */
 }
 public ImmuTable combineWith(ImmuTable other) {
   MuTable newTable;
   TableStepper others;
   newTable = (MuTable) myTable.copy().asMuTable();
   others = other.stepper();
   while (others.hasValue()) {
     newTable.store((myDsp.inverseOf(others.position())), others.fetch());
     others.step();
   }
   others.destroy();
   return new OffsetImmuTable(newTable.asImmuTable(), myDsp);
   /*
   udanax-top.st:47646:OffsetImmuTable methodsFor: 'SEF manipulation'!
   {ImmuTable} combineWith: other {ImmuTable}
   	| newTable {MuTable} others {TableStepper} |
   	newTable _ myTable copy asMuTable.
   	others _ other stepper.
   	[others hasValue] whileTrue:
   		[newTable at: (myDsp inverseOf: others position) store: others fetch.
   		others step].
   	others destroy.
   	^OffsetImmuTable create: newTable asImmuTable with: myDsp!
   */
 }
Beispiel #18
0
  /**
   * 'MuTable::replaceAll is to 'MuTable::replace' as 'MuTable::storeAll' is to 'MuTable::store'.
   * See MuTable::storeAll. In addition to the functionality provided by MuTable::storeAll, I BLAST
   * *unless* all the associations I'm being asked to store override existing associations of mine.
   * If I BLAST for this reason, then I guarantee that I haven't changed myself at all.
   */
  public void replaceAll(ScruTable table, Dsp dsp, XnRegion region) {
    /* Since this function checks the relavent regions, it can call the potentially
    more efficient store: */
    TableStepper stepper;
    if (!(table.coordinateSpace().isEqual(coordinateSpace()))) {
      throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
    }
    if (dsp == null) {
      if (!(table.domain().isSubsetOf(domain()))) {
        throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
      }
      Stepper stomper = (stepper = table.stepper());
      for (; stomper.hasValue(); stomper.step()) {
        Heaper e = (Heaper) stomper.fetch();
        if (e == null) {
          continue;
        }
        store(stepper.position(), e);
      }
      stomper.destroy();
    } else {
      if (region == null) {
        if (!((dsp.ofAll(table.domain())).isSubsetOf(domain()))) {
          throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
        }
        Stepper stomper2 = (stepper = table.stepper());
        for (; stomper2.hasValue(); stomper2.step()) {
          Heaper x = (Heaper) stomper2.fetch();
          if (x == null) {
            continue;
          }
          store((dsp.of(stepper.position())), x);
        }
        stomper2.destroy();
      } else {
        if (!((dsp.ofAll((table.domain().intersect(region)))).isSubsetOf(domain()))) {
          throw new AboraRuntimeException(AboraRuntimeException.ALREADY_IN_TABLE);
        }
        Stepper stomper3 = (stepper = (table.subTable(region)).stepper());
        for (; stomper3.hasValue(); stomper3.step()) {
          Heaper y = (Heaper) stomper3.fetch();
          if (y == null) {
            continue;
          }
          store((dsp.of(stepper.position())), y);
        }
        stomper3.destroy();
      }
    }
    /*
    udanax-top.st:47886:MuTable methodsFor: 'bulk operations'!
    {void} replaceAll: table {ScruTable}
    	with: dsp {Dsp default: NULL}
    	with: region {XnRegion default: NULL}
    	"'MuTable::replaceAll is to 'MuTable::replace' as 'MuTable::storeAll' is to
    	'MuTable::store'.  See MuTable::storeAll.  In addition to the functionality
    	provided by MuTable::storeAll, I BLAST *unless* all the associations I'm being
    	asked to store override existing associations of mine.  If I BLAST for this
    	reason, then I guarantee that I haven't changed myself at all."
    	"Since this function checks the relavent regions, it can call the potentially
    	more efficient store:"

    	| stepper {TableStepper} |
    	(table coordinateSpace isEqual: self coordinateSpace) ifFalse:
    		[ Heaper BLAST: #WrongCoordSpace ].
    	dsp == NULL
    		ifTrue:
    			[(table domain isSubsetOf: self domain) ifFalse:
    				[ Heaper BLAST: #AlreadyInTable ].
    			(stepper _ table stepper) forEach:
    				[ :e {Heaper} |
    				self at: stepper position store: e]]
    		ifFalse:
    			[region == NULL
    				ifTrue:
    					[((dsp ofAll: table domain) isSubsetOf: self domain) ifFalse:
    						[ Heaper BLAST: #AlreadyInTable ].
    					(stepper _ table stepper) forEach:
    						[ :x {Heaper} |
    						self at: (dsp of: stepper position) store: x]]
    				ifFalse:
    					[((dsp ofAll: (table domain intersect: region)) isSubsetOf: self domain) ifFalse:
    						[ Heaper BLAST: #AlreadyInTable ].
    					(stepper _ (table subTable: region) stepper) forEach:
    						[ :y {Heaper} |
    						self at: (dsp of: stepper position) store: y]]]!
    */
  }