Package kodkod.instance

Examples of kodkod.instance.TupleSet.containsAll()


    /** Shrink the bounds for the given relation; throws an exception if the new bounds is not sameAs/subsetOf the old bounds. */
    void shrink(Relation relation, TupleSet lowerBound, TupleSet upperBound) throws Err {
       if (solved) throw new ErrorFatal("Cannot shrink a Kodkod relation since solve() has completed.");
       TupleSet oldL = bounds.lowerBound(relation);
       TupleSet oldU = bounds.upperBound(relation);
       if (oldU.containsAll(upperBound) && upperBound.containsAll(lowerBound) && lowerBound.containsAll(oldL)) {
          bounds.bound(relation, lowerBound, upperBound);
       } else {
          throw new ErrorAPI("Inconsistent bounds shrinking on relation: "+relation);
       }
    }
View Full Code Here


       } else*/
       if (a instanceof Relation || b instanceof Relation) {
          try {
            TupleSet a0 = sol.query(false, a, false), a1 = sol.query(true, a, false);
            TupleSet b0 = sol.query(false, b, false), b1 = sol.query(true, b, false);
            if (a instanceof Relation && a0.size()<b0.size() && b0.containsAll(a0) && a1.containsAll(b0)) {
                rep.debug("Comment: Simplify "+a+" "+(a1.size()-a0.size())+"->"+(a1.size()-b0.size())+"\n");
                sol.shrink((Relation)a, a0=b0, a1);
            }
            if (a instanceof Relation && a1.size()>b1.size() && b1.containsAll(a0) && a1.containsAll(b1)) {
                rep.debug("Comment: Simplify "+a+" "+(a1.size()-a0.size())+"->"+(b1.size()-a0.size())+"\n");
View Full Code Here

                    }
                }
                if (!(expr instanceof Relation)) return null;
                if (b==null) b = frame.getBounds(); // We delay the expansive Bounds.clone() until we really find a possible match
                if (ts==null) ts = fac.noneOf(expr.arity());
                if (!ts.containsAll(b.lowerBound((Relation)expr))) return null; // Sanity check
                if (!b.upperBound((Relation)expr).containsAll(ts)) return null; // Sanity check
                b.boundExactly((Relation)expr, ts);
                ts=null;
                continue;
             }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.