Package org.chocosolver.util.iterators
Class DisposableValueBoundIterator
- 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 voidbottomUpInit()Prepare iteration from smallest value to highest value (usingValueIterator.hasNext()/ValueIterator.next())booleanhasNext()Returns true if the iteration has more values.booleanhasPrevious()Returns true if the iteration has more ranges.intnext()Compute and return the next value.intprevious()Compute and return the previous value.voidtopDownInit()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:ValueIteratorPrepare 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:
bottomUpInitin interfaceValueIterator- Overrides:
bottomUpInitin classDisposableValueIterator
-
topDownInit
public void topDownInit()
Description copied from interface:ValueIteratorPrepare 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:
topDownInitin interfaceValueIterator- Overrides:
topDownInitin classDisposableValueIterator
-
hasNext
public boolean hasNext()
Description copied from interface:ValueIteratorReturns 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:ValueIteratorReturns 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:ValueIteratorCompute 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:ValueIteratorCompute 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.
-
-