Java Code Examples for kodkod.util.ints.Ints#superFastHash()
The following examples show how to use
kodkod.util.ints.Ints#superFastHash() .
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: LazyTrace.java From kodkod with MIT License | 6 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#get(int) */ public Clause get(final int index) { if (index>=0 && index<trace.length) { if (axiom(index)) { // return a self-contained clause return new Clause() { final int[] literals = trace[index]; final int hashCode = Ints.superFastHash(literals); public Iterator<Clause> antecedents() { return Containers.emptyIterator(); } public IntIterator literals() { return new IntArrayIterator(literals,0,literals.length); } public int maxVariable() { return StrictMath.abs(literals[literals.length-1]); } public int numberOfAntecedents() { return 0; } public int size() { return literals.length; } public int[] toArray(int[] array) { if (array.length<literals.length) { array = new int[literals.length]; } System.arraycopy(literals, 0, array, 0, literals.length); return array; } public int hashCode() { return hashCode; } }; } else { return new ClauseView(index); } } throw new IndexOutOfBoundsException("invalid index: " + index); }
Example 2
Source File: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#get(int) */ @Override public Clause get(final int index) { if (index >= 0 && index < trace.length) { if (axiom(index)) { // return a self-contained clause return new Clause() { final int[] literals = trace[index]; final int hashCode = Ints.superFastHash(literals); @Override public Iterator<Clause> antecedents() { return Containers.emptyIterator(); } @Override public IntIterator literals() { return new IntArrayIterator(literals, 0, literals.length); } @Override public int maxVariable() { return StrictMath.abs(literals[literals.length - 1]); } @Override public int numberOfAntecedents() { return 0; } @Override public int size() { return literals.length; } @Override public int[] toArray(int[] array) { if (array.length < literals.length) { array = new int[literals.length]; } System.arraycopy(literals, 0, array, 0, literals.length); return array; } @Override public int hashCode() { return hashCode; } }; } else { return new ClauseView(index); } } throw new IndexOutOfBoundsException("invalid index: " + index); }
Example 3
Source File: NotGate.java From org.alloytools.alloy with Apache License 2.0 | 2 votes |
/** * Constructs a new NotGate with the given formula as its input. * * @requires input != null && input !in NotGate * @ensures this.inputs' = 0->input && this.output'.label = -input.label */ NotGate(BooleanFormula input) { super(input); this.hashcode = Ints.superFastHash(-input.label()); }
Example 4
Source File: NotGate.java From kodkod with MIT License | 2 votes |
/** * Constructs a new NotGate with the given formula as its input. * @requires input != null && input !in NotGate * @ensures this.inputs' = 0->input && this.output'.label = -input.label */ NotGate(BooleanFormula input) { super(input); this.hashcode = Ints.superFastHash(-input.label()); }