@Override public boolean equals(Object other) { if (other instanceof GroupElem) { GroupElem o = (GroupElem)other; return name.equals(o.getName()) && operator.equals(o.getOperator()); } return false; }
public GroupElem(String name, AggregateOperator operator) { setName(name); setOperator(operator); }
@Override public <X extends Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X { super.visitChildren(visitor); for (GroupElem ge : groupElements) { ge.visit(visitor); } }
@Override public GroupElem clone() { GroupElem clone = (GroupElem)super.clone(); clone.setOperator(getOperator().clone()); return clone; } }
for(final GroupElem groupElem : aggNode.getGroupElements()) { final AggregateOperator operator = groupElem.getOperator(); final Optional<AggregationType> type = AggregationType.byOperatorClass( operator.getClass() ); final String resultBindingName = groupElem.getName(); groupElem.visitChildren(new AbstractQueryModelVisitor<RuntimeException>() { @Override public void meet(final Var node) {
group.addGroupElement(new GroupElem(projName, op));
public Set<String> getAggregateBindingNames() { Set<String> bindings = new HashSet<String>(); for (GroupElem binding : groupElements) { bindings.add(binding.getName()); } return bindings; }
@Override public Group clone() { Group clone = (Group)super.clone(); clone.groupBindings = new LinkedHashSet<>(getGroupBindingNames()); clone.groupElements = new ArrayList<>(getGroupElements().size()); for (GroupElem ge : getGroupElements()) { clone.addGroupElement(ge.clone()); } return clone; }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (operator == current) { setOperator((AggregateOperator)replacement); } else { super.replaceChildNode(current, replacement); } }
for(final GroupElem groupElem : group.getGroupElements()) { final AggregateOperator operator = groupElem.getOperator(); final Optional<AggregationType> type = AggregationType.byOperatorClass( operator.getClass() ); final String resultBindingName = groupElem.getName(); groupElem.visitChildren(new AbstractQueryModelVisitor<RuntimeException>() { @Override public void meet(final Var node) {
@Override public GroupElem clone() { GroupElem clone = (GroupElem)super.clone(); clone.setOperator(getOperator().clone()); return clone; } }
GroupElem ge = new GroupElem(alias, operator); group.addGroupElement(ge);
public Set<String> getAggregateBindingNames() { Set<String> bindings = new HashSet<>(); for (GroupElem binding : groupElements) { bindings.add(binding.getName()); } return bindings; }
@Override public Group clone() { Group clone = (Group)super.clone(); clone.groupBindings = new LinkedHashSet<String>(getGroupBindingNames()); clone.groupElements = new ArrayList<GroupElem>(getGroupElements().size()); for (GroupElem ge : getGroupElements()) { clone.addGroupElement(ge.clone()); } return clone; }
@Override public void replaceChildNode(QueryModelNode current, QueryModelNode replacement) { if (operator == current) { setOperator((AggregateOperator)replacement); } else { super.replaceChildNode(current, replacement); } }
@Override public boolean equals(Object other) { if (other instanceof GroupElem) { GroupElem o = (GroupElem)other; return name.equals(o.getName()) && operator.equals(o.getOperator()); } return false; }
GroupElem ge = new GroupElem(alias, operator); group.addGroupElement(ge);
public GroupElem(String name, AggregateOperator operator) { setName(name); setOperator(operator); }
@Override public <X extends Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X { super.visitChildren(visitor); for (GroupElem ge : groupElements) { ge.visit(visitor); } }
private Map<String, Aggregate> getAggregates() throws ValueExprEvaluationException, QueryEvaluationException { Map<String, Aggregate> result = aggregates; if (result == null) { synchronized (this) { result = aggregates; if (result == null) { result = aggregates = new LinkedHashMap<String, Aggregate>(); for (GroupElem ge : group.getGroupElements()) { Aggregate create = create(ge.getOperator()); if (create != null) { aggregates.put(ge.getName(), create); } } } } } return result; }