Java Code Examples for kodkod.instance.TupleSet#removeAll()
The following examples show how to use
kodkod.instance.TupleSet#removeAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: A4TupleSet.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Construct a new tupleset as the subtraction of this and that; this and that * must be come from the same solution. Note: if that==null, then the method * returns this A4TupleSet as-is. */ public A4TupleSet minus(A4TupleSet that) throws ErrorAPI { if (that == null) return this; if (sol != that.sol) throw new ErrorAPI("A4TupleSet.minus() requires 2 tuplesets from the same A4Solution."); if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.minus() requires 2 tuplesets with the same arity."); if (tuples.size() == 0 || that.tuples.size() == 0) return this; // special short cut TupleSet ts = tuples.clone(); ts.removeAll(that.tuples); if (tuples.size() != ts.size()) return new A4TupleSet(ts, sol); else return this; }
Example 2
Source File: ALG197.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-11, last formula of 14-15, and * first formula of 16-22). * * @return the bounds for the problem */ @Override public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); final TupleSet op1l = f.setOf(f.tuple("e16", "e16", "e15")); // axiom // 14, // line // 6 final TupleSet op2l = f.setOf(f.tuple("e26", "e26", "e25")); // axiom // 15, // line // 6 op1h.removeAll(f.area(f.tuple("e16", "e16", "e10"), f.tuple("e16", "e16", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e26", "e26", "e20"), f.tuple("e26", "e26", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e15", "e26")); // first line of axioms 16-22 for (int i = 0; i < 7; i++) { Tuple t = f.tuple("e16", "e2" + i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 3
Source File: ALG197.java From kodkod with MIT License | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-11, last formula of 14-15, and first formula of 16-22). * @return the bounds for the problem */ public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); final TupleSet op1l = f.setOf(f.tuple("e16", "e16", "e15")); // axiom 14, line 6 final TupleSet op2l = f.setOf(f.tuple("e26", "e26", "e25")); // axiom 15, line 6 op1h.removeAll(f.area(f.tuple("e16", "e16", "e10"), f.tuple("e16", "e16", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e26", "e26", "e20"), f.tuple("e26", "e26", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e15", "e26")); // first line of axioms 16-22 for(int i = 0; i < 7; i++) { Tuple t = f.tuple("e16", "e2"+i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 4
Source File: ALG195.java From kodkod with MIT License | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-13, second formula of 14-15, and first formula of 16-22). * @return the bounds for the problem */ public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); for(int i = 0; i < 7; i++) { op1h.remove(f.tuple("e1"+i, "e1"+i, "e1"+i)); // axiom 12 op2h.remove(f.tuple("e2"+i, "e2"+i, "e2"+i)); // axiom 13 } final TupleSet op1l = f.setOf(f.tuple("e15", "e15", "e11")); // axiom 14, line 2 final TupleSet op2l = f.setOf(f.tuple("e25", "e25", "e21")); // axiom 15, line 2 op1h.removeAll(f.area(f.tuple("e15", "e15", "e10"), f.tuple("e15", "e15", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e25", "e25", "e20"), f.tuple("e25", "e25", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e14", "e26")); high.addAll(f.area(f.tuple("e16", "e20"), f.tuple("e16", "e26"))); // first line of axioms 16-22 for(int i = 0; i < 7; i++) { Tuple t = f.tuple("e15", "e2"+i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 5
Source File: ALG195.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-13, second formula of 14-15, * and first formula of 16-22). * * @return the bounds for the problem */ @Override public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); for (int i = 0; i < 7; i++) { op1h.remove(f.tuple("e1" + i, "e1" + i, "e1" + i)); // axiom 12 op2h.remove(f.tuple("e2" + i, "e2" + i, "e2" + i)); // axiom 13 } final TupleSet op1l = f.setOf(f.tuple("e15", "e15", "e11")); // axiom // 14, // line // 2 final TupleSet op2l = f.setOf(f.tuple("e25", "e25", "e21")); // axiom // 15, // line // 2 op1h.removeAll(f.area(f.tuple("e15", "e15", "e10"), f.tuple("e15", "e15", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e25", "e25", "e20"), f.tuple("e25", "e25", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e14", "e26")); high.addAll(f.area(f.tuple("e16", "e20"), f.tuple("e16", "e26"))); // first line of axioms 16-22 for (int i = 0; i < 7; i++) { Tuple t = f.tuple("e15", "e2" + i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }