public class RegularExpression extends Object implements Iterable<List<String>>
D.p(RegularExpression.compile("a|(b c+)+").describe());
-->
1(a) -> [] // From a, we're done
2(b) -> [3(c)] // From b, go to c
3(c) -> [3(c), 2(b)] // From c, go either to c or to b
Valid exits: 1(a), 3(c),
D.p(RegularExpression.compile("a|(b c+)+").inverse().describe());
-->
4(a) -> []
6(c) -> [5(b), 6(c)]
5(b) -> [6(c)]
Valid exits: 4(a), 5(b),
| Modifier and Type | Class and Description |
|---|---|
static class |
RegularExpression.RegExState
Represents one position in a regular expression
|
| Modifier and Type | Field and Description |
|---|---|
List<RegularExpression.RegExState> |
entries
RegExStates with which the RegularExpression starts
|
List<RegularExpression.RegExState> |
exits
Valid exit states of this RegularExpression
|
String |
original
Holds the original regex
|
| Modifier | Constructor and Description |
|---|---|
protected |
RegularExpression()
Internal constructor
|
protected |
RegularExpression(String token)
Internal constructor
|
| Modifier and Type | Method and Description |
|---|---|
static RegularExpression |
compile(String regex)
Returns a RegularExpression for a string
|
String |
describe()
returns a nice String description
|
List<RegularExpression.RegExState> |
getEntries()
Returns the entry states of this RegularExpression
|
String |
getOrginal()
returns the original
|
List<RegularExpression.RegExState> |
getStates()
Returns the set of States (expensive)
|
RegularExpression |
inverse()
Returns the inverse of this Regular Expression (expensive)
|
boolean |
isExit(RegularExpression.RegExState e)
Tells whether this RegExState is a valid exit
|
PeekIterator<List<String>> |
iterator()
Returns an iterator over incarnations of the expression
|
static void |
main(String[] args)
Test routine
|
static RegularExpression |
parseSimple(StringTokenizer regex)
Parses a regex from a StringTokenizer
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic List<RegularExpression.RegExState> entries
public List<RegularExpression.RegExState> exits
public String original
protected RegularExpression(String token)
protected RegularExpression()
public String getOrginal()
public static RegularExpression compile(String regex)
public boolean isExit(RegularExpression.RegExState e)
public List<RegularExpression.RegExState> getEntries()
public static RegularExpression parseSimple(StringTokenizer regex)
public String describe()
public List<RegularExpression.RegExState> getStates()
public RegularExpression inverse()
public PeekIterator<List<String>> iterator()
public static void main(String[] args)
Copyright © 2018. All rights reserved.