|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tuffy.ra.Expression
public final class Expression
An expression to a function is like a literal to a predicate. The interesting part is that expressions can be nested. The value of an expression can be numeric/string/boolean.
Field Summary | |
---|---|
private java.util.ArrayList<Expression> |
args_
|
boolean |
changeName
|
private Function |
func_
|
private java.lang.String |
val
|
private java.lang.String |
valBinding
|
Constructor Summary | |
---|---|
Expression(Function func)
Construct a new expression based on the function func_ |
Method Summary | |
---|---|
void |
addArgument(Expression expr)
Append an argument to the underlying function |
static Expression |
and(Expression e1,
Expression e2)
Boolean AND |
void |
bindVariables(java.util.Map<java.lang.String,java.lang.String> mapVarVal)
Bind variable references to their values in the symbol table. |
Expression |
clone()
|
static Expression |
exprConstInteger(int n)
Atomic expression representing a constant integer |
static Expression |
exprConstNum(double num)
Atomic expression representing a constant number |
static Expression |
exprConstString(java.lang.String str)
Atomic expression representing a constant string |
static Expression |
exprVariableBinding(java.lang.String var)
Atomic expression representing a variable binding |
java.util.ArrayList<Expression> |
getArgs()
|
Function |
getFunction()
|
private java.lang.String |
getStringForm(boolean inSQL)
Compute the SQL representation of this expression. |
java.util.HashSet<java.lang.String> |
getVars()
Get the variables referenced by this expression. |
boolean |
isBoolean()
Test if this expression returns a boolean value |
boolean |
isNumeric()
Test if this expression returns a numeric value |
boolean |
isString()
Test if this expression returns a string value |
private boolean |
needEnclosure()
For aesthetics, check if we need a pair of parenthses for this experession. |
static Expression |
not(Expression e)
Boolean negation |
static Expression |
or(Expression e1,
Expression e2)
Boolean OR |
java.lang.String |
renameVariables(java.util.Map<java.lang.String,java.lang.String> mapVarVar)
Bind variable references to their values in the symbol table. |
java.lang.String |
toSQL()
Get the SQL snippet for this expression |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Function func_
private java.util.ArrayList<Expression> args_
private java.lang.String val
private java.lang.String valBinding
public boolean changeName
Constructor Detail |
---|
public Expression(Function func)
func_
func
- the underlying functionMethod Detail |
---|
public java.util.ArrayList<Expression> getArgs()
public Function getFunction()
public java.util.HashSet<java.lang.String> getVars()
private boolean needEnclosure()
public static Expression not(Expression e)
e
- public static Expression and(Expression e1, Expression e2)
e1
- e2
- public static Expression or(Expression e1, Expression e2)
e1
- e2
- public boolean isBoolean()
public boolean isString()
public boolean isNumeric()
public void addArgument(Expression expr)
expr
- the new argumentpublic static Expression exprConstInteger(int n)
n
- public static Expression exprConstNum(double num)
public static Expression exprConstString(java.lang.String str)
public static Expression exprVariableBinding(java.lang.String var)
public Expression clone()
clone
in class java.lang.Object
public java.lang.String renameVariables(java.util.Map<java.lang.String,java.lang.String> mapVarVar)
mapVarVar
- public void bindVariables(java.util.Map<java.lang.String,java.lang.String> mapVarVal)
mapVarVal
- public java.lang.String toSQL()
private java.lang.String getStringForm(boolean inSQL)
bindVariables(Map)
first.
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |