@Test(groups = "1s", timeOut = 60000) public void testIntersect5() { IntIterableRangeSet is = new IntIterableRangeSet(); is.ELEMENTS = new int[]{1, 5, 10, 15, 20, 20, 25, 30, 32, 32, 35, 40}; is.SIZE = 12; is.CARDINALITY = 25; Assert.assertTrue(is.intersectDichot(0, 41)); Assert.assertTrue(is.intersectDichot(1, 40)); Assert.assertTrue(is.intersectDichot(2, 38)); Assert.assertTrue(is.intersectDichot(18, 33)); Assert.assertFalse(is.intersectDichot(21, 24)); Assert.assertFalse(is.intersectDichot(-3, -1)); Assert.assertFalse(is.intersectDichot(41, 43)); }
@SuppressWarnings("Duplicates") public boolean intersectDichot(int lb, int ub) { int rlb = rangeOf(lb); int rub; if (rlb > 0) { return true; } else { rub = rangeOf(ub, (-rlb - 1) << 1, SIZE); if (rub > 0) { return true; } else { return rlb != rub; } } }
IntIterableRangeSet implements IntIterableSet { @SuppressWarnings("Duplicates") public boolean intersectDichot(int lb, int ub) { int rlb = rangeOf(lb); int rub; if (rlb > 0) { return true; } else { rub = rangeOf(ub, (-rlb - 1) << 1, SIZE); if (rub > 0) { return true; } else { return rlb != rub; } } } }
IntIterableRangeSet implements IntIterableSet { @SuppressWarnings("Duplicates") public boolean intersectDichot(int lb, int ub) { int rlb = rangeOf(lb); int rub; if (rlb > 0) { return true; } else { rub = rangeOf(ub, (-rlb - 1) << 1, SIZE); if (rub > 0) { return true; } else { return rlb != rub; } } } IntIterableRangeSet();  IntIterableRangeSet(int a, int b);  IntIterableRangeSet(int e);  IntIterableRangeSet(int[] values);  IntIterableRangeSet(IntVar var); }
IntIterableRangeSet implements IntIterableSet { @SuppressWarnings("Duplicates") public boolean intersectDichot(int lb, int ub) { int rlb = rangeOf(lb); int rub; if (rlb > 0) { return true; } else { rub = rangeOf(ub, (-rlb - 1) << 1, SIZE); if (rub > 0) { return true; } else { return rlb != rub; } } } 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 { @SuppressWarnings("Duplicates") public boolean intersectDichot(int lb, int ub) { int rlb = rangeOf(lb); int rub; if (rlb > 0) { return true; } else { rub = rangeOf(ub, (-rlb - 1) << 1, SIZE); if (rub > 0) { return true; } else { return rlb != rub; } } } 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; }