Package kodkod.instance

Examples of kodkod.instance.TupleSet.addAll()


        expr2ts.put(ans, ts);
        if (ans instanceof PrimSig) {
           // Add the atoms in this SIG into all parent sigs
           for(PrimSig ans2 = ((PrimSig)ans).parent; ans2!=null && !ans2.builtin; ans2 = ans2.parent) {
              TupleSet ts2 = expr2ts.get(ans2);
              if (ts2==null) ts2 = ts.clone(); else { ts2 = ts2.clone(); ts2.addAll(ts); }
              expr2ts.put(ans2, ts2);
           }
        }
        return ans;
    }
View Full Code Here


     * Precondition: sig is not a builtin sig
     */
    private TupleSet computeLowerBound(List<Tuple> atoms, final PrimSig sig) throws Err {
        int n = sc.sig2scope(sig);
        TupleSet lower = factory.noneOf(1);
        for(PrimSig c:sig.children()) lower.addAll(computeLowerBound(atoms, c));
        TupleSet upper = lower.clone();
        boolean isExact = sc.isExact(sig);
        if (isExact || sig.isTopLevel()) for(n=n-upper.size(); n>0; n--) {
           Tuple atom = atoms.remove(atoms.size()-1);
           // If MUST<SCOPE and s is exact, then add fresh atoms to both LOWERBOUND and UPPERBOUND.
View Full Code Here

        if (sum!=null && sum!=Expression.NONE) return sum;
        // Recursively form the union of all parent expressions
        TupleSet ts = factory.noneOf(1);
        for(Sig parent:sig.parents) {
           Expression p = (parent instanceof PrimSig) ? sol.a2k(parent) : allocateSubsetSig((SubsetSig)parent);
           ts.addAll(sol.query(true, p, false));
           if (sum==null) sum=p; else sum=sum.union(p);
        }
        // If subset is exact, then just use the "sum" as is
        if (sig.exact) { sol.addSig(sig, sum); return sum; }
        // Allocate a relation for this subset sig, then bound it
View Full Code Here

        if (that==null) return this;
        if (sol != that.sol) throw new ErrorAPI("A4TupleSet.plus() requires 2 tuplesets from the same A4Solution.");
        if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.plus() requires 2 tuplesets with the same arity.");
        if (this==that || tuples.size()==0) return that; else if (that.tuples.size()==0) return this; // special short cut
        TupleSet ts = tuples.clone();
        ts.addAll(that.tuples);
        if (tuples.size()==ts.size()) return this;
        if (that.tuples.size()==ts.size()) return that;
        return new A4TupleSet(ts, sol);
    }
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.