|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.exp.Expression
org.apache.cayenne.exp.parser.SimpleNode
public abstract class SimpleNode
Superclass of AST* expressions that implements Node interface defined by JavaCC framework.
Some parts of the parser are based on OGNL parser, copyright (c) 2002, Drew Davidson and Luke Blanshard.
Field Summary | |
---|---|
protected Node[] |
children
|
protected int |
id
|
protected Node |
parent
|
Fields inherited from class org.apache.cayenne.exp.Expression |
---|
ADD, ALL, AND, ANY, AVG, BETWEEN, COUNT, DB_PATH, DIVIDE, EQUAL_TO, EXISTS, GREATER_THAN, GREATER_THAN_EQUAL_TO, IN, LESS_THAN, LESS_THAN_EQUAL_TO, LIKE, LIKE_IGNORE_CASE, LIST, MAX, MIN, MULTIPLY, NEGATIVE, NOT, NOT_BETWEEN, NOT_EQUAL_TO, NOT_IN, NOT_LIKE, NOT_LIKE_IGNORE_CASE, OBJ_PATH, OR, POSITIVE, PRUNED_NODE, RAW_SQL, SOME, SUBQUERY, SUBTRACT, SUM, type |
Constructor Summary | |
---|---|
protected |
SimpleNode(int i)
|
Method Summary | |
---|---|
protected static void |
encodeAsEscapedString(java.io.PrintWriter pw,
java.lang.String source)
Utility method that prints a string to the provided PrintWriter, escaping special characters. |
void |
encodeAsString(java.io.PrintWriter pw)
Stores a String representation of Expression using a provided PrintWriter. |
protected static void |
encodeScalarAsString(java.io.PrintWriter pw,
java.lang.Object scalar)
Utility method that encodes an object that is not an expression Node to String. |
java.lang.Object |
evaluate(java.lang.Object o)
Calculates expression value with object as a context for path expressions. |
protected java.lang.Object |
evaluateChild(int index,
java.lang.Object o)
|
protected abstract java.lang.Object |
evaluateNode(java.lang.Object o)
Evaluates itself with object, pushing result on the stack. |
java.lang.String |
expName()
Implemented for backwards compatibility with exp package. |
protected void |
flattenTree()
Flattens the tree under this node by eliminating any children that are of the same class as this node and copying their children to this node. |
protected abstract java.lang.String |
getExpressionOperator(int index)
|
java.lang.Object |
getOperand(int index)
Returns a value of operand at index . |
int |
getOperandCount()
Returns a count of operands of this expression. |
void |
jjtAddChild(Node n,
int i)
This method tells the node to add its argument to the node's list of children. |
void |
jjtClose()
Called after all the child nodes have been added. |
Node |
jjtGetChild(int i)
This method returns a child node. |
int |
jjtGetNumChildren()
Return the number of children the node has. |
Node |
jjtGetParent()
|
void |
jjtOpen()
Called after the node has been made the current node. |
void |
jjtSetParent(Node n)
This pair of methods are used to inform the node of its parent. |
Expression |
notExp()
Returns a logical NOT of current expression. |
protected boolean |
pruneNodeForPrunedChild(java.lang.Object prunedChild)
Returns true if this node should be pruned from expression tree in the event a child is removed. |
void |
setOperand(int index,
java.lang.Object value)
Sets a value of operand at index . |
protected java.lang.Object |
unwrapChild(Node child)
|
protected Node |
wrapChild(java.lang.Object child)
|
Methods inherited from class org.apache.cayenne.exp.Expression |
---|
andExp, deepCopy, encodeAsXML, equals, expWithParameters, expWithParameters, filter, filterObjects, fromString, getType, joinExp, match, orExp, setType, shallowCopy, toString, transform, transformExpression, traverse, traverse |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Node parent
protected Node[] children
protected int id
Constructor Detail |
---|
protected SimpleNode(int i)
Method Detail |
---|
protected static void encodeScalarAsString(java.io.PrintWriter pw, java.lang.Object scalar)
protected static void encodeAsEscapedString(java.io.PrintWriter pw, java.lang.String source)
protected abstract java.lang.String getExpressionOperator(int index)
protected boolean pruneNodeForPrunedChild(java.lang.Object prunedChild)
Expression
pruneNodeForPrunedChild
in class Expression
public java.lang.String expName()
expName
in class Expression
protected void flattenTree()
flattenTree
in class Expression
public void encodeAsString(java.io.PrintWriter pw)
Expression
encodeAsString
in class Expression
public java.lang.Object getOperand(int index)
Expression
index
. Operand indexing starts at 0.
getOperand
in class Expression
protected Node wrapChild(java.lang.Object child)
protected java.lang.Object unwrapChild(Node child)
public int getOperandCount()
Expression
getOperandCount
in class Expression
public void setOperand(int index, java.lang.Object value)
Expression
index
. Operand indexing starts at 0.
setOperand
in class Expression
public void jjtOpen()
Node
jjtOpen
in interface Node
public void jjtClose()
Node
jjtClose
in interface Node
public void jjtSetParent(Node n)
Node
jjtSetParent
in interface Node
public Node jjtGetParent()
jjtGetParent
in interface Node
public void jjtAddChild(Node n, int i)
Node
jjtAddChild
in interface Node
public Node jjtGetChild(int i)
Node
jjtGetChild
in interface Node
public final int jjtGetNumChildren()
Node
jjtGetNumChildren
in interface Node
protected abstract java.lang.Object evaluateNode(java.lang.Object o) throws java.lang.Exception
java.lang.Exception
protected java.lang.Object evaluateChild(int index, java.lang.Object o) throws java.lang.Exception
java.lang.Exception
public Expression notExp()
Expression
notExp
in class Expression
public java.lang.Object evaluate(java.lang.Object o)
Expression
evaluate
in class Expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |