public abstract class RegExp
extends java.lang.Object
The purpose of this class and its subclasses is to allow the symbolic manipulation of RE's on any alphabet, providing methods for reading, writing, equality, and normalization to canonical form. RE matching is not the intended use, although it should be simple to have that as well by encoding each Object in the alphabet with a char and delegate the work to java.util.regex.
The abstract subclasses of this class are:
The concrete subclasses of this class are:
| Modifier and Type | Field and Description |
|---|---|
static int |
BINARY_EXP |
static int |
CHOICE_EXP |
static int |
CONCAT_EXP |
static RegExpSymbol |
EMPTY
A canonical empty symbol.
|
static int |
EMPTY_EXP
Constants identifying each specific type of RegExp.
|
static int |
OPTION_EXP |
static int |
PLUS_EXP |
static int |
POWER_EXP |
static int |
RANGE_EXP |
static int |
STAR_EXP |
static int |
SYMBOL_EXP |
static int |
UNARY_EXP |
| Constructor and Description |
|---|
RegExp() |
| Modifier and Type | Method and Description |
|---|---|
RegExp |
cleanup(RegExp e)
This simply returns its argument, unless null - in which
case it returns EMPTY.
|
abstract RegExp |
deepCopy()
This returns a deep copy of this RegExp.
|
boolean |
isBinary() |
boolean |
isChoice() |
boolean |
isConcat() |
boolean |
isEmpty()
Each of the following methods tests whether thus is a specific
RegExp type or form (i.e., unary or binary).
|
boolean |
isLexLess(RegExp other) |
boolean |
isOption() |
boolean |
isPlus() |
boolean |
isPower() |
boolean |
isRange() |
boolean |
isStar() |
boolean |
isSymbol() |
boolean |
isUnary() |
abstract RegExp |
normalize()
This is the method that implements the normalization rule
set for each syntactic category forming a RegExp;
namely,:
RegExpSymbol.normalize()
RegExpOption.normalize()
RegExpPlus.normalize()
RegExpStar.normalize()
RegExpPower.normalize()
RegExpPowerRange.normalize()
RegExpConcat.normalize()
RegExpChoice.normalize()
|
boolean |
normEquals(RegExp other)
Returns true iff the specified RegExp's normal
form is equal to this RegExp's normal form.
|
static void |
noTrace()
Disables tracing mode.
|
abstract RegExp |
shallowCopy()
This returns a shallow copy of this RegExp.
|
java.lang.String |
tag()
This returns a string identifying this RegExp's specific
type.
|
static void |
toggleTrace()
Toggles tracing mode.
|
java.lang.String |
toNormalString()
Returns the printable form for this RegExp's normal form.
|
static void |
trace()
Enables tracing mode on.
|
static boolean |
tracing()
Tests whether tracing is on.
|
abstract int |
type()
This returns the specific type identifying this RegExp.
|
public static final RegExpSymbol EMPTY
public static final int EMPTY_EXP
public static final int SYMBOL_EXP
public static final int OPTION_EXP
public static final int PLUS_EXP
public static final int STAR_EXP
public static final int POWER_EXP
public static final int RANGE_EXP
public static final int CHOICE_EXP
public static final int CONCAT_EXP
public static final int UNARY_EXP
public static final int BINARY_EXP
public abstract RegExp normalize()
public final boolean normEquals(RegExp other)
public abstract RegExp shallowCopy()
public abstract RegExp deepCopy()
public final RegExp cleanup(RegExp e)
public abstract int type()
public final java.lang.String tag()
public final boolean isEmpty()
public final boolean isSymbol()
public final boolean isChoice()
public final boolean isConcat()
public final boolean isOption()
public final boolean isPlus()
public final boolean isPower()
public final boolean isRange()
public final boolean isStar()
public final boolean isUnary()
public final boolean isBinary()
public final java.lang.String toNormalString()
public final boolean isLexLess(RegExp other)
public static final boolean tracing()
public static final void trace()
public static final void noTrace()
public static final void toggleTrace()