public class Generex extends Object implements Iterable
| Modifier and Type | Field and Description |
|---|---|
private dk.brics.automaton.Automaton |
automaton |
private boolean |
isTransactionNodeBuilt |
private int |
matchedStringCounter |
private List<String> |
matchedStrings |
private Map<String,String> |
predefinedCharacterClasses |
private int |
preparedTransactionNode |
private dk.brics.automaton.RegExp |
regExp |
private Node |
rootNode |
| Constructor and Description |
|---|
Generex(dk.brics.automaton.Automaton automaton) |
Generex(String regex) |
| Modifier and Type | Method and Description |
|---|---|
private void |
buildRootNode()
Prepare the rootNode and it's child nodes so that we can get
matchedString by index
|
private String |
buildStringFromNode(Node node,
int indexOrder) |
private void |
generate(String strMatch,
dk.brics.automaton.State state,
int limit) |
List<String> |
getAllMatchedStrings()
Generate all Strings that matches the given Regex.
|
String |
getFirstMatch() |
String |
getMatchedString(int indexOrder) |
List<String> |
getMatchedStrings(int limit)
Generate subList with a size of
limit of Strings that
matches the given Regex. the Strings are ordered in lexicographical
order. |
Iterator |
iterator() |
long |
matchedStringsSize() |
private String |
prepareRandom(String strMatch,
dk.brics.automaton.State state,
int minLength,
int maxLength) |
private List<Node> |
prepareTransactionNodes(dk.brics.automaton.State state)
Build list of nodes that present possible transactions from the
state. |
String |
random()
Generate and return a random String that match the pattern used in this
Generex.
|
String |
random(int minLength)
Generate and return a random String that match the pattern used in this
Generex, and the string has a length >=
minLength |
String |
random(int minLength,
int maxLength)
Generate and return a random String that match the pattern used in this
Generex, and the string has a length >=
minLength and <=
maxLength |
private dk.brics.automaton.RegExp regExp
private dk.brics.automaton.Automaton automaton
private Node rootNode
private boolean isTransactionNodeBuilt
private int matchedStringCounter
private int preparedTransactionNode
public Generex(String regex)
public Generex(dk.brics.automaton.Automaton automaton)
public String getMatchedString(int indexOrder)
indexOrder - ( 1<= indexOrder <=n)indexOrder between 1 and n where
n is the number of matched String.StackOverflowErrorpublic String getFirstMatch()
public long matchedStringsSize()
private void buildRootNode()
private void generate(String strMatch, dk.brics.automaton.State state, int limit)
private List<Node> prepareTransactionNodes(dk.brics.automaton.State state)
state.state - public List<String> getAllMatchedStrings()
public List<String> getMatchedStrings(int limit)
limit of Strings that
matches the given Regex. the Strings are ordered in lexicographical
order.limit - public String random()
public String random(int minLength)
minLengthminLength - public String random(int minLength, int maxLength)
minLength and <=
maxLengthminLength - maxLength - private String prepareRandom(String strMatch, dk.brics.automaton.State state, int minLength, int maxLength)
Copyright © 2015. All Rights Reserved.