- java.lang.Object
-
- org.chocosolver.util.iterators.Disposable
-
- org.chocosolver.util.iterators.DisposableValueIterator
-
- org.chocosolver.util.iterators.DisposableValueBoundIterator
-
- All Implemented Interfaces:
ValueIterator
public class DisposableValueBoundIterator extends DisposableValueIterator
- Since:
- 05/10/11
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description DisposableValueBoundIterator(IntVar var)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bottomUpInit()
Prepare iteration from smallest value to highest value (usingValueIterator.hasNext()
/ValueIterator.next()
)boolean
hasNext()
Returns true if the iteration has more values.boolean
hasPrevious()
Returns true if the iteration has more ranges.int
next()
Compute and return the next value.int
previous()
Compute and return the previous value.void
topDownInit()
Prepare iteration from highest value to smallest value (usingValueIterator.hasPrevious()
/ValueIterator.previous()
)-
Methods inherited from class org.chocosolver.util.iterators.Disposable
dispose, init, isNotReusable, remove
-
-
-
-
Constructor Detail
-
DisposableValueBoundIterator
public DisposableValueBoundIterator(IntVar var)
-
-
Method Detail
-
bottomUpInit
public void bottomUpInit()
Description copied from interface:ValueIterator
Prepare iteration from smallest value to highest value (usingValueIterator.hasNext()
/ValueIterator.next()
)ValueIterator vit = ...; vit.bottomUpInit(); while(vit.hasNext()){ int v = vit.next(); // operate on value v here }
OR- Specified by:
bottomUpInit
in interfaceValueIterator
- Overrides:
bottomUpInit
in classDisposableValueIterator
-
topDownInit
public void topDownInit()
Description copied from interface:ValueIterator
Prepare iteration from highest value to smallest value (usingValueIterator.hasPrevious()
/ValueIterator.previous()
)ValueIterator vit = ...; vit.topDownInit(); while(vit.hasPrevious()){ int v = vit.previous(); // operate on value v here }
- Specified by:
topDownInit
in interfaceValueIterator
- Overrides:
topDownInit
in classDisposableValueIterator
-
hasNext
public boolean hasNext()
Description copied from interface:ValueIterator
Returns true if the iteration has more values. (In other words, returns true if next would return valid value.)ValueIterator vit = ...; vit.bottomUpInit(); while(vit.hasNext()){ int v = vit.next(); // operate on value v here }
OR- Returns:
- true if the getIterator has more values.
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:ValueIterator
Returns true if the iteration has more ranges. (In other words, returns true if previous would return a valid value.)ValueIterator vit = ...; vit.topDownInit(); while(vit.hasPrevious()){ int v = vit.previous(); // operate on value v here }
- Returns:
- true if the getIterator has more values.
-
next
public int next()
Description copied from interface:ValueIterator
Compute and return the next value.ValueIterator vit = ...; vit.bottomUpInit(); while(vit.hasNext()){ int v = vit.next(); // operate on value v here }
OR- Returns:
- the next element in the iteration.
-
previous
public int previous()
Description copied from interface:ValueIterator
Compute and return the previous value.ValueIterator vit = ...; vit.topDownInit(); while(vit.hasPrevious()){ int v = vit.previous(); // operate on value v here }
- Returns:
- the previous element in the iteration.
-
-