ASTAvg (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.exp.parser, class: ASTAvg

# Class ASTAvg

java.lang.Object
org.apache.cayenne.exp.Expression
org.apache.cayenne.exp.parser.SimpleNode
org.apache.cayenne.exp.parser.EvaluatedNode
org.apache.cayenne.exp.parser.ASTFunctionCall
org.apache.cayenne.exp.parser.ASTAggregateFunctionCall
org.apache.cayenne.exp.parser.ASTAvg

All Implemented Interfaces:
  `Serializable, Node, XMLSerializable`

public class ASTAvg extends ASTAggregateFunctionCall

Since:
  4.0
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class ASTFunctionCall

  `functionName`
  Modifier and Type
  Field
  Description
  `protected String`
  `functionName`

  ### Fields inherited from class SimpleNode

  `children, id, parent`
  Modifier and Type
  Field
  Description
  `protected Node[]`
  `children`
  `protected int`
  `id`
  `protected Node`
  `parent`

  ### Fields inherited from class Expression

  `ADD, ALL, AND, ANY, ASTERISK, BETWEEN, BITWISE_AND, BITWISE_LEFT_SHIFT, BITWISE_NOT, BITWISE_OR, BITWISE_RIGHT_SHIFT, BITWISE_XOR, CASE_WHEN, CUSTOM_OP, DB_PATH, DBID_PATH, DIVIDE, ELSE, ENCLOSING_OBJECT, EQUAL_TO, EXISTS, FALSE, FULL_OBJECT, FUNCTION_CALL, 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_EXISTS, NOT_IN, NOT_LIKE, NOT_LIKE_IGNORE_CASE, OBJ_PATH, OR, PRUNED_NODE, SCALAR, SUBQUERY, SUBTRACT, THEN, TRUE, type, WHEN`
  Modifier and Type
  Field
  Description
  `static final int`
  `ADD`
  `static final int`
  `ALL`
  `static final int`
  `AND`
  `static final int`
  `ANY`
  `static final int`
  `ASTERISK`
  `static final int`
  `BETWEEN`
  `static final int`
  `BITWISE_AND`
  `static final int`
  `BITWISE_LEFT_SHIFT`
  `static final int`
  `BITWISE_NOT`
  `static final int`
  `BITWISE_OR`
  `static final int`
  `BITWISE_RIGHT_SHIFT`
  `static final int`
  `BITWISE_XOR`
  `static final int`
  `CASE_WHEN`
  `static final int`
  `CUSTOM_OP`
  `static final int`
  `DB_PATH`
  Expression describes a path relative to a DbEntity.
  `static final int`
  `DBID_PATH`
  `static final int`
  `DIVIDE`
  `static final int`
  `ELSE`
  `static final int`
  `ENCLOSING_OBJECT`
  `static final int`
  `EQUAL_TO`
  `static final int`
  `EXISTS`
  `static final int`
  `FALSE`
  `static final int`
  `FULL_OBJECT`
  `static final int`
  `FUNCTION_CALL`
  `static final int`
  `GREATER_THAN`
  `static final int`
  `GREATER_THAN_EQUAL_TO`
  `static final int`
  `IN`
  `static final int`
  `LESS_THAN`
  `static final int`
  `LESS_THAN_EQUAL_TO`
  `static final int`
  `LIKE`
  `static final int`
  `LIKE_IGNORE_CASE`
  `static final int`
  `LIST`
  Interpreted as a comma-separated list of literals.
  `static final int`
  `MULTIPLY`
  `static final int`
  `NEGATIVE`
  `static final int`
  `NOT`
  `static final int`
  `NOT_BETWEEN`
  `static final int`
  `NOT_EQUAL_TO`
  `static final int`
  `NOT_EXISTS`
  `static final int`
  `NOT_IN`
  `static final int`
  `NOT_LIKE`
  `static final int`
  `NOT_LIKE_IGNORE_CASE`
  `static final int`
  `OBJ_PATH`
  Expression describes a path relative to an ObjEntity.
  `static final int`
  `OR`
  `static final Object`
  `PRUNED_NODE`
  A value that a Transformer might return to indicate that a node has to be pruned from the expression during the transformation.
  `static final int`
  `SCALAR`
  `static final int`
  `SUBQUERY`
  `static final int`
  `SUBTRACT`
  `static final int`
  `THEN`
  `static final int`
  `TRUE`
  `protected int`
  `type`
  `static final int`
  `WHEN`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ASTAvg(Expression expression)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Object`
  `evaluateCollection(Collection<?> values)`
  `Expression`
  `shallowCopy()`
  Creates a copy of this expression node, without copying children.

  ### Methods inherited from class ASTAggregateFunctionCall

  `evaluateNode, evaluateSubNode, getRequiredChildrenCount`
  Modifier and Type
  Method
  Description
  `protected Object`
  `evaluateNode(Object o)`
  Evaluates itself with object, pushing result on the stack.
  `protected Object`
  `evaluateSubNode(Object o, Object[] evaluatedChildren)`
  `protected int`
  `getRequiredChildrenCount()`

  ### Methods inherited from class ASTFunctionCall

  `appendAsEJBQL, appendAsString, appendFunctionNameAsString, equals, getExpressionOperator, getFunctionName, getType, hashCode, nameToCamelCase, needParenthesis, setFunctionName`
  Modifier and Type
  Method
  Description
  `void`
  `appendAsEJBQL(List<Object> parameterAccumulator, Appendable out, String rootId)`
  Stores a String representation of Expression as EJBQL using a provided PrintWriter.
  `void`
  `appendAsString(Appendable out)`
  Appends own content as a String to the provided Appendable.
  `protected void`
  `appendFunctionNameAsString(Appendable out)`
  `boolean`
  `equals(Object o)`
  `protected String`
  `getExpressionOperator(int index)`
  `String`
  `getFunctionName()`
  `int`
  `getType()`
  Returns a type of expression.
  `int`
  `hashCode()`
  `protected static String`
  `nameToCamelCase(String functionName)`
  `boolean`
  `needParenthesis()`
  `protected void`
  `setFunctionName(String functionName)`

  ### Methods inherited from class SimpleNode

  `appendAsEJBQL, appendAsEscapedString, appendChildrenAsEJBQL, appendScalarAsString, connectChildren, encodeScalarAsEJBQL, evaluate, evaluateChild, exists, expName, flattenTree, getEJBQLExpressionOperator, getOperand, getOperandCount, getPathAliases, isValidParent, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, notExists, notExp, numericToString, pruneNodeForPrunedChild, setOperand, unwrapChild, wrapChild`
  Modifier and Type
  Method
  Description
  `void`
  `appendAsEJBQL(Appendable out, String rootId)`
  Stores a String representation of Expression as EJBQL using a provided Appendable.
  `protected static void`
  `appendAsEscapedString(Appendable out, String source)`
  Utility method that prints a string to the provided Appendable, escaping special characters.
  `protected void`
  `appendChildrenAsEJBQL(List<Object> parameterAccumulator, Appendable out, String rootId)`
  Encodes child of this node with specified index to EJBQL
  `protected static void`
  `appendScalarAsString(Appendable out, Object scalar, char quoteChar)`
  Utility method that encodes an object that is not an expression Node to String.
  `protected void`
  `connectChildren()`
  Sets the parent to this for all children.
  `protected static void`
  `encodeScalarAsEJBQL(List<Object> parameterAccumulator, Appendable out, Object scalar)`
  This is a utility method that can represent the supplied scalar as either an EJBQL literal into the supplied `PrintWriter` or is able to add the scalar to the parameters and to instead write a positional parameter to the EJBQL written to the `PrintWriter`.
  `Object`
  `evaluate(Object o)`
  Calculates expression value with object as a context for path expressions.
  `protected Object`
  `evaluateChild(int index, Object o)`
  `Expression`
  `exists()`
  Returns expression that will be dynamically resolved to proper subqueries based on a relationships used (if no relationships are present in the original expression no subqueries will be used).
  `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 EJBQL statements, which can differ for Cayenne expression operator
  `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.
  `protected boolean`
  `isValidParent(Node n)`
  Additional parent check that we can't handle properly in the grammar By default it just returns true.
  `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.
  `final 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`
  `notExists()`
  Returns expression that will be dynamically resolved to proper subqueries based on a relationships used (if no relationships are present in the original expression no subqueries will be used).
  `Expression`
  `notExp()`
  Returns a logical NOT of current expression.
  `protected static String`
  `numericToString(Number number)`
  `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)`

  ### Methods inherited from class Expression

  `andExp, andExp, deepCopy, encodeAsXML, filter, filterObjects, first, joinExp, joinExp, match, orExp, orExp, params, params, paramsArray, setType, toEJBQL, toEJBQL, toString, transform, transformExpression, traverse, traverse`
  Modifier and Type
  Method
  Description
  `Expression`
  `andExp(Expression exp)`
  Chains this expression with another expression using "and".
  `Expression`
  `andExp(Expression exp, Expression... expressions)`
  Chains this expression with other expressions using "and".
  `Expression`
  `deepCopy()`
  Clones this expression.
  `void`
  `encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate)`
  Encodes itself, wrapping the string into XML CDATA section.
  `<T> Collection<?>`
  `filter(Collection<T> source, Collection<T> target)`
  Adds objects matching this expression from the source collection to the target collection.
  `<T> List<T>`
  `filterObjects(Collection<T> objects)`
  Returns a list of objects that match the expression.
  `<T> T`
  `first(List<T> objects)`
  Returns the first object in the list that matches the expression.
  `Expression`
  `joinExp(int type, Expression exp)`
  Creates a new expression that joins this object with another expression, using specified join type.
  `Expression`
  `joinExp(int type, Expression exp, Expression... expressions)`
  Creates a new expression that joins this object with other expressions, using specified join type.
  `boolean`
  `match(Object o)`
  Calculates expression boolean value with object as a context for path expressions.
  `Expression`
  `orExp(Expression exp)`
  Chains this expression with another expression using "or".
  `Expression`
  `orExp(Expression exp, Expression... expressions)`
  Chains this expression with other expressions using "or".
  `Expression`
  `params(Map<String,?> parameters)`
  Creates and returns a new Expression instance based on this expression, but with named parameters substituted with provided values.
  `Expression`
  `params(Map<String,?> parameters, boolean pruneMissing)`
  Creates and returns a new Expression instance based on this expression, but with named parameters substituted with provided values.If any subexpressions containing parameters not matching the "name" argument are found, the behavior depends on "pruneMissing" argument.
  `Expression`
  `paramsArray(Object... parameters)`
  Creates and returns a new Expression instance based on this expression, but with parameters substituted with provided values.
  `void`
  `setType(int type)`
  `String`
  `toEJBQL(String rootId)`
  Produces an EJBQL string that represents this expression.
  `String`
  `toEJBQL(List<Object> parameterAccumulator, String rootId)`
  Produces an EJBQL string that represents this expression.
  `String`
  `toString()`
  `Expression`
  `transform(Function<Object,Object> transformer)`
  Creates a transformed copy of this expression, applying transformation provided by Transformer to all its nodes.
  `protected Object`
  `transformExpression(Function<Object,Object> transformer)`
  A recursive method called from "transform" to do the actual transformation.
  `protected void`
  `traverse(Expression parentExp, TraversalHandler visitor)`
  Traverses itself and child expressions, notifying visitor via callback methods as it goes.
  `void`
  `traverse(TraversalHandler visitor)`
  Traverses itself and child expressions, notifying visitor via callback methods as it goes.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ASTAvg

    public ASTAvg(Expression expression)

- ## Method Details

  - ### shallowCopy

    public Expression shallowCopy()
    Description copied from class: `Expression`
    Creates a copy of this expression node, without copying children.
    Specified by:
      `shallowCopy` in class `Expression`

  - ### evaluateCollection

    protected Object evaluateCollection(Collection<?> values)
    Overrides:
      `evaluateCollection` in class `ASTAggregateFunctionCall`