- java.lang.Object
-
- org.chocosolver.util.objects.StoredIndexedBipartiteSet
-
- Direct Known Subclasses:
StoredIndexedBipartiteSetWithOffset
public class StoredIndexedBipartiteSet extends Object
A stored list dedicated to positive integers and three operations : - iteration - removal of an element - check if an element is or not within the list It only requires a StoredInt to denote the first element of the list and proceeds by swapping element with the first one to remove them and incrementing the index of the first element. IT DOES NOT PRESERVE THE ORDER OF THE LIST
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
StoredIndexedBipartiteSet.BipartiteSetIterator
-
Field Summary
Fields Modifier and Type Field Description protected StoredIndexedBipartiteSet.BipartiteSetIterator
_cachedIterator
protected IndexedObject[]
idxToObjects
If objects are added to the list, a mapping from their indexes is needed.protected IStateInt
last
The first element of the listprotected int[]
list
The list of valuesprotected int[]
position
The position of each element within the list.
-
Constructor Summary
Constructors Constructor Description StoredIndexedBipartiteSet(IEnvironment environment, int[] values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
_getStructure()
DO NOT USE : FOR MEMORY OPTIM ONLYvoid
buildList(IEnvironment environment, int[] values)
boolean
contains(int object)
DisposableIntIterator
getIterator()
boolean
isEmpty()
String
pretty()
void
remove(int object)
int
size()
-
-
-
Field Detail
-
list
protected int[] list
The list of values
-
position
protected int[] position
The position of each element within the list. indexes[3] = k <=> list[k] = 3 we assume that elements ranges from 0 ... list.lenght in other words the elements must be indexed.
-
idxToObjects
protected IndexedObject[] idxToObjects
If objects are added to the list, a mapping from their indexes is needed. idxToObjects[i] = o <=> o.getObjectIdx() == i
-
last
protected IStateInt last
The first element of the list
-
_cachedIterator
protected StoredIndexedBipartiteSet.BipartiteSetIterator _cachedIterator
-
-
Constructor Detail
-
StoredIndexedBipartiteSet
public StoredIndexedBipartiteSet(IEnvironment environment, int[] values)
- Parameters:
environment
- the environmentvalues
- a set of DIFFERENT positive integer values !
-
-
Method Detail
-
buildList
public void buildList(IEnvironment environment, int[] values)
-
size
public final int size()
-
isEmpty
public final boolean isEmpty()
-
remove
public void remove(int object)
-
contains
public boolean contains(int object)
-
getIterator
public final DisposableIntIterator getIterator()
-
pretty
public final String pretty()
-
_getStructure
public final int[] _getStructure()
DO NOT USE : FOR MEMORY OPTIM ONLY
-
-