Java Code Examples for kodkod.util.ints.Ints#asSet()
The following examples show how to use
kodkod.util.ints.Ints#asSet() .
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: StrategyUtils.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns the set of all variables in the core of the given trace that form * unit clauses. * * @return { v: [1..) | some c: trace.core | c.size() = 1 and c.maxVariable() = * v } */ public static IntSet coreUnits(ResolutionTrace trace) { final IntSet units = new IntTreeSet(); for (Iterator<Clause> itr = trace.reverseIterator(trace.core()); itr.hasNext();) { Clause c = itr.next(); if (c.size() == 1) { units.add(c.maxVariable()); } } if (units.isEmpty()) return Ints.EMPTY_SET; return Ints.asSet(units.toArray()); }
Example 2
Source File: StrategyUtils.java From kodkod with MIT License | 5 votes |
/** * Returns the set of all variables in the core of the given trace * that form unit clauses. * @return { v: [1..) | some c: trace.core | c.size() = 1 and c.maxVariable() = v } */ public static IntSet coreUnits(ResolutionTrace trace) { final IntSet units = new IntTreeSet(); for(Iterator<Clause> itr = trace.reverseIterator(trace.core()); itr.hasNext(); ) { Clause c = itr.next(); if (c.size()==1) { units.add(c.maxVariable()); } } if (units.isEmpty()) return Ints.EMPTY_SET; return Ints.asSet(units.toArray()); }