Module org.chocosolver
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 boolean
addAll(int... values)
Adds all of the elements in the array to this set.boolean
addAll(IntIterableSet set)
Adds all of the elements in the specified set to this set.IntIterableSet
duplicate()
Returns a carbon-copy of this setvoid
minus(int x)
subtract the value x to all integers stored in this setint
nextValue(int aValue)
int
nextValueOut(int aValue)
void
plus(int x)
add the value x to all integers stored in this setint
previousValue(int aValue)
int
previousValueOut(int aValue)
boolean
removeAll(IntIterableSet set)
Removes all of this set's elements that are also contained in the specified set.boolean
removeBetween(int f, int t)
Removes all values between f (inclusive) and t (inclusive)boolean
retainAll(IntIterableSet set)
Retains only the elements in this set that are contained in the specified set.void
setOffset(int offset)
Creates an IntIterable object relying on a bitset implementation.String
toString()
-
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:IntIterableSet
Adds all of the elements in the array to this set.- Specified by:
addAll
in interfaceIntIterableSet
- Parameters:
values
- array containing elements to be added to this set- Returns:
true
if this set changed as a result of the call
-
addAll
public boolean addAll(IntIterableSet set)
Description copied from interface:IntIterableSet
Adds all of the elements in the specified set to this set.- Specified by:
addAll
in interfaceIntIterableSet
- Parameters:
set
- set containing elements to be added to this set- Returns:
true
if this set changed as a result of the call
-
retainAll
public boolean retainAll(IntIterableSet set)
Description copied from interface:IntIterableSet
Retains 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:
retainAll
in 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:IntIterableSet
Removes 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:
removeAll
in 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:IntIterableSet
Removes all values between f (inclusive) and t (inclusive)- Specified by:
removeBetween
in 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:
nextValue
in interfaceIntIterableSet
- Parameters:
aValue
- (exclusive)- Returns:
- the value after 'aValue' or
Integer.MAX_VALUE
-
nextValueOut
public int nextValueOut(int aValue)
- Specified by:
nextValueOut
in interfaceIntIterableSet
- Parameters:
aValue
- (exclusive)- Returns:
- the value outside thisn after 'aValue'
-
previousValue
public int previousValue(int aValue)
- Specified by:
previousValue
in interfaceIntIterableSet
- Parameters:
aValue
- (exclusive)- Returns:
- the value before 'aValue' or or
Integer.MIN_VALUE
-
previousValueOut
public int previousValueOut(int aValue)
- Specified by:
previousValueOut
in interfaceIntIterableSet
- Parameters:
aValue
- (exclusive)- Returns:
- the value outside this, before'aValue'
-
toString
public String toString()
- Overrides:
toString
in classSet_BitSet
-
duplicate
public IntIterableSet duplicate()
Description copied from interface:IntIterableSet
Returns a carbon-copy of this set- Specified by:
duplicate
in interfaceIntIterableSet
- Returns:
- a carbon-copy of this set
-
plus
public void plus(int x)
Description copied from interface:IntIterableSet
add the value x to all integers stored in this set- Specified by:
plus
in interfaceIntIterableSet
- Parameters:
x
- value to add
-
minus
public void minus(int x)
Description copied from interface:IntIterableSet
subtract the value x to all integers stored in this set- Specified by:
minus
in interfaceIntIterableSet
- Parameters:
x
- value to add
-
-