javax.constraints
Interface SolutionIterator

All Known Implementing Classes:
BasicSolutionIterator

public interface SolutionIterator

This is an interface that allows a user to search and to iterate through multiple solutions. The expected use:

 SolutionIterator iter = solver.solutionIterator();
 while(iter.hasNext()) {
   Solution solution = iter.next();
     ...
 }
 
 The method next() should not be called without checking that hasNext() returned true.

 


Method Summary
 boolean hasNext()
          Returns true if the iteration has more solutions.
 Solution next()
          Returns the next solution
 

Method Detail

hasNext

boolean hasNext()
Returns true if the iteration has more solutions. In other words, returns true if next would return an element rather than throwing an exception.

Returns:
true if the iteration has more solutions

next

Solution next()
Returns the next solution

Returns:
the next solution
Throws:
java.lang.RuntimeException - "Cannot use SolutionIterator.next() before checking that hasNext() returned true"