Class RandomTextGenerartor
java.lang.Object
org.refcodes.textual.RandomTextGenerartor
- All Implemented Interfaces:
Iterator<String>, Generator<String>, CharSetAccessor, CharSetAccessor.CharSetBuilder<RandomTextGenerartor>, CharSetAccessor.CharSetMutator, CharSetAccessor.CharSetProperty, ColumnWidthAccessor, ColumnWidthAccessor.ColumnWidthBuilder<RandomTextGenerartor>, ColumnWidthAccessor.ColumnWidthMutator, ColumnWidthAccessor.ColumnWidthProperty
public class RandomTextGenerartor
extends Object
implements ColumnWidthAccessor.ColumnWidthBuilder<RandomTextGenerartor>, ColumnWidthAccessor.ColumnWidthProperty, Generator<String>, CharSetAccessor.CharSetProperty, CharSetAccessor.CharSetBuilder<RandomTextGenerartor>
Generates random text according to the
RandomTextMode property and
other settings.-
Nested Class Summary
Nested classes/interfaces inherited from interface CharSetAccessor
CharSetAccessor.CharSetBuilder<B>, CharSetAccessor.CharSetMutator, CharSetAccessor.CharSetPropertyNested classes/interfaces inherited from interface ColumnWidthAccessor
ColumnWidthAccessor.ColumnWidthBuilder<B>, ColumnWidthAccessor.ColumnWidthMutator, ColumnWidthAccessor.ColumnWidthProperty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasRandom(int aColumnWidth, char... aCharSet) Creates a random text from the given parameters.static StringasShuffled(char... aCharSet) Shuffles the provided characters to generate a text with the length of the number of provided characters containing each provided character though in a random order.static StringasShuffled(String aCharSet) Shuffles the provided characters to generate a text with the length of the number of provided characters containing each provided character though in a random order.static StringasString(int aColumnWidth) Creates a random text with the given length consisting of the characters found inRandomTextMode.ALPHANUMERIC.static StringasString(int aColumnWidth, RandomTextMode aRandomTextMode) Creates a random text from the given parameters.char[]intRetrieves the random text mode from the random text mode property.booleanhasNext()next()voidsetCharSet(char[] aCharSet) voidsetColumnWidth(int aColumnWidth) voidsetRandomTextMode(RandomTextMode aRandomTextMode) Sets the random text mode for the random text mode property.withCharSet(char[] aCharSet) withColumnWidth(int aColumnWidth) withRandomTextMode(RandomTextMode aRandomTextMode) Sets the random text mode for the random text mode property.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CharSetAccessor.CharSetProperty
letCharSetMethods inherited from interface ColumnWidthAccessor.ColumnWidthProperty
letColumnWidthMethods inherited from interface Iterator
forEachRemaining, remove
-
Constructor Details
-
RandomTextGenerartor
public RandomTextGenerartor()
-
-
Method Details
-
withColumnWidth
- Specified by:
withColumnWidthin interfaceColumnWidthAccessor.ColumnWidthBuilder<RandomTextGenerartor>
-
setColumnWidth
public void setColumnWidth(int aColumnWidth) - Specified by:
setColumnWidthin interfaceColumnWidthAccessor.ColumnWidthMutator
-
getColumnWidth
public int getColumnWidth()- Specified by:
getColumnWidthin interfaceColumnWidthAccessor
-
hasNext
-
next
-
getRandomTextMode
Retrieves the random text mode from the random text mode property.- Returns:
- The random text mode stored by the random text mode property.
-
setRandomTextMode
Sets the random text mode for the random text mode property.- Parameters:
aRandomTextMode- The random text mode to be stored by the random text mode property.
-
getCharSet
public char[] getCharSet()- Specified by:
getCharSetin interfaceCharSetAccessor
-
setCharSet
public void setCharSet(char[] aCharSet) - Specified by:
setCharSetin interfaceCharSetAccessor.CharSetMutator
-
withCharSet
- Specified by:
withCharSetin interfaceCharSetAccessor.CharSetBuilder<RandomTextGenerartor>
-
withRandomTextMode
Sets the random text mode for the random text mode property.- Parameters:
aRandomTextMode- The random text mode to be stored by the random text mode property.- Returns:
- The builder for applying multiple build operations.
-
asString
Creates a random text from the given parameters.- Parameters:
aColumnWidth- The length of the text to generate.aRandomTextMode- The chars to use for the random text.- Returns:
- The accordingly created random text.
-
asString
Creates a random text with the given length consisting of the characters found inRandomTextMode.ALPHANUMERIC.- Parameters:
aColumnWidth- The length of the text to generate.- Returns:
- The accordingly created random text.
-
asRandom
Creates a random text from the given parameters.- Parameters:
aColumnWidth- The length of the text to generate.aCharSet- The chars to use for the random text.- Returns:
- The accordingly created random text.
-
asShuffled
Shuffles the provided characters to generate a text with the length of the number of provided characters containing each provided character though in a random order.- Parameters:
aCharSet- The chars to use for the shuffled text.- Returns:
- The accordingly shuffled random text.
-
asShuffled
Shuffles the provided characters to generate a text with the length of the number of provided characters containing each provided character though in a random order.- Parameters:
aCharSet- The chars to use for the shuffled text.- Returns:
- The accordingly shuffled random text.
-