Module org.chocosolver.solver
Class Set_FixedArray
- java.lang.Object
-
- org.chocosolver.util.objects.setDataStructures.constant.Set_FixedArray
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.chocosolver.util.objects.setDataStructures.ISet
ISet.WithOffset
-
-
Field Summary
Fields Modifier and Type Field Description protected ISetIterator
iter
protected int
size
protected int[]
values
-
Constructor Summary
Constructors Constructor Description Set_FixedArray(int[] vls)
Creates an empty array of integers
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(int element)
Add element to the setvoid
clear()
Remove all elements from the setboolean
contains(int element)
Test the existence of element in the setSetType
getSetType()
ISetIterator
iterator()
Use the following loop to iterate over this set without autoboxing.int
max()
int
min()
ISetIterator
newIterator()
Creates a new iterator object, for nested loops only.void
registerObserver(ISet set, int idx)
Register an observer to this set.boolean
remove(int element)
Remove the first occurrence of element from the setint
size()
String
toString()
-
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
isEmpty, notifyCleared, notifyElementAdded, notifyElementRemoved, toArray
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
size
protected final int size
-
values
protected final int[] values
-
iter
protected ISetIterator iter
-
-
Method Detail
-
add
public boolean add(int element)
Description copied from interface:ISet
Add element to the set
-
remove
public boolean remove(int element)
Description copied from interface:ISet
Remove the first occurrence of element from the set
-
contains
public boolean contains(int element)
Description copied from interface:ISet
Test the existence of element in the set
-
size
public int size()
-
clear
public void clear()
Description copied from interface:ISet
Remove all elements from the set
-
getSetType
public SetType getSetType()
- Specified by:
getSetType
in interfaceISet
- Returns:
- the implementation type of this set
-
registerObserver
public void registerObserver(ISet set, int idx)
Description copied from interface:ISet
Register an observer to this set. Observers are dynamic set data structures whose value depends on observed sets. This method must be called by observers' constructors.- Specified by:
registerObserver
in interfaceISet
- Parameters:
set
- The observer to registeridx
- This index of this set in the observing set.
-
min
public int min()
-
max
public int max()
-
iterator
public ISetIterator iterator()
Description copied from interface:ISet
Use the following loop to iterate over this set without autoboxing.// more readable but with autoboxing for(int value:set){ ... } // more verbose but without autoboxing ISetIterator iter = set.primitiveIterator(); while(iter.hasNext()){ int k = iter.next(); ... }
Do not use this iterator to make nested loops overISet
(preferISet.newIterator()
)
-
newIterator
public ISetIterator newIterator()
Description copied from interface:ISet
Creates a new iterator object, for nested loops only.- Specified by:
newIterator
in interfaceISet
- Returns:
- a new iterator for this set
-
-