|
common-util | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlocal.tomas.expr.compiler.ExpressionCompiler
public class ExpressionCompiler
The ExpressionCompiler creates Expressions from strings.
| Field Summary | |
|---|---|
protected Locale |
locale
Locale for compilation |
protected int |
nextToken
Next token in compilation. |
static int |
PRESERVE_NEWLINES_IN_STRINGS
Option to preserve newline characters within strings. |
protected String[] |
tokenStream
Token stream compiled. |
| Constructor Summary | |
|---|---|
ExpressionCompiler(String expr,
Locale locale,
int options)
Constructor. |
|
| Method Summary | |
|---|---|
protected Class<? extends BinaryTerm> |
additionOperator(String string)
Get expression class for addition operator. |
protected Class<? extends BinaryTerm> |
comparisonOperator(String string)
Get expression class for comparison operator. |
protected String |
currentToken()
Get current token |
protected String |
followingToken()
Get following token without moving the token cursor. |
protected Class<? extends FunctionCall> |
function(String name)
Get expression class for function with at least two arguments. |
protected List<String> |
getTokenStream(String expr,
int options)
Convert string to token stream. |
protected Class<? extends BinaryTerm> |
multiplicationOperator(String string)
Get expression class for multiplication operator. |
protected Class<? extends FunctionCall> |
noArgFunction(String name)
Get expression class for argument-less function. |
protected Expression |
parse()
Parse expression string. |
static Expression |
parse(String expr,
Locale locale,
int options)
Parse an expression. |
protected Expression |
parseAddition()
Parse addition term. |
protected Expression |
parseAnd()
Parse AND term. |
protected Expression |
parseAtom()
Parse atomic expression. |
protected Expression |
parseComparison()
Parse comparison term. |
protected Expression |
parseMultiplication()
Parse multiplication term. |
protected Expression |
parseOr()
Parse OR term. |
protected Expression |
parseUnaryTerm()
Parse unary term. |
protected Expression |
resolveName(String name)
|
protected Class<? extends UnaryTerm> |
unaryFunction(String name)
Get expression class for function with a single argument. |
protected Class<? extends UnaryTerm> |
unaryPostfix(String string)
Get expression class for unary postfix operator. |
protected Class<? extends UnaryTerm> |
unaryPrefix(String string)
Get expression class for unary postfix operator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PRESERVE_NEWLINES_IN_STRINGS
protected Locale locale
protected String[] tokenStream
protected int nextToken
| Constructor Detail |
|---|
public ExpressionCompiler(String expr,
Locale locale,
int options)
throws ExpressionException
expr - expression to compilelocale - locale used for compilationoptions - compilation options like PRESERVE_NEWLINES_IN_STRINGS or'ed together
ExpressionException| Method Detail |
|---|
protected List<String> getTokenStream(String expr,
int options)
throws ExpressionException
expr - expression stringoptions - compilation options like PRESERVER_NEWLINES_IN_STRINGS or'ed together
ExpressionExceptionprotected String currentToken()
protected String followingToken()
protected Expression parse()
throws ExpressionException
ExpressionException
protected Expression parseOr()
throws ExpressionException
ExpressionException
protected Expression parseAnd()
throws ExpressionException
ExpressionException
protected Expression parseComparison()
throws ExpressionException
ExpressionExceptionprotected Class<? extends BinaryTerm> comparisonOperator(String string)
string - comparison operator
protected Expression parseAddition()
throws ExpressionException
ExpressionExceptionprotected Class<? extends BinaryTerm> additionOperator(String string)
string - addition operator
protected Expression parseMultiplication()
throws ExpressionException
ExpressionExceptionprotected Class<? extends BinaryTerm> multiplicationOperator(String string)
string - operator
protected Expression parseUnaryTerm()
throws ExpressionException
ExpressionExceptionprotected Class<? extends UnaryTerm> unaryPostfix(String string)
string - operator
protected Class<? extends UnaryTerm> unaryPrefix(String string)
string - operator
protected Expression parseAtom()
throws ExpressionException
ExpressionException
protected Expression resolveName(String name)
throws ExpressionException
ExpressionExceptionprotected Class<? extends FunctionCall> noArgFunction(String name)
name - function name
protected Class<? extends UnaryTerm> unaryFunction(String name)
name - function name
protected Class<? extends FunctionCall> function(String name)
name - function name
public static Expression parse(String expr,
Locale locale,
int options)
throws ExpressionException
expr - string representation of an expressionlocale - locale used for compilationoptions - compilation options or'ed together
ExpressionException
|
common-util | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||