class AnalysisManager.AlphabetSequenceGenerator extends com.google.common.collect.AbstractIterator<String>
AbstractIterator
.
For every call to the computeNext()
method, the object
of this class return the next alphabet element of an infinite list
of elements in alphabet order.
The list is defined infinite because every of its elements can be composed by an infinite number of characters, not just one. Therefore when the generator reaches the last element in alphabet order of a list of one character(i.e "a,b,c,...,z"), it starts again using this time two characters instead of one (i.e "aa,ab,ac,...,az"), moving both the second character as the first one, when the second reaches the end of possible alphabet values, and so on with four, five, etc.
Modifier and Type | Field and Description |
---|---|
private int |
now
The position in the list of the last element generated
|
private String |
prefix
The prefix used for the last element generated
|
private char[] |
vs
The list of all the possible characters that the generator can use for the sequence
|
Constructor and Description |
---|
AlphabetSequenceGenerator()
Constructs an
AlphabetSequenceGenerator ready to be used. |
Modifier and Type | Method and Description |
---|---|
protected String |
computeNext()
Generates the next element in alphabet order of an infinite
list of elements, starting from "a" and using infinite characters for
defining a single element (i.e. elements go from a single character
composition, "a" for example, to an infinite one, "cdf" for example
using three characters).
|
private String |
fixPrefix(String prefix)
Generates the prefix basing of the one that we were using for
the preceding element.
|
endOfData, hasNext, next, peek
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
private int now
private String prefix
private char[] vs
public AlphabetSequenceGenerator()
AlphabetSequenceGenerator
ready to be used.private String fixPrefix(String prefix)
prefix
- the prefix used for the last element generatedprotected String computeNext()
computeNext
in class com.google.common.collect.AbstractIterator<String>