public class NfaUtil extends Object
| Constructor and Description |
|---|
NfaUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Construct |
alternate(Nfa graph,
Construct a,
Construct b)
constructs a nfa for an alternation (A | B)
|
static Construct |
any(Nfa graph)
constructs a nfa for any character
|
static Construct |
character(Nfa graph,
char c)
constructs a nfa for a character
|
static Construct |
characterClass(Nfa graph,
CharacterClass cc)
constructs a nfa for a character class
|
static Construct |
concatenate(Nfa graph,
Construct from,
Construct to)
constructs a nfa for a concatenation (A B)
|
static Dfa |
finalize(Nfa graph,
String regex,
Construct c)
Create a new dfa out of a nfa
|
static Construct |
oneOrMany(Nfa graph,
Construct a)
constructs a nfa for an one to many (A+)
|
static Construct |
optional(Nfa graph,
Construct a)
constructs a nfa for an option (A?)
|
static Construct |
zeroOrMany(Nfa graph,
Construct a)
constructs a nfa for a zero to many (A*)
|
public static Construct character(Nfa graph, char c)
[n] -- c --> [n+1]
graph - the graph to which the construct would be addedc - is the characterpublic static Construct characterClass(Nfa graph, CharacterClass cc)
[n] -- char-class --> [n+1]
graph - the graph to which the construct would be addedcc - is the character classpublic static Construct any(Nfa graph)
[n] -- <any>--> [n+1]
graph - the graph to which the construct would be addedpublic static Construct concatenate(Nfa graph, Construct from, Construct to)
[construct-from] -- ε --> [construct-to]
graph - the graph to which the construct would be addedfrom - is the starting constructto - is the ending constructpublic static Construct alternate(Nfa graph, Construct a, Construct b)
+--> [construct] --+
ε ε
| |
| V
-->[n] [n+1] -->
| ^
ε |
| ε
+--> [construct] --+
graph - the graph to which the construct would be addeda - is the first alternating constructb - is the second alternating constructpublic static Construct zeroOrMany(Nfa graph, Construct a)
+------------ε------------+
| |
| V
-->[n]-ε-> [construct] -ε-> [n+1]-->
^ |
| |
+----ε----+
graph - the graph to which the construct would be addeda - is the repeating constructpublic static Construct oneOrMany(Nfa graph, Construct a)
-->[n]-ε-> [construct] -ε-> [n+1]-->
^ |
| |
+----ε----+
graph - the graph to which the construct would be addeda - is the repeating constructpublic static Construct optional(Nfa graph, Construct a)
[construct]
| ^
| |
+----ε----+
graph - the graph to which the construct would be addeda - is the optional constructCopyright © 2017. All rights reserved.