org.metasyntactic.math.automata
Class RegularExpressionFactory
java.lang.Object
|
+--org.metasyntactic.math.automata.RegularExpressionFactory
- public class RegularExpressionFactory
- extends java.lang.Object
A factory class for returning any of the 3 regular expression atoms.
Also includes a wicked cool method for returning a regular expression object
encoded in a string.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
empty
public static RegularExpression empty()
Null
public static RegularExpression Null()
symbol
public static RegularExpression symbol(java.lang.Object o)
symbol
public static RegularExpression symbol(char c)
fromString
public static RegularExpression fromString(java.lang.String s)
throws ParseException
ParseException
fromString
public static RegularExpression fromString(java.lang.String s,
boolean largeIdentifiers)
throws ParseException
- Given any RegularExpression R, Let S = R.toString(). The contract of
this method is that R.equals(fromString(S)) should always be true. Thus
this method reverses the actions of toString(), reconstructing the
RegularExpression Object that created the string.
However, due to the way regular expressions can be printed, there are
configurbale options. Consider the regexp "abcd". This could represent
the regular expression object "(((ab)c)d)", or it could represent the
regular expression object "(abcd)". Either are acceptable interpretations.
largeIdentifiers
is used to determine the behavior of the
matching.
ParseException
main
public static void main(java.lang.String[] args)
throws java.lang.Throwable
java.lang.Throwable