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 and Type | Field and Description |
---|---|
private double |
accuracy |
private Map<String,GroupingExpression> |
alias |
private List<GroupingOperation> |
children |
private boolean |
forceSinglePass |
private GroupingExpression |
groupBy |
private Set<String> |
hints |
private int |
level |
private int |
max |
private List<GroupingExpression> |
orderBy |
private List<GroupingExpression> |
outputs |
private GroupingOperation |
parent |
private int |
precision |
private String |
where |
Modifier | Constructor and Description |
---|---|
protected |
GroupingOperation(String image) |
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.
|
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.
|
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.
|
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. |
getLabel
private final List<GroupingExpression> orderBy
private final List<GroupingExpression> outputs
private final List<GroupingOperation> children
private final Map<String,GroupingExpression> alias
private GroupingExpression groupBy
private GroupingOperation parent
private String where
private boolean forceSinglePass
private double accuracy
private int precision
private int level
private int max
protected GroupingOperation(String image)
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.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.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 © 2017. All rights reserved.