コード例 #1
0
ファイル: MuTable.java プロジェクト: jonesd/udanax-gold2java
 /**
  * '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!
   */
 }
コード例 #2
0
ファイル: MuTable.java プロジェクト: jonesd/udanax-gold2java
 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
ファイル: MuTable.java プロジェクト: jonesd/udanax-gold2java
  /**
   * '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]]]!
    */
  }