java.lang.Object
org.refcodes.generator.AlphabetCounterMetrics
org.refcodes.generator.AlphabetCounter
- All Implemented Interfaces:
Iterator<String>
,Counter<String>
,Generator<String>
,IdCounter
,IdGenerator
,org.refcodes.mixin.Resetable
The
AlphabetCounter
generates values by counting with an an alphabet
of "digits", a decimal alphabet would contain the characters "0", "1", "2",
"3", "4", "5", "6", "7", "8" and "9", a hexadecimal alphabet would contain
the characters "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B",
"C", "D", "E", "F".-
Field Summary
Fields inherited from class org.refcodes.generator.AlphabetCounterMetrics
_alphabet, _alphabetExpression, _maxLength, _minLength, _startValue, _words, _wordsFiles, _wordsStreams
-
Constructor Summary
ConstructorDescriptionAlphabetCounter
(char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, int aMaxLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, int aMaxLength, Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, int aMaxLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(int aMinLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(File... aWordsFiles) Constructs anAlphabetCounter
using the given wordsFile
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.AlphabetCounter
(InputStream... aWordsStreams) Constructs anAlphabetCounter
using the given wordsInputStream
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.AlphabetCounter
(String aExpression) Constructs anAlphabetCounter
by parsing the given expression to construct the alphabet from the according expression's attributes.AlphabetCounter
(String... aWords) Constructs anAlphabetCounter
using the given words which to provide one by one after all words have been processed..AlphabetCounter
(String aStartValue, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, int aMinLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, int aMinLength, int aMaxLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, int aMinLength, int aMaxLength, Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, int aMinLength, int aMaxLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, File... aWordsFiles) Constructs anAlphabetCounter
using the given wordsFile
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.AlphabetCounter
(String aStartValue, InputStream... aWordsStreams) Constructs anAlphabetCounter
using the given wordsInputStream
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.AlphabetCounter
(String aStartValue, String... aWords) Constructs anAlphabetCounter
using the given words which to provide one by one after all words have been processed..AlphabetCounter
(String aStartValue, Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, Collection<Character> aAlphabet, int aMinLength) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(String aStartValue, org.refcodes.data.CharSet aAlphabet, int aMinLength) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.AlphabetCounter
(AlphabetCounterMetrics aAlphabetCounterMetrics) Constructs anAlphabetCounter
using the givenAlphabetCounterMetrics
. -
Method Summary
Modifier and TypeMethodDescriptionchar[]
Returns the alphabet used by this counter.boolean
hasNext()
Tests whether theGenerator
is capable of generating aGenerator.next()
item.next()
Generates a next item.void
reset()
Provides the alphabet expressions as of the state of thisAlphabetCounter
instance.toString()
Methods inherited from class org.refcodes.generator.AlphabetCounterMetrics
getMaxLength, getMinLength, getStartValue, getWords, getWordsFiles, getWordsStreams, parseAlphabetExpression, toAlphabetExpression, toAlphabetExpression, toAlphabetExpression, toAlphabetExpression
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
AlphabetCounter
Constructs anAlphabetCounter
using the given wordsFile
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.- Parameters:
aWordsFiles
- the words files- Throws:
IOException
- if an I/O error occurs while retrieving theFileDescriptor
.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given wordsFile
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.- Parameters:
aStartValue
- The value from which to start (to be contained in one of the provided wordFile
lists).aWordsFiles
- the words files- Throws:
IOException
- if an I/O error occurs when accessing the wordFile
lists.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given wordsInputStream
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.- Parameters:
aWordsStreams
- The wordsInputStream
lists representing the alphabet counter through which to iterate.- Throws:
IOException
- if an I/O error occurs while retrieving theFileDescriptor
.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given wordsInputStream
elements to provide one by one (one word per line) contained in each file subsequently till all words have been processed, therewith representing the alphabet counter through which to iterate.- Parameters:
aStartValue
- The value from which to start (to be contained in one of the provided wordFile
lists).aWordsStreams
- The wordsInputStream
lists representing the alphabet counter through which to iterate.- Throws:
IOException
- if an I/O error occurs while retrieving theFileDescriptor
.
-
AlphabetCounter
Constructs anAlphabetCounter
by parsing the given expression to construct the alphabet from the according expression's attributes.- Parameters:
aExpression
- The expression to be parsed (duplicate definitions of characters are ignored).- Throws:
ParseException
- thrown in case parsing the expression failed.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given words which to provide one by one after all words have been processed..- Parameters:
aWords
- The words through which to iterate.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given words which to provide one by one after all words have been processed..- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aWords
- The words through which to iterate.
-
AlphabetCounter
public AlphabetCounter(char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(int aMinLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(int aMinLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(int aMinLength, int aMaxLength, char... aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(int aMinLength, int aMaxLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(String aStartValue, int aMinLength, int aMaxLength, Collection<Character> aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
public AlphabetCounter(String aStartValue, int aMinLength, int aMaxLength, org.refcodes.data.CharSet aAlphabet) Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
AlphabetCounter
Constructs anAlphabetCounter
using the givenAlphabetCounterMetrics
.- Parameters:
aAlphabetCounterMetrics
- TheAlphabetCounterMetrics
to use (alphabet, min length, max length).
-
AlphabetCounter
Constructs anAlphabetCounter
using the given attributes.- Parameters:
aStartValue
- The value from which to start (must only consist of characters found in the alphabet).aMinLength
- The minimum length of the counter value to be produced, the counter value will be filled up with the first character of the alphabet from left to right if it is shorter than the minimum length.aMaxLength
- The maximum length of the counter value to be produced, thehasNext()
method will return true till the maximum length is exceed.aAlphabet
- The alphabet to use for counting, a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9".
-
-
Method Details
-
hasNext
public boolean hasNext()Tests whether theGenerator
is capable of generating aGenerator.next()
item. -
next
Generates a next item. -
getAlphabet
public char[] getAlphabet()Returns the alphabet used by this counter.- Overrides:
getAlphabet
in classAlphabetCounterMetrics
- Returns:
- The according alphabet in use.
-
reset
public void reset()- Specified by:
reset
in interfaceorg.refcodes.mixin.Resetable
-
toAlphabetExpression
Provides the alphabet expressions as of the state of thisAlphabetCounter
instance.- Overrides:
toAlphabetExpression
in classAlphabetCounterMetrics
- Returns:
- The according alphabet expression.
-
toString
- Overrides:
toString
in classAlphabetCounterMetrics
-