Пример #1
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]]!
    */
  }
Пример #2
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]]!
   */
 }
Пример #3
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]]!
   */
 }
Пример #4
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]]]!
    */
  }