Ejemplo n.º 1
0
 /** Associate key with value only if key is already associated with a value. Otherwise blast. */
 public void replace(Position key, Heaper value) {
   if ((store(key, value)) == null) {
     wipe(key);
     /* restore table before blast */
     throw new AboraRuntimeException(AboraRuntimeException.NOT_IN_TABLE);
   }
   /*
   udanax-top.st:47809:MuTable methodsFor: 'accessing'!
   {void} at: key {Position} replace: value {Heaper}
   	"Associate key with value only if key is already associated with a value.  Otherwise blast."
   	((self at: key store: value) == NULL)
   		ifTrue: [self wipe: key. "restore table before blast"
   			Heaper BLAST: #NotInTable]!
   */
 }
Ejemplo n.º 2
0
  /** I 'wipe' from myself all associations whose key is in 'region'. See MuTable::wipe */
  public void wipeAll(XnRegion region) {
    if (!(region.coordinateSpace().isEqual(coordinateSpace()))) {
      throw new AboraRuntimeException(AboraRuntimeException.WRONG_COORD_SPACE);
    }
    Stepper stomper = region.stepper();
    for (; stomper.hasValue(); stomper.step()) {
      Position p = (Position) stomper.fetch();
      if (p == null) {
        continue;
      }
      wipe(p);
    }
    stomper.destroy();
    /*
    udanax-top.st:47950:MuTable methodsFor: 'bulk operations'!
    {void} wipeAll: region {XnRegion}
    	"I 'wipe' from myself all associations whose key is in 'region'.  See MuTable::wipe"

    	(region coordinateSpace isEqual: self coordinateSpace) ifFalse:
    		[ Heaper BLAST: #WrongCoordSpace ].
    	region stepper forEach: [ :p {Position} | self wipe: p]!
    */
  }