public abstract class SimpleNode extends Expression implements Node
Some parts of the parser are based on OGNL parser, copyright (c) 2002, Drew Davidson and Luke Blanshard.
| Modifier and Type | Field and Description |
|---|---|
protected Node[] |
children |
protected int |
id |
protected Node |
parent |
ADD, AND, BETWEEN, BITWISE_AND, BITWISE_NOT, BITWISE_OR, BITWISE_XOR, DB_PATH, DIVIDE, EQUAL_TO, FALSE, GREATER_THAN, GREATER_THAN_EQUAL_TO, IN, LESS_THAN, LESS_THAN_EQUAL_TO, LIKE, LIKE_IGNORE_CASE, LIST, MULTIPLY, NEGATIVE, NOT, NOT_BETWEEN, NOT_EQUAL_TO, NOT_IN, NOT_LIKE, NOT_LIKE_IGNORE_CASE, OBJ_PATH, OR, PRUNED_NODE, SUBTRACT, TRUE, type| Modifier | Constructor and Description |
|---|---|
protected |
SimpleNode(int i) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
connectChildren()
Sets the parent to this for all children.
|
void |
encodeAsEJBQL(PrintWriter pw,
String rootId)
Stores a String representation of Expression as EJBQL using a provided PrintWriter.
|
protected static void |
encodeAsEscapedString(PrintWriter pw,
String source)
Utility method that prints a string to the provided PrintWriter, escaping special
characters.
|
void |
encodeAsString(PrintWriter pw)
Stores a String representation of Expression using a provided PrintWriter.
|
protected void |
encodeChildrenAsEJBQL(PrintWriter pw,
String rootId)
Encodes child of this node with specified index to EJBQL
|
protected static void |
encodeScalarAsString(PrintWriter pw,
Object scalar,
char quoteChar)
Utility method that encodes an object that is not an expression Node to String.
|
Object |
evaluate(Object o)
Calculates expression value with object as a context for path expressions.
|
protected Object |
evaluateChild(int index,
Object o) |
protected abstract Object |
evaluateNode(Object o)
Evaluates itself with object, pushing result on the stack.
|
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 String |
getEJBQLExpressionOperator(int index)
Returns operator for ebjql statements, which can differ for Cayenne expression
operator
|
protected abstract String |
getExpressionOperator(int index) |
Object |
getOperand(int index)
Returns a value of operand at
index. |
int |
getOperandCount()
Returns a count of operands of this expression.
|
Map<String,String> |
getPathAliases()
Always returns empty map.
|
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(Object prunedChild)
Returns true if this node should be pruned from expression tree in the event a
child is removed.
|
void |
setOperand(int index,
Object value)
Sets a value of operand at
index. |
protected Object |
unwrapChild(Node child) |
protected Node |
wrapChild(Object child) |
andExp, deepCopy, encodeAsXML, equals, expWithParameters, expWithParameters, filter, filterObjects, first, fromString, getType, joinExp, match, orExp, setType, shallowCopy, toEJBQL, toString, transform, transformExpression, traverse, traverseprotected static void encodeScalarAsString(PrintWriter pw, Object scalar, char quoteChar)
protected static void encodeAsEscapedString(PrintWriter pw, String source)
public Map<String,String> getPathAliases()
getPathAliases in class Expressionprotected abstract String getExpressionOperator(int index)
protected String getEJBQLExpressionOperator(int index)
protected boolean pruneNodeForPrunedChild(Object prunedChild)
ExpressionpruneNodeForPrunedChild in class Expressionpublic String expName()
expName in class Expressionprotected void flattenTree()
flattenTree in class Expressionpublic void encodeAsString(PrintWriter pw)
ExpressionencodeAsString in class Expressionpublic Object getOperand(int index)
Expressionindex. Operand indexing starts at 0.getOperand in class Expressionpublic int getOperandCount()
ExpressiongetOperandCount in class Expressionpublic void setOperand(int index,
Object value)
Expressionindex. Operand indexing starts at 0.setOperand in class Expressionpublic void jjtOpen()
Nodepublic void jjtClose()
Nodepublic void jjtSetParent(Node n)
NodejjtSetParent in interface Nodepublic Node jjtGetParent()
jjtGetParent in interface Nodepublic void jjtAddChild(Node n, int i)
NodejjtAddChild in interface Nodepublic Node jjtGetChild(int i)
NodejjtGetChild in interface Nodepublic final int jjtGetNumChildren()
NodejjtGetNumChildren in interface Nodeprotected abstract Object evaluateNode(Object o) throws Exception
Exceptionprotected void connectChildren()
protected Object evaluateChild(int index, Object o) throws Exception
Exceptionpublic Expression notExp()
ExpressionnotExp in class Expressionpublic Object evaluate(Object o)
Expressionevaluate in class Expressionpublic void encodeAsEJBQL(PrintWriter pw, String rootId)
ExpressionencodeAsEJBQL in class Expressionprotected void encodeChildrenAsEJBQL(PrintWriter pw, String rootId)
Copyright © 2001–2018 Apache Cayenne. All rights reserved.