示例#1
0
 public SMTAffineTerm addUnchecked(SMTAffineTerm a2, boolean sortCorrect) {
   Map<Term, Rational> summands = new HashMap<Term, Rational>();
   summands.putAll(this.mSummands);
   for (Map.Entry<Term, Rational> entry : a2.mSummands.entrySet()) {
     Term var = entry.getKey();
     if (summands.containsKey(var)) {
       Rational r = summands.get(var).add(entry.getValue());
       if (r.equals(Rational.ZERO)) summands.remove(var);
       else {
         summands.put(var, r);
       }
     } else {
       summands.put(var, entry.getValue());
     }
   }
   return create(
       summands,
       mConstant.add(a2.mConstant),
       sortCorrect ? mSort : a2.getSort().getName().equals("Real") ? a2.getSort() : mSort);
 }
示例#2
0
 public SMTAffineTerm add(SMTAffineTerm a2) {
   assert this.getSort().equals(a2.getSort());
   return addUnchecked(a2, true);
 }