Class ProductIterator<T>
- java.lang.Object
-
- ru.ispras.testbase.knowledge.iterator.ProductIterator<T>
-
- All Implemented Interfaces:
Iterator<java.util.List<T>>
public class ProductIterator<T> extends java.lang.Object implements Iterator<java.util.List<T>>
ProductIterator
implements a product iterator, a composite iterator that generates all possible combinations of items produced by simpler iterators.
-
-
Constructor Summary
Constructors Modifier Constructor Description ProductIterator()
Constructs a product iterator.protected
ProductIterator(ProductIterator<T> other)
Constructs a copy of the product iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes all registered iterators.ProductIterator<T>
clone()
Creates a copy of the iterator.boolean
hasValue()
Checks if the iterator is not exhausted (a value is available).void
init()
Initializes the iterator.Iterator<T>
iterator(int index)
Returns the i-th iterator of the list.void
next()
Makes an iteration.void
registerIterator(Iterator<T> iterator)
Registers the iterator.int
size()
Returns the number of the registered iterators.void
stop()
Stops the iterator.java.util.List<T>
value()
Returns the current value of the iterator.T
value(int index)
Returns the value of the i-th iterator.
-
-
-
Constructor Detail
-
ProductIterator
public ProductIterator()
Constructs a product iterator.
-
ProductIterator
protected ProductIterator(ProductIterator<T> other)
Constructs a copy of the product iterator.- Parameters:
other
- the iterator to be copied.
-
-
Method Detail
-
registerIterator
public void registerIterator(Iterator<T> iterator)
Registers the iterator.- Parameters:
iterator
- the iterator to be registered.
-
clear
public void clear()
Removes all registered iterators.
-
size
public int size()
Returns the number of the registered iterators.- Returns:
- the number of the registered iterators.
-
iterator
public Iterator<T> iterator(int index)
Returns the i-th iterator of the list.- Parameters:
index
- the iterator index.- Returns:
- the i-th iterator of the list.
-
init
public void init()
Description copied from interface:Iterator
Initializes the iterator.
-
hasValue
public boolean hasValue()
Description copied from interface:Iterator
Checks if the iterator is not exhausted (a value is available).
-
value
public T value(int index)
Returns the value of the i-th iterator.- Parameters:
index
- the iterator index.- Returns:
- the value of the i-th iterator.
-
value
public java.util.List<T> value()
Description copied from interface:Iterator
Returns the current value of the iterator.
-
next
public void next()
Description copied from interface:Iterator
Makes an iteration.
-
stop
public void stop()
Description copied from interface:Iterator
Stops the iterator.
-
-