Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.exp.parser
Class SimpleNode

    java.lang.Object
      org.apache.cayenne.exp.Expression
          org.apache.cayenne.exp.parser.SimpleNode

All Implemented Interfaces:
  java.io.Serializable, Node, XMLSerializable

Direct Known Subclasses:
  AggregateConditionNode, ASTAdd, ASTBitwiseAnd, ASTBitwiseNot, ASTBitwiseOr, ASTBitwiseXor, ASTDivide, ASTList, ASTMultiply, ASTNegate, ASTPath, ASTScalar, ASTSubtract, ConditionNode

    public abstract class SimpleNode

extends Expression
implements Node

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.

Since:
  1.1
See Also:
  Serialized Form

Field Summary
`protected Node[]` | `children`
`protected int` | `id`
`protected Node` | `parent`

Fields inherited from class org.apache.cayenne.exp.Expression
`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`

Constructor Summary
`protected` | `SimpleNode(int i)`

Method Summary
`protected void` | `connectChildren()` Sets the parent to this for all children.
`void` | `encodeAsEJBQL(java.io.PrintWriter pw, java.lang.String rootId)` Stores a String representation of Expression as EJBQL using a provided PrintWriter.
`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 void` | `encodeChildrenAsEJBQL(java.io.PrintWriter pw, java.lang.String rootId)` Encodes child of this node with specified index to EJBQL
`protected static void` | `encodeScalarAsString(java.io.PrintWriter pw, java.lang.Object scalar, char quoteChar)` 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 java.lang.String` | `getEJBQLExpressionOperator(int index)` Returns operator for ebjql statements, which can differ for Cayenne expression operator
`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.
`java.util.Map<java.lang.String,java.lang.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(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, first, fromString, getType, joinExp, match, orExp, setType, shallowCopy, toEJBQL, toString, transform, transformExpression, traverse, traverse`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### parent

    protected Node parent

### children

    protected Node[] children

### id

    protected int id

Constructor Detail

### SimpleNode

    protected SimpleNode(int i)

Method Detail

### encodeScalarAsString

    protected static void encodeScalarAsString(java.io.PrintWriter pw,
                                               java.lang.Object scalar,
                                               char quoteChar)

  Utility method that encodes an object that is not an expression Node to String.

### encodeAsEscapedString

    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.

### getPathAliases

    public java.util.Map<java.lang.String,java.lang.String> getPathAliases()

  Always returns empty map.

  Specified by:
    `getPathAliases` in class `Expression`
  Since:
    3.0

### getExpressionOperator

    protected abstract java.lang.String getExpressionOperator(int index)

### getEJBQLExpressionOperator

    protected java.lang.String getEJBQLExpressionOperator(int index)

  Returns operator for ebjql statements, which can differ for Cayenne expression operator

### pruneNodeForPrunedChild

    protected boolean pruneNodeForPrunedChild(java.lang.Object prunedChild)

  Description copied from class: `Expression`
  Returns true if this node should be pruned from expression tree in the event a child is removed.

  Specified by:
    `pruneNodeForPrunedChild` in class `Expression`

### expName

    public java.lang.String expName()

  Implemented for backwards compatibility with exp package.

  Overrides:
    `expName` in class `Expression`

### flattenTree

    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.

  Specified by:
    `flattenTree` in class `Expression`

### encodeAsString

    public void encodeAsString(java.io.PrintWriter pw)

  Description copied from class: `Expression`
  Stores a String representation of Expression using a provided PrintWriter.

  Specified by:
    `encodeAsString` in class `Expression`

### getOperand

    public java.lang.Object getOperand(int index)

  Description copied from class: `Expression`
  Returns a value of operand at `index`. Operand indexing starts at 0.

  Specified by:
    `getOperand` in class `Expression`

### wrapChild

    protected Node wrapChild(java.lang.Object child)

### unwrapChild

    protected java.lang.Object unwrapChild(Node child)

### getOperandCount

    public int getOperandCount()

  Description copied from class: `Expression`
  Returns a count of operands of this expression. In real life there are unary (count == 1), binary (count == 2) and ternary (count == 3) expressions.

  Specified by:
    `getOperandCount` in class `Expression`

### setOperand

    public void setOperand(int index,
                           java.lang.Object value)

  Description copied from class: `Expression`
  Sets a value of operand at `index`. Operand indexing starts at 0.

  Specified by:
    `setOperand` in class `Expression`

### jjtOpen

    public void jjtOpen()

  Description copied from interface: `Node`
  Called after the node has been made the current node. It indicates that child nodes can now be added to it.

  Specified by:
    `jjtOpen` in interface `Node`

### jjtClose

    public void jjtClose()

  Description copied from interface: `Node`
  Called after all the child nodes have been added.

  Specified by:
    `jjtClose` in interface `Node`

### jjtSetParent

    public void jjtSetParent(Node n)

  Description copied from interface: `Node`
  This pair of methods are used to inform the node of its parent.

  Specified by:
    `jjtSetParent` in interface `Node`

### jjtGetParent

    public Node jjtGetParent()

  Specified by:
    `jjtGetParent` in interface `Node`

### jjtAddChild

    public void jjtAddChild(Node n,
                            int i)

  Description copied from interface: `Node`
  This method tells the node to add its argument to the node's list of children.

  Specified by:
    `jjtAddChild` in interface `Node`

### jjtGetChild

    public Node jjtGetChild(int i)

  Description copied from interface: `Node`
  This method returns a child node. The children are numbered from zero, left to right.

  Specified by:
    `jjtGetChild` in interface `Node`

### jjtGetNumChildren

    public final int jjtGetNumChildren()

  Description copied from interface: `Node`
  Return the number of children the node has.

  Specified by:
    `jjtGetNumChildren` in interface `Node`

### evaluateNode

    protected abstract java.lang.Object evaluateNode(java.lang.Object o)
                                              throws java.lang.Exception

  Evaluates itself with object, pushing result on the stack.

  Throws:
    `java.lang.Exception`

### connectChildren

    protected void connectChildren()

  Sets the parent to this for all children.

  Since:
    3.0

### evaluateChild

    protected java.lang.Object evaluateChild(int index,
                                             java.lang.Object o)
                                      throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### notExp

    public Expression notExp()

  Description copied from class: `Expression`
  Returns a logical NOT of current expression.

  Specified by:
    `notExp` in class `Expression`

### evaluate

    public java.lang.Object evaluate(java.lang.Object o)

  Description copied from class: `Expression`
  Calculates expression value with object as a context for path expressions.

  Specified by:
    `evaluate` in class `Expression`

### encodeAsEJBQL

    public void encodeAsEJBQL(java.io.PrintWriter pw,
                              java.lang.String rootId)

  Description copied from class: `Expression`
  Stores a String representation of Expression as EJBQL using a provided PrintWriter. DB path expressions produce non-standard EJBQL path expressions.

  Specified by:
    `encodeAsEJBQL` in class `Expression`
  Since:
    3.0

### encodeChildrenAsEJBQL

    protected void encodeChildrenAsEJBQL(java.io.PrintWriter pw,
                                         java.lang.String rootId)

  Encodes child of this node with specified index to EJBQL

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.