|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinf.util.TupleEnumerator<E>
E
- the element type of the domainpublic class TupleEnumerator<E>
This class can be used to enumerate all possible tuples of a given length n over a given domain D. The domain must be specified as an array of elements of the parameter type of this class. The tuples are also returned as arrays, where each tuple is an element of Dn. Note that the same array will be reused to enumerate all tuples and a copy must be taken if the values need to be retained. Altogether there will be |D|n tuples.
Constructor Summary | |
---|---|
TupleEnumerator(E[] domain,
int length)
This constructor creates a new TupleEnumerator for the given domain values in the given array, where each returned tuple has the given length. |
Method Summary | |
---|---|
protected java.lang.Object |
clone()
This class does not support cloning and an Exception will be thrown if this method is called. |
int |
firstChanged()
This function can be called after a tuple has been obtained from this TupleEnumerator. |
boolean |
hasNext()
Tests whether there are more tuples to be enumerated. |
E[] |
next()
This function returns the next tuple. |
void |
remove()
This function is not supported and causes an Exception. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TupleEnumerator(E[] domain, int length)
This constructor creates a new TupleEnumerator for the given domain values in the given array, where each returned tuple has the given length.
domain
- the possible values for the components of the tupleslength
- the length of the expected tuplesMethod Detail |
---|
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
This class does not support cloning and an Exception will be thrown if this method is called.
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- will be thrownpublic boolean hasNext()
Tests whether there are more tuples to be enumerated.
hasNext
in interface java.util.Iterator<E[]>
public E[] next()
This function returns the next tuple. Note that all tuples use the same array and thus the previous tuple is not available after a call to this function.
next
in interface java.util.Iterator<E[]>
public void remove()
This function is not supported and causes an Exception.
remove
in interface java.util.Iterator<E[]>
public int firstChanged()
This function can be called after a tuple has been obtained from this TupleEnumerator. The new tuple will differ from the previous tuple in array positions from the returned value to the end of the array. Array positions before the returned value remain unchanged. For the first tuple the returned value will be 0, indicating that all values have changed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |