@Test(groups = "1s", timeOut = 60000) public void testNextValueOut() { IntIterableRangeSet is = new IntIterableRangeSet(); is.ELEMENTS = new int[]{1, 3, 5, 5, 7, 10}; is.SIZE = 6; is.CARDINALITY = 8; Assert.assertEquals(is.nextValueOut(-10), -9); Assert.assertEquals(is.nextValueOut(-1), 0); Assert.assertEquals(is.nextValueOut(0), 4); Assert.assertEquals(is.nextValueOut(1), 4); Assert.assertEquals(is.nextValueOut(2), 4); Assert.assertEquals(is.nextValueOut(3), 4); Assert.assertEquals(is.nextValueOut(4), 6); Assert.assertEquals(is.nextValueOut(5), 6); Assert.assertEquals(is.nextValueOut(6), 11); Assert.assertEquals(is.nextValueOut(7), 11); Assert.assertEquals(is.nextValueOut(8), 11); Assert.assertEquals(is.nextValueOut(9), 11); Assert.assertEquals(is.nextValueOut(10), 11); Assert.assertEquals(is.nextValueOut(15), 16); }
@Override public int nextValueOut(int e) { e++; int p = rangeOf(e); int next; if (p >= 0) { next = ELEMENTS[((p - 1) << 1) + 1] + 1; } else { next = e; } return next; }
IntIterableRangeSet implements IntIterableSet { @Override public int nextValueOut(int e) { e++; int p = rangeOf(e); int next; if (p >= 0) { next = ELEMENTS[((p - 1) << 1) + 1] + 1; } else { next = e; } return next; } }
IntIterableRangeSet implements IntIterableSet { @Override public int nextValueOut(int e) { e++; int p = rangeOf(e); int next; if (p >= 0) { next = ELEMENTS[((p - 1) << 1) + 1] + 1; } else { next = e; } return next; } IntIterableRangeSet();  IntIterableRangeSet(int a, int b);  IntIterableRangeSet(int e);  IntIterableRangeSet(int[] values);  IntIterableRangeSet(IntVar var); }
IntIterableRangeSet implements IntIterableSet { @Override public int nextValueOut(int e) { e++; int p = rangeOf(e); int next; if (p >= 0) { next = ELEMENTS[((p - 1) << 1) + 1] + 1; } else { next = e; } return next; } IntIterableRangeSet();  IntIterableRangeSet(int a, int b);  IntIterableRangeSet(int e);  IntIterableRangeSet(int[] values);  IntIterableRangeSet(IntVar var); @Override String toString(); String toSmartString(); void lock(); void unlock(); int getNbRanges(); int cardinality(); int minOfRange(int r); int maxOfRange(int r); @Override int min(); @Override int max(); @Override boolean add(int e); @Override boolean addAll(int... values); @Override boolean addAll(IntIterableSet set); boolean addAll(IntVar var); boolean addAll(IntIterableRangeSet set); @Override boolean retainAll(IntIterableSet set); boolean retainAll(IntIterableRangeSet set); @Override boolean remove(int e); @Override boolean removeAll(IntIterableSet set); boolean removeAll(IntIterableRangeSet set); @Override void clear(); @Override SetType getSetType(); boolean addBetween(int a, int b); @Override boolean removeBetween(int f, int t); boolean retainBetween(int f, int t); @Override int nextValue(int e); @Override int nextValueOut(int e); @Override int previousValue(int e); @Override int previousValueOut(int e); @Override boolean contains(int o); @Override IntIterableRangeSet duplicate(); IntIterableRangeSet copyFrom(IntIterableRangeSet me); void copyFrom(IntVar var); @Override int size(); @Override ISetIterator newIterator(); void plus(int x); @Override ISetIterator iterator(); void minus(int x); void times(int x); int rangeOf(int x); void compact(); IntIterableRangeSet flip(); IntIterableRangeSet flip(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersect(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersectDichot(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersect(IntIterableRangeSet set); @SuppressWarnings("Duplicates") boolean intersect(IntVar var); void forEachValueIn(IntConsumer c); void forEachValueOut(IntConsumer c); int[] toArray(); }
IntIterableRangeSet implements IntIterableSet { @Override public int nextValueOut(int e) { e++; int p = rangeOf(e); int next; if (p >= 0) { next = ELEMENTS[((p - 1) << 1) + 1] + 1; } else { next = e; } return next; } IntIterableRangeSet();  IntIterableRangeSet(int a, int b);  IntIterableRangeSet(int e);  IntIterableRangeSet(int[] values);  IntIterableRangeSet(IntVar var); @Override String toString(); String toSmartString(); void lock(); void unlock(); int getNbRanges(); int cardinality(); int minOfRange(int r); int maxOfRange(int r); @Override int min(); @Override int max(); @Override boolean add(int e); @Override boolean addAll(int... values); @Override boolean addAll(IntIterableSet set); boolean addAll(IntVar var); boolean addAll(IntIterableRangeSet set); @Override boolean retainAll(IntIterableSet set); boolean retainAll(IntIterableRangeSet set); @Override boolean remove(int e); @Override boolean removeAll(IntIterableSet set); boolean removeAll(IntIterableRangeSet set); @Override void clear(); @Override SetType getSetType(); boolean addBetween(int a, int b); @Override boolean removeBetween(int f, int t); boolean retainBetween(int f, int t); @Override int nextValue(int e); @Override int nextValueOut(int e); @Override int previousValue(int e); @Override int previousValueOut(int e); @Override boolean contains(int o); @Override IntIterableRangeSet duplicate(); IntIterableRangeSet copyFrom(IntIterableRangeSet me); void copyFrom(IntVar var); @Override int size(); @Override ISetIterator newIterator(); void plus(int x); @Override ISetIterator iterator(); void minus(int x); void times(int x); int rangeOf(int x); void compact(); IntIterableRangeSet flip(); IntIterableRangeSet flip(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersect(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersectDichot(int lb, int ub); @SuppressWarnings("Duplicates") boolean intersect(IntIterableRangeSet set); @SuppressWarnings("Duplicates") boolean intersect(IntVar var); void forEachValueIn(IntConsumer c); void forEachValueOut(IntConsumer c); int[] toArray(); static final int MIN; static final int MAX; }