コード例 #1
0
 public void calcTargetRefs(final PersistentQuantity arg1, final PersistentQuantity arg2)
     throws model.NotComputableException, PersistenceException {
   final SummableHashMap<PersistentUnit> myReferences = computeReferences(arg1);
   SummableHashMap<PersistentUnit> factorReferences = computeReferences(arg2);
   factorReferences = factorReferences.invertSign();
   final SummableHashMap<PersistentUnit> aggregatedReferences =
       aggregateReferences(myReferences, factorReferences);
   this.targetRefs = aggregatedReferences;
 }
コード例 #2
0
 /**
  * Errechnet aus den als Map abgebildeten Referenzen die Referenztypen und gibt das Ergebnis als
  * Map zurück. Z.B.: {(m:Unit,1),(cm:Unit,1)} = {(Strecke:UnitType, 2)}
  *
  * @param references
  * @return
  * @throws PersistenceException
  */
 private SummableHashMap<PersistentUnitType> computeReferenceTypes(
     final SummableHashMap<PersistentUnit> references) throws PersistenceException {
   final SummableHashMap<PersistentUnitType> result = new SummableHashMap<PersistentUnitType>();
   final Iterator<PersistentUnit> i = references.getMap().keySet().iterator();
   while (i.hasNext()) {
     final PersistentUnit u = i.next();
     result.add((PersistentUnitType) u.getType(), references.getMap().get(u));
   }
   return result;
 }
コード例 #3
0
 public void calcTargetRefTypes(final PersistentQuantity arg1, final PersistentQuantity arg2)
     throws model.NotComputableException, PersistenceException {
   // referenzen aus den Einheiten holen
   final SummableHashMap<PersistentUnit> myReferences = computeReferences(arg1);
   final SummableHashMap<PersistentUnit> factorReferences = computeReferences(arg2);
   // Einheitstypen aus den Referenzen konsolidieren
   final SummableHashMap<PersistentUnitType> myRefTypes = computeReferenceTypes(myReferences);
   final SummableHashMap<PersistentUnitType> factorRefTypes =
       computeReferenceTypes(factorReferences);
   myRefTypes.aggregate_add(factorRefTypes);
   this.targetRefTypes = myRefTypes;
 }
コード例 #4
0
 /**
  * aggregiert zwei Objekte vom Typ {@link SummableHashMap}
  *
  * @param myReferences
  * @param factorReferences
  * @return
  */
 private SummableHashMap<PersistentUnit> aggregateReferences(
     final SummableHashMap<PersistentUnit> myReferences,
     final SummableHashMap<PersistentUnit> factorReferences) {
   final SummableHashMap<PersistentUnit> result = myReferences;
   myReferences.aggregate_add((factorReferences));
   return result;
 }