Class IntIterableBitSet
- java.lang.Object
-
- org.chocosolver.util.objects.setDataStructures.bitset.Set_BitSet
-
- org.chocosolver.util.objects.setDataStructures.iterable.IntIterableBitSet
-
- All Implemented Interfaces:
Iterable<Integer>,ISet,IntIterableSet
public class IntIterableBitSet extends Set_BitSet implements IntIterableSet
An IntIterableBitSet based on a BitSet Created by cprudhom on 09/07/15. Project: choco.- Author:
- Charles Prud'homme
-
-
Field Summary
-
Fields inherited from class org.chocosolver.util.objects.setDataStructures.bitset.Set_BitSet
card, offset, values
-
-
Constructor Summary
Constructors Constructor Description IntIterableBitSet()Creates an IntIterable object relying on an offseted bitset implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAll(int... values)Adds all of the elements in the array to this set.booleanaddAll(IntIterableSet set)Adds all of the elements in the specified set to this set.IntIterableSetduplicate()Returns a carbon-copy of this setvoidminus(int x)subtract the value x to all integers stored in this setintnextValue(int aValue)voidplus(int x)add the value x to all integers stored in this setintpreviousValue(int aValue)booleanremoveAll(IntIterableSet set)Removes all of this set's elements that are also contained in the specified set.booleanremoveBetween(int f, int t)Removes all values between f (inclusive) and t (inclusive)booleanretainAll(IntIterableSet set)Retains only the elements in this set that are contained in the specified set.voidsetOffset(int offset)Creates an IntIterable object relying on a bitset implementation.StringtoString()-
Methods inherited from class org.chocosolver.util.objects.setDataStructures.bitset.Set_BitSet
add, clear, contains, getSetType, iterator, max, min, newIterator, remove, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.chocosolver.util.objects.setDataStructures.ISet
add, clear, contains, getSetType, isEmpty, iterator, max, min, newIterator, remove, size, toArray
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
setOffset
public void setOffset(int offset)
Creates an IntIterable object relying on a bitset implementation. For memory consumption purpose, an offset is needed to indicate the lowest value stored in this set.- Parameters:
offset- lowest value to be stored in this set
-
addAll
public boolean addAll(int... values)
Description copied from interface:IntIterableSetAdds all of the elements in the array to this set.- Specified by:
addAllin interfaceIntIterableSet- Parameters:
values- array containing elements to be added to this set- Returns:
trueif this set changed as a result of the call
-
addAll
public boolean addAll(IntIterableSet set)
Description copied from interface:IntIterableSetAdds all of the elements in the specified set to this set.- Specified by:
addAllin interfaceIntIterableSet- Parameters:
set- set containing elements to be added to this set- Returns:
trueif this set changed as a result of the call
-
retainAll
public boolean retainAll(IntIterableSet set)
Description copied from interface:IntIterableSetRetains only the elements in this set that are contained in the specified set. In other words, removes from this set all of its elements that are not contained in the specified set.- Specified by:
retainAllin interfaceIntIterableSet- Parameters:
set- set containing elements to be retained in this set- Returns:
- true if this set changed as a result of the call
-
removeAll
public boolean removeAll(IntIterableSet set)
Description copied from interface:IntIterableSetRemoves all of this set's elements that are also contained in the specified set. After this call returns, this set will contain no elements in common with the specified set.- Specified by:
removeAllin interfaceIntIterableSet- Parameters:
set- set containing elements to be removed from this set- Returns:
- true if this set changed as a result of the call
-
removeBetween
public boolean removeBetween(int f, int t)Description copied from interface:IntIterableSetRemoves all values between f (inclusive) and t (inclusive)- Specified by:
removeBetweenin interfaceIntIterableSet- Parameters:
f- first value to removet- last value to remove- Returns:
- true if this set changed as a result of the call
-
nextValue
public int nextValue(int aValue)
- Specified by:
nextValuein interfaceIntIterableSet- Parameters:
aValue- (exclusive)- Returns:
- the value after aValue
-
previousValue
public int previousValue(int aValue)
- Specified by:
previousValuein interfaceIntIterableSet- Parameters:
aValue- (exclusive)- Returns:
- the value before aValue
-
toString
public String toString()
- Overrides:
toStringin classSet_BitSet
-
duplicate
public IntIterableSet duplicate()
Description copied from interface:IntIterableSetReturns a carbon-copy of this set- Specified by:
duplicatein interfaceIntIterableSet- Returns:
- a carbon-copy of this set
-
plus
public void plus(int x)
Description copied from interface:IntIterableSetadd the value x to all integers stored in this set- Specified by:
plusin interfaceIntIterableSet- Parameters:
x- value to add
-
minus
public void minus(int x)
Description copied from interface:IntIterableSetsubtract the value x to all integers stored in this set- Specified by:
minusin interfaceIntIterableSet- Parameters:
x- value to add
-
-