@Test public void testNextValue() { MappeableArrayContainer container = new MappeableArrayContainer(CharBuffer.wrap(new char[] { 10, 20, 30}), 3); assertEquals(10, container.nextValue((char)10)); assertEquals(20, container.nextValue((char)11)); assertEquals(30, container.nextValue((char)30)); }
@Override public int nextValue(char fromValue) { int index = BufferUtil.advanceUntil(content, -1, cardinality, fromValue); if (index == cardinality) { return fromValue == content.get(cardinality - 1) ? (fromValue) : -1; } return (content.get(index)); }
MappeableArrayContainer extends MappeableContainer implements Cloneable { @Override public int nextValue(char fromValue) { int index = BufferUtil.advanceUntil(content, -1, cardinality, fromValue); if (index == cardinality) { return fromValue == content.get(cardinality - 1) ? (fromValue) : -1; } return (content.get(index)); } }
MappeableArrayContainer extends MappeableContainer implements Cloneable { @Override public int nextValue(char fromValue) { int index = BufferUtil.advanceUntil(content, -1, cardinality, fromValue); if (index == cardinality) { return fromValue == content.get(cardinality - 1) ? (fromValue) : -1; } return (content.get(index)); } MappeableArrayContainer();  MappeableArrayContainer(ArrayContainer bc);  MappeableArrayContainer(final int capacity);  MappeableArrayContainer(final int firstOfRun, final int lastOfRun); private  MappeableArrayContainer(int newCard, CharBuffer newContent);  MappeableArrayContainer(final CharBuffer array, final int cardinality); }
MappeableArrayContainer extends MappeableContainer implements Cloneable { @Override public int nextValue(char fromValue) { int index = BufferUtil.advanceUntil(content, -1, cardinality, fromValue); if (index == cardinality) { return fromValue == content.get(cardinality - 1) ? (fromValue) : -1; } return (content.get(index)); } MappeableArrayContainer();  MappeableArrayContainer(ArrayContainer bc);  MappeableArrayContainer(final int capacity);  MappeableArrayContainer(final int firstOfRun, final int lastOfRun); private  MappeableArrayContainer(int newCard, CharBuffer newContent);  MappeableArrayContainer(final CharBuffer array, final int cardinality); static MappeableArrayContainer empty(); @Override MappeableContainer add(int begin, int end); @Override // not thread-safe MappeableContainer add(final char x); @Override boolean isEmpty(); @Override boolean isFull(); @Override MappeableArrayContainer and(final MappeableArrayContainer value2); @Override MappeableContainer and(MappeableBitmapContainer x); @Override MappeableContainer and(final MappeableRunContainer value2); @Override MappeableArrayContainer andNot(final MappeableArrayContainer value2); @Override MappeableArrayContainer andNot(MappeableBitmapContainer value2); @Override MappeableContainer andNot(final MappeableRunContainer x); @Override void clear(); @Override MappeableArrayContainer clone(); @Override boolean contains(final char x); static boolean contains(ByteBuffer buf, int position, final char x, int cardinality); @Override boolean equals(Object o); @Override void fillLeastSignificant16bits(int[] x, int i, int mask); @Override // not thread-safe MappeableContainer flip(char x); @Override int getCardinality(); @Override CharIterator getReverseCharIterator(); @Override PeekableCharIterator getCharIterator(); @Override ContainerBatchIterator getBatchIterator(); @Override int getSizeInBytes(); @Override int hashCode(); @Override // not thread-safe MappeableContainer iadd(int begin, int end); @Override MappeableArrayContainer iand(final MappeableArrayContainer value2); @Override MappeableContainer iand(MappeableBitmapContainer value2); @Override MappeableContainer iand(final MappeableRunContainer value2); @Override MappeableArrayContainer iandNot(final MappeableArrayContainer value2); @Override MappeableArrayContainer iandNot(MappeableBitmapContainer value2); @Override MappeableContainer iandNot(final MappeableRunContainer value2); @Override // not thread safe! (duh!) MappeableContainer inot(final int firstOfRange, final int lastOfRange); @Override boolean intersects(MappeableArrayContainer value2); @Override boolean intersects(MappeableBitmapContainer x); @Override boolean intersects(MappeableRunContainer x); @Override MappeableContainer ior(final MappeableArrayContainer value2); @Override MappeableContainer ior(MappeableBitmapContainer x); @Override MappeableContainer ior(final MappeableRunContainer value2); @Override MappeableContainer iremove(int begin, int end); @Override Iterator<Character> iterator(); @Override MappeableContainer ixor(final MappeableArrayContainer value2); @Override MappeableContainer ixor(MappeableBitmapContainer x); @Override MappeableContainer ixor(final MappeableRunContainer value2); @Override MappeableContainer limit(int maxcardinality); @Override MappeableContainer not(final int firstOfRange, final int lastOfRange); @Override MappeableContainer or(final MappeableArrayContainer value2); @Override MappeableContainer or(MappeableBitmapContainer x); @Override MappeableContainer or(final MappeableRunContainer value2); @Override int rank(char lowbits); @Override void readExternal(ObjectInput in); @Override MappeableContainer remove(int begin, int end); @Override MappeableContainer remove(final char x); @Override MappeableContainer repairAfterLazy(); @Override MappeableContainer runOptimize(); @Override char select(int j); @Override int serializedSizeInBytes(); @Override MappeableBitmapContainer toBitmapContainer(); @Override int first(); @Override int last(); @Override int nextValue(char fromValue); @Override int previousValue(char fromValue); @Override int nextAbsentValue(char fromValue); @Override int previousAbsentValue(char fromValue); @Override Container toContainer(); char[] toShortArray(); @Override String toString(); @Override void trim(); @Override void writeExternal(ObjectOutput out); @Override MappeableContainer xor(final MappeableArrayContainer value2); @Override MappeableContainer xor(MappeableBitmapContainer x); @Override MappeableContainer xor(final MappeableRunContainer value2); @Override void forEach(char msb, IntConsumer ic); @Override int andCardinality(MappeableArrayContainer value2); @Override int andCardinality(MappeableBitmapContainer x); @Override // see andNot for an approach that might be better. int andCardinality(MappeableRunContainer x); @Override boolean intersects(int minimum, int supremum); @Override boolean contains(int minimum, int supremum); }
MappeableArrayContainer extends MappeableContainer implements Cloneable { @Override public int nextValue(char fromValue) { int index = BufferUtil.advanceUntil(content, -1, cardinality, fromValue); if (index == cardinality) { return fromValue == content.get(cardinality - 1) ? (fromValue) : -1; } return (content.get(index)); } MappeableArrayContainer();  MappeableArrayContainer(ArrayContainer bc);  MappeableArrayContainer(final int capacity);  MappeableArrayContainer(final int firstOfRun, final int lastOfRun); private  MappeableArrayContainer(int newCard, CharBuffer newContent);  MappeableArrayContainer(final CharBuffer array, final int cardinality); static MappeableArrayContainer empty(); @Override MappeableContainer add(int begin, int end); @Override // not thread-safe MappeableContainer add(final char x); @Override boolean isEmpty(); @Override boolean isFull(); @Override MappeableArrayContainer and(final MappeableArrayContainer value2); @Override MappeableContainer and(MappeableBitmapContainer x); @Override MappeableContainer and(final MappeableRunContainer value2); @Override MappeableArrayContainer andNot(final MappeableArrayContainer value2); @Override MappeableArrayContainer andNot(MappeableBitmapContainer value2); @Override MappeableContainer andNot(final MappeableRunContainer x); @Override void clear(); @Override MappeableArrayContainer clone(); @Override boolean contains(final char x); static boolean contains(ByteBuffer buf, int position, final char x, int cardinality); @Override boolean equals(Object o); @Override void fillLeastSignificant16bits(int[] x, int i, int mask); @Override // not thread-safe MappeableContainer flip(char x); @Override int getCardinality(); @Override CharIterator getReverseCharIterator(); @Override PeekableCharIterator getCharIterator(); @Override ContainerBatchIterator getBatchIterator(); @Override int getSizeInBytes(); @Override int hashCode(); @Override // not thread-safe MappeableContainer iadd(int begin, int end); @Override MappeableArrayContainer iand(final MappeableArrayContainer value2); @Override MappeableContainer iand(MappeableBitmapContainer value2); @Override MappeableContainer iand(final MappeableRunContainer value2); @Override MappeableArrayContainer iandNot(final MappeableArrayContainer value2); @Override MappeableArrayContainer iandNot(MappeableBitmapContainer value2); @Override MappeableContainer iandNot(final MappeableRunContainer value2); @Override // not thread safe! (duh!) MappeableContainer inot(final int firstOfRange, final int lastOfRange); @Override boolean intersects(MappeableArrayContainer value2); @Override boolean intersects(MappeableBitmapContainer x); @Override boolean intersects(MappeableRunContainer x); @Override MappeableContainer ior(final MappeableArrayContainer value2); @Override MappeableContainer ior(MappeableBitmapContainer x); @Override MappeableContainer ior(final MappeableRunContainer value2); @Override MappeableContainer iremove(int begin, int end); @Override Iterator<Character> iterator(); @Override MappeableContainer ixor(final MappeableArrayContainer value2); @Override MappeableContainer ixor(MappeableBitmapContainer x); @Override MappeableContainer ixor(final MappeableRunContainer value2); @Override MappeableContainer limit(int maxcardinality); @Override MappeableContainer not(final int firstOfRange, final int lastOfRange); @Override MappeableContainer or(final MappeableArrayContainer value2); @Override MappeableContainer or(MappeableBitmapContainer x); @Override MappeableContainer or(final MappeableRunContainer value2); @Override int rank(char lowbits); @Override void readExternal(ObjectInput in); @Override MappeableContainer remove(int begin, int end); @Override MappeableContainer remove(final char x); @Override MappeableContainer repairAfterLazy(); @Override MappeableContainer runOptimize(); @Override char select(int j); @Override int serializedSizeInBytes(); @Override MappeableBitmapContainer toBitmapContainer(); @Override int first(); @Override int last(); @Override int nextValue(char fromValue); @Override int previousValue(char fromValue); @Override int nextAbsentValue(char fromValue); @Override int previousAbsentValue(char fromValue); @Override Container toContainer(); char[] toShortArray(); @Override String toString(); @Override void trim(); @Override void writeExternal(ObjectOutput out); @Override MappeableContainer xor(final MappeableArrayContainer value2); @Override MappeableContainer xor(MappeableBitmapContainer x); @Override MappeableContainer xor(final MappeableRunContainer value2); @Override void forEach(char msb, IntConsumer ic); @Override int andCardinality(MappeableArrayContainer value2); @Override int andCardinality(MappeableBitmapContainer x); @Override // see andNot for an approach that might be better. int andCardinality(MappeableRunContainer x); @Override boolean intersects(int minimum, int supremum); @Override boolean contains(int minimum, int supremum);  }