public class SubsetSolutionIterator extends Object implements SolutionIterator<SubsetSolution>
A SubsetIterator is used internally and selected items are wrapped in a subset solution.
| Constructor and Description |
|---|
SubsetSolutionIterator(Set<Integer> IDs,
int fixedSubsetSize)
Create a subset solution iterator that generates all subsets with a fixed size,
sampled from the given set of IDs.
|
SubsetSolutionIterator(Set<Integer> IDs,
int minSubsetSize,
int maxSubsetSize)
Create a subset solution iterator that generates all subsets within the given size range,
sampled from the given set of IDs.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Checks whether more subset solutions are to be generated.
|
SubsetSolution |
next()
Generate the next subset solution.
|
public SubsetSolutionIterator(Set<Integer> IDs, int minSubsetSize, int maxSubsetSize)
IDs - set of IDs to select fromminSubsetSize - minimum subset sizemaxSubsetSize - maximum subset sizeNullPointerException - if IDs is nullIllegalArgumentException - if IDs is empty,
minSubsetSize < 0,
minSubsetSize > |IDs|,
or minSubsetSize > maxSubsetSizepublic SubsetSolutionIterator(Set<Integer> IDs, int fixedSubsetSize)
IDs - set of IDs to select fromfixedSubsetSize - fixed subset sizeNullPointerException - if IDs is nullIllegalArgumentException - if IDs is empty,
fixedSubsetSize < 0,
or fixedSubsetSize > |IDs|public boolean hasNext()
hasNext in interface SolutionIterator<SubsetSolution>true if not all possible subsets of all valid size have already been generatedpublic SubsetSolution next()
next in interface SolutionIterator<SubsetSolution>NoSuchElementException - if there is no next solution to be generatedCopyright © 2016. All rights reserved.