public abstract class Expression
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Expression.Provider
Internal class used as a generator of numbers for marking expressions.
|
static class |
Expression.Type
Enumeration of regular subexpression types.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.Boolean |
allowsEmpty
Cached value of the Empty function.
|
static java.lang.String |
TOKEN_MS_MARK
String token for delimiter used for marked expressions.
|
static java.lang.String |
TOKEN_MT_CLOSE
String token for closing parenthesis (must have right one character).
|
static java.lang.String |
TOKEN_MT_OPEN
String token for opening parenthesis (must have right one character).
|
static java.lang.String |
TOKEN_OP_CONCAT
String token for concatenation operator (must have right one character).
|
static java.lang.String |
TOKEN_OP_STAR
String token for Kleene star operator (must have right one character).
|
static java.lang.String |
TOKEN_OP_UNION
String token for union operator (must have right one character).
|
static java.lang.String |
TOKEN_RE_EMPTY
String token for empty trivial regular expression.
|
static java.lang.String |
TOKEN_RE_EPSILON
String token for epsilon trivial regular expression.
|
Constructor and Description |
---|
Expression() |
Modifier and Type | Method and Description |
---|---|
static Expression |
createExpression(java.lang.String exp)
Creates a new expression object for a valid regular expression string.
|
abstract Expression |
duplicateExpression()
Creates a new independent copy of the particular expression.
|
abstract java.util.Set<java.lang.String> |
getSymbols()
Returns the set of alphabet symbols occurring in the expression.
|
abstract Expression.Type |
getType()
Returns the type of a given regular subexpression.
|
static Expression |
markExpression(Expression exp)
Transforms given regular expression into marked one.
|
protected abstract void |
markSymbols(Expression.Provider provider)
Marks all individual symbols of the alphabet.
|
protected static int |
parseOperand(java.lang.String exp,
java.lang.String sep)
Internal function for parsing operand value from the expression.
|
abstract boolean |
resolveEmpty()
The Empty function for Glushkov automaton construction.
|
abstract java.util.Set<java.lang.String> |
resolveFirst()
The First function for Glushkov automaton construction.
|
abstract java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
resolveFollow()
The Follow function for Glushkov automaton construction.
|
abstract java.util.Set<java.lang.String> |
resolveLast()
The Last function for Glushkov automaton construction.
|
abstract java.lang.String |
serializeExpression()
Serializes the inductive structure of the regular expression.
|
static java.lang.String |
trimMarking(java.lang.String markedSymbol)
Removes the marking postfix of the provided marked symbol.
|
public static java.lang.String TOKEN_MT_OPEN
public static java.lang.String TOKEN_MT_CLOSE
public static java.lang.String TOKEN_OP_CONCAT
public static java.lang.String TOKEN_OP_UNION
public static java.lang.String TOKEN_OP_STAR
public static java.lang.String TOKEN_RE_EMPTY
public static java.lang.String TOKEN_RE_EPSILON
public static java.lang.String TOKEN_MS_MARK
protected java.lang.Boolean allowsEmpty
public static Expression createExpression(java.lang.String exp)
exp
- String form of the regular expression.public abstract Expression duplicateExpression()
public static Expression markExpression(Expression exp)
exp
- Original regular expression to be marked.protected static int parseOperand(java.lang.String exp, java.lang.String sep)
exp
- String form of the expression to be parsed.sep
- String token of the separating operation.public abstract Expression.Type getType()
public abstract java.lang.String serializeExpression()
public abstract java.util.Set<java.lang.String> getSymbols()
protected abstract void markSymbols(Expression.Provider provider)
provider
- References to the generator of number postfixes.public static java.lang.String trimMarking(java.lang.String markedSymbol)
markedSymbol
- Marked symbol to be cleaned.markExpression(cz.cuni.mff.corrector.expression.Expression)
public abstract boolean resolveEmpty()
true
if expression may be empty.public abstract java.util.Set<java.lang.String> resolveFirst()
public abstract java.util.Set<java.lang.String> resolveLast()
public abstract java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resolveFollow()