@Test(groups="1s", timeOut=60000) public void testNextValue() { IntIterableBitSet is = new IntIterableBitSet(); is.addAll(1,2,3,5,7,8,9,10); Assert.assertEquals(is.nextValue(-10), 1); Assert.assertEquals(is.nextValue(0), 1); Assert.assertEquals(is.nextValue(1), 2); Assert.assertEquals(is.nextValue(2), 3); Assert.assertEquals(is.nextValue(3), 5); Assert.assertEquals(is.nextValue(4), 5); Assert.assertEquals(is.nextValue(5), 7); Assert.assertEquals(is.nextValue(6), 7); Assert.assertEquals(is.nextValue(7), 8); Assert.assertEquals(is.nextValue(8), 9); Assert.assertEquals(is.nextValue(9), 10); Assert.assertEquals(is.nextValue(10), Integer.MAX_VALUE); Assert.assertEquals(is.nextValue(15), Integer.MAX_VALUE); }
@Override public int nextValue(int aValue) { int lb = values.nextSetBit(0); if (lb >= 0) { aValue -= offset; if (aValue < 0 || aValue < lb) { return lb + offset; } if(aValue < Integer.MAX_VALUE) { aValue = values.nextSetBit(aValue + 1); } if (aValue > -1) { return aValue + offset; } } return Integer.MAX_VALUE; }
IntIterableBitSet extends Set_BitSet implements IntIterableSet { @Override public int nextValue(int aValue) { int lb = values.nextSetBit(0); if (lb >= 0) { aValue -= offset; if (aValue < 0 || aValue < lb) { return lb + offset; } if(aValue < Integer.MAX_VALUE) { aValue = values.nextSetBit(aValue + 1); } if (aValue > -1) { return aValue + offset; } } return Integer.MAX_VALUE; } }
IntIterableBitSet extends Set_BitSet implements IntIterableSet { @Override public int nextValue(int aValue) { int lb = values.nextSetBit(0); if (lb >= 0) { aValue -= offset; if (aValue < 0 || aValue < lb) { return lb + offset; } if(aValue < Integer.MAX_VALUE) { aValue = values.nextSetBit(aValue + 1); } if (aValue > -1) { return aValue + offset; } } return Integer.MAX_VALUE; } IntIterableBitSet(); }
IntIterableBitSet extends Set_BitSet implements IntIterableSet { @Override public int nextValue(int aValue) { int lb = values.nextSetBit(0); if (lb >= 0) { aValue -= offset; if (aValue < 0 || aValue < lb) { return lb + offset; } if(aValue < Integer.MAX_VALUE) { aValue = values.nextSetBit(aValue + 1); } if (aValue > -1) { return aValue + offset; } } return Integer.MAX_VALUE; } IntIterableBitSet(); void setOffset(int offset); @Override boolean addAll(int... values); @Override boolean addAll(IntIterableSet set); @Override boolean retainAll(IntIterableSet set); @Override boolean removeAll(IntIterableSet set); @Override boolean removeBetween(int f, int t); @Override int nextValue(int aValue); @Override int nextValueOut(int aValue); @Override int previousValue(int aValue); @Override int previousValueOut(int aValue); String toString(); @Override IntIterableSet duplicate(); @Override void plus(int x); @Override void minus(int x); }
IntIterableBitSet extends Set_BitSet implements IntIterableSet { @Override public int nextValue(int aValue) { int lb = values.nextSetBit(0); if (lb >= 0) { aValue -= offset; if (aValue < 0 || aValue < lb) { return lb + offset; } if(aValue < Integer.MAX_VALUE) { aValue = values.nextSetBit(aValue + 1); } if (aValue > -1) { return aValue + offset; } } return Integer.MAX_VALUE; } IntIterableBitSet(); void setOffset(int offset); @Override boolean addAll(int... values); @Override boolean addAll(IntIterableSet set); @Override boolean retainAll(IntIterableSet set); @Override boolean removeAll(IntIterableSet set); @Override boolean removeBetween(int f, int t); @Override int nextValue(int aValue); @Override int nextValueOut(int aValue); @Override int previousValue(int aValue); @Override int previousValueOut(int aValue); String toString(); @Override IntIterableSet duplicate(); @Override void plus(int x); @Override void minus(int x);  }