public abstract class GroupingOperation extends GroupingNode
fromString(String)
method to generate one from a query-string. To execute, assign it to a GroupingRequest
using the GroupingRequest.setRootOperation(GroupingOperation)
method.Modifier | Constructor and Description |
---|---|
protected |
GroupingOperation(GroupingOperation parentOfCopy,
String image,
String label,
List<GroupingExpression> orderBy,
List<GroupingExpression> outputs,
List<GroupingOperation> children,
Map<String,GroupingExpression> aliases,
Set<String> hints,
GroupingExpression groupBy,
String where,
boolean forceSinglePass,
double accuracy,
int precision,
int level,
int max) |
protected |
GroupingOperation(String image,
String label) |
Modifier and Type | Method and Description |
---|---|
GroupingOperation |
addChild(GroupingOperation op)
Adds a child grouping node to this.
|
GroupingOperation |
addChildren(List<GroupingOperation> lst)
Convenience method to call
addChild(GroupingOperation) for each element in the given list. |
GroupingOperation |
addHint(String hint)
Adds a hint to this.
|
GroupingOperation |
addOrderBy(GroupingExpression exp)
Adds an expression to the order-by clause of this operation.
|
GroupingOperation |
addOrderBy(List<GroupingExpression> lst)
Convenience method to call
addOrderBy(GroupingExpression) for each element in the given list. |
GroupingOperation |
addOutput(GroupingExpression exp)
Adds an expression to the output clause of this operation.
|
GroupingOperation |
addOutputs(List<GroupingExpression> lst)
Convenience method to call
addOutput(GroupingExpression) for each element in the given list. |
boolean |
containsHint(String hint)
Returns whether or not the given hint has been added to this.
|
abstract GroupingOperation |
copy(GroupingOperation parentOfCopy)
Returns a deep copy of this
|
static GroupingOperation |
fromString(String str)
Convenience method to call
fromStringAsList(String) and assert that the list contains exactly one
grouping operation. |
static List<GroupingOperation> |
fromStringAsList(String str)
Parses the given string as a list of grouping operations.
|
double |
getAccuracy()
Return the accuracy of this.
|
GroupingExpression |
getAlias(String id)
Returns the alias associated with the given name.
|
protected Map<String,GroupingExpression> |
getAliases()
Returns a direct, mutable copy of the aliases of this, never null
|
GroupingOperation |
getChild(int i)
Returns the child operation at the given index.
|
List<GroupingOperation> |
getChildren()
Returns an immutable view to the child list of this node.
|
boolean |
getForceSinglePass() |
GroupingExpression |
getGroupBy()
Returns the expression assigned as the group-by clause of this.
|
Set<String> |
getHints()
Returns an immutable view to the hint list of this node.
|
int |
getLevel()
Returns the conceptual level of this node.
|
static String |
getLevelDesc(int level)
Returns a description of the given level.
|
int |
getMax()
Returns the max clause of this.
|
int |
getNumChildren()
Returns the number of child operations of this.
|
int |
getNumOrderBy()
Returns the number of expressions in the order-by clause of this.
|
int |
getNumOutputs()
Returns the number of expressions in the output clause of this.
|
List<GroupingExpression> |
getOrderBy()
Returns an immutable view to the order-by clause of this.
|
GroupingExpression |
getOrderBy(int i)
Returns the group-by expression at the given index.
|
GroupingExpression |
getOutput(int i)
Returns the output expression at the given index.
|
List<GroupingExpression> |
getOutputs()
Returns an immutable view to the output clause of this.
|
protected GroupingOperation |
getParent()
Returns the parent of this, or null if none
|
int |
getPrecision()
Returns the precision clause of this.
|
String |
getWhere()
Returns the where clause assigned to this operation.
|
boolean |
hasMax()
Indicates if the 'max' value has been set.
|
GroupingOperation |
putAlias(String id,
GroupingExpression exp)
Registers an alias with this operation.
|
void |
resolveLevel(int level)
Resolves the conceptual level of this operation.
|
GroupingOperation |
setAccuracy(double accuracy)
Assigns an accuracy value for this.
|
GroupingOperation |
setForceSinglePass(boolean forceSinglePass) |
GroupingOperation |
setGroupBy(GroupingExpression exp)
Assigns an expressions as the group-by clause of this operation.
|
GroupingOperation |
setLabel(String label)
Assigns a label to this grouping expression.
|
GroupingOperation |
setMax(int max)
Assigns the max clause of this.
|
GroupingOperation |
setPrecision(int precision)
Assigns the precision clause of this.
|
GroupingOperation |
setWhere(String str)
Assigns a string as the where clause of this operation.
|
String |
toString() |
void |
visitExpressions(ExpressionVisitor visitor)
Recursively calls
GroupingExpression.visit(ExpressionVisitor) on all GroupingExpression objects
in this operation and in all of its child operations. |
getImage, getLabel
protected GroupingOperation(GroupingOperation parentOfCopy, String image, String label, List<GroupingExpression> orderBy, List<GroupingExpression> outputs, List<GroupingOperation> children, Map<String,GroupingExpression> aliases, Set<String> hints, GroupingExpression groupBy, String where, boolean forceSinglePass, double accuracy, int precision, int level, int max)
public abstract GroupingOperation copy(GroupingOperation parentOfCopy)
public GroupingOperation putAlias(String id, GroupingExpression exp)
id
- The id of the alias to put.exp
- The expression to associate with the id.public GroupingExpression getAlias(String id)
id
- The id of the alias to return.protected Map<String,GroupingExpression> getAliases()
public GroupingOperation addHint(String hint)
hint
- The hint to add.public boolean containsHint(String hint)
hint
- The hint to check for.public Set<String> getHints()
public GroupingOperation addChild(GroupingOperation op)
op
- The child node to add.public GroupingOperation addChildren(List<GroupingOperation> lst)
addChild(GroupingOperation)
for each element in the given list.lst
- The list of operations to add.public int getNumChildren()
public GroupingOperation getChild(int i)
i
- The index of the child to return.IndexOutOfBoundsException
- If the index is out of range.public List<GroupingOperation> getChildren()
public GroupingOperation setGroupBy(GroupingExpression exp)
exp
- The expression to assign to this.public GroupingExpression getGroupBy()
public int getLevel()
resolveLevel(int)
public void resolveLevel(int level)
level
- The level of the input data.IllegalArgumentException
- Thrown if a contained expression is invalid for the given level.protected GroupingOperation getParent()
public GroupingOperation setForceSinglePass(boolean forceSinglePass)
public boolean getForceSinglePass()
public GroupingOperation setMax(int max)
max
- The expression to assign to this.setPrecision(int)
public int getMax()
setMax(int)
public boolean hasMax()
public GroupingOperation setAccuracy(double accuracy)
accuracy
- The accuracy to assign to this.IllegalArgumentException
- If the accuracy is outside the allowed value range.public double getAccuracy()
setAccuracy(double)
public GroupingOperation addOrderBy(GroupingExpression exp)
exp
- The expressions to add to this.public GroupingOperation addOrderBy(List<GroupingExpression> lst)
addOrderBy(GroupingExpression)
for each element in the given list.lst
- The list of expressions to add.public int getNumOrderBy()
public GroupingExpression getOrderBy(int i)
i
- The index of the expression to return.IndexOutOfBoundsException
- If the index is out of range.public List<GroupingExpression> getOrderBy()
public GroupingOperation addOutput(GroupingExpression exp)
exp
- The expressions to add to this.public GroupingOperation addOutputs(List<GroupingExpression> lst)
addOutput(GroupingExpression)
for each element in the given list.lst
- The list of expressions to add.public int getNumOutputs()
public GroupingExpression getOutput(int i)
i
- The index of the expression to return.IndexOutOfBoundsException
- If the index is out of range.public List<GroupingExpression> getOutputs()
public GroupingOperation setPrecision(int precision)
precision
- The precision to set.setMax(int)
public int getPrecision()
public GroupingOperation setWhere(String str)
str
- The string to assign to this.public String getWhere()
public void visitExpressions(ExpressionVisitor visitor)
GroupingExpression.visit(ExpressionVisitor)
on all GroupingExpression
objects
in this operation and in all of its child operations.visitor
- The visitor to call.public GroupingOperation setLabel(String label)
GroupingNode
setLabel
in class GroupingNode
label
- The label to assign to this.public String toString()
toString
in class GroupingNode
public static String getLevelDesc(int level)
level
- The level to describe.public static GroupingOperation fromString(String str)
fromStringAsList(String)
and assert that the list contains exactly one
grouping operation.str
- The string to parse.IllegalArgumentException
- Thrown if the string could not be parsed as a single operation.public static List<GroupingOperation> fromStringAsList(String str)
str
- The string to parse.IllegalArgumentException
- Thrown if the string could not be parsed.Copyright © 2018. All rights reserved.