|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.cage.token.RandomCharacterGeneratorFactory
public class RandomCharacterGeneratorFactory
Factory that can generate Character generating IGenerators.
| Nested Class Summary | |
|---|---|
class |
RandomCharacterGeneratorFactory.RandomCharacterGenerator
Generates characters based on the settings of the factory. |
| Field Summary | |
|---|---|
static char[] |
ARABIC_NUMERALS
Arabic numeral character array. |
static char[] |
DEFAULT_DEFAULT_CHARACTER_SET
Default character set for the default case. |
static Map<Character,char[]> |
DEFAULT_SPECIAL_CHARACTER_SETS
Special character sets for the default case. |
static char[] |
ENGLISH_CONSONANTS
English lower cased consonant character array. |
static char[] |
ENGLISH_VOWELS
English lower cased vowel character array. |
| Constructor Summary | |
|---|---|
RandomCharacterGeneratorFactory()
Constructor. |
|
RandomCharacterGeneratorFactory(char[] defaultCharacterSet,
Map<Character,char[]> specialCharacterSets,
Random rnd)
Constructor. |
|
RandomCharacterGeneratorFactory(Random rnd)
Constructor. |
|
| Method Summary | |
|---|---|
protected static Map<Character,char[]> |
createDefaultSpecialCharacterSets()
Helper function to build DEFAULT_SPECIAL_CHARACTER_SETS. |
char[] |
getDefaultCharacterSet()
|
Map<Character,char[]> |
getSpecialCharacterSets()
|
IGenerator<Character> |
next()
Returns an object with type T on every call. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char[] ENGLISH_VOWELS
public static final char[] ENGLISH_CONSONANTS
public static final char[] ARABIC_NUMERALS
public static final char[] DEFAULT_DEFAULT_CHARACTER_SET
public static final Map<Character,char[]> DEFAULT_SPECIAL_CHARACTER_SETS
| Constructor Detail |
|---|
public RandomCharacterGeneratorFactory()
public RandomCharacterGeneratorFactory(Random rnd)
rnd - used to generate random numbers. Can be null.
public RandomCharacterGeneratorFactory(char[] defaultCharacterSet,
Map<Character,char[]> specialCharacterSets,
Random rnd)
defaultCharacterSet - used generally for character choosing, can be null.specialCharacterSets - map contains special cases. A (k, v) pair in this map means
that character k can only be immediately followed by a
character in v array. No value should be empty or null. The
map parameter itself can be null.rnd - used to generate random numbers. Can be null.| Method Detail |
|---|
protected static Map<Character,char[]> createDefaultSpecialCharacterSets()
DEFAULT_SPECIAL_CHARACTER_SETS. It
contains some rules to avoid confusing character pairs. Also makes sure
that vowels and consonants follow each other in an alternating fashion.
public IGenerator<Character> next()
IGeneratorT on every call. The returned
object does not have to be a new instance.
next in interface IGenerator<IGenerator<Character>>public char[] getDefaultCharacterSet()
public Map<Character,char[]> getSpecialCharacterSets()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||