Checks for group by.

@param jpqlExpression
the jpql expression
@return true, if successful
480059
public static boolean hasGroupBy(JPQLExpression jpqlExpression)
    {
        if (isSelectStatement(jpqlExpression))
        {
            return ((SelectStatement) jpqlExpression.getQueryStatement()).hasGroupByClause();
        }
        return false;
    }
1308037
public boolean contains(String group, Collection<String> values) {
		final LinkedHashSet<String> valueSet = getValues(group);
		if (CollectionUtil.isEmpty(values) || CollectionUtil.isEmpty(valueSet)) {
			return false;
		}

		return valueSet.containsAll(values);
	}
1170979
public Query groupby(final Expression... groupbyColumns) {
        if (groupbyColumns == null) {
            return this;
        }

        return groupby(Arrays.asList(groupbyColumns));
    }
813508
public static SoyExpression isNonNull(final Expression expr) {
    if (BytecodeUtils.isPrimitive(expr.resultType())) {
      return SoyExpression.TRUE;
    }
    return SoyExpression.forBool(
        new Expression(Type.BOOLEAN_TYPE, expr.features()) {
          @Override
          protected void doGen(CodeBuilder adapter) {
            expr.gen(adapter);
            Label isNull = new Label();
            adapter.ifNull(isNull);
            // non-null
            adapter.pushBoolean(true);
            Label end = new Label();
            adapter.goTo(end);
            adapter.mark(isNull);
            adapter.pushBoolean(false);
            adapter.mark(end);
          }
        });
  }
1217640
@Override
	public boolean hasNext()
	{
		try
		{
			
		
			if(this.resultSet == null)
				return false;
			else if(!this.resultSet.next())
			{
				this.dispose();
				return false;
			}
			return true;
		}
		catch (SQLException e)
		{
			dispose();

			throw new CommunicationException(e.getMessage(),e);
		}
			
	}
1016885
public boolean matchesAny(String... seq) {
        for (String s : seq) {
            if (matches(s))
                return true;
        }
        return false;
    }
110977
public GroupOptions addGroupByQuery(Query query) {

		Assert.notNull(query, "Query for grouping must not be null.");
		groupByQuery.add(query);
		return this;
	}
256045
public boolean checkExistingExpression(
    String topicExpression,
    boolean isWildcarded)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.entry(
          tc,
          "checkExistingExpression",
          new Object[] {topicExpression, new Boolean(isWildcarded)});
    boolean alreadyRegistered = false;

    if(isWildcarded)
    {
      if(_registeredWildcardConsumerMonitors.containsKey(topicExpression))
        alreadyRegistered = true;
    }
    else
    {
      if(_registeredExactConsumerMonitors.containsKey(topicExpression))
        alreadyRegistered = true;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "checkExistingExpression", new Boolean(alreadyRegistered));

    return alreadyRegistered;
  }
1374695
function checkJSONExpression(expression, json) {
  if (! (expression && json)) {
    return false;
  }

  // array expressions never match non-arrays or arrays of a different length.
  if (_.isArray(expression) && !(_.isArray(json) && expression.length === json.length)) {
    return false;
  }

  return _.all(expression, function(v, k) {

    // check "$" properties
    if (k === "$not") return (! checkJSONExpression(v, json));
    if (k === "$unordered") {
      return v.length === json.length && arrayContains(json, v);
    }
    if (k === "$contains") {
      return arrayContains(json, v);
    }
    if (k === "$length" ) return(v === json.length);
    if (k === "$gt") return (json > v);
    if (k === "$gte") return (json >= v);
    if (k === "$lt") return (json < v);
    if (k === "$lte") return (json <= v);

    // check $not-exists
    if (! _.has(json, k)) return (v === "$not-exists");

    // check rest of "$" values.
    if (v === "$exists") return _.has(json, k);
    if (v === "$string") return _.isString(json[k]);
    if (_.isRegExp(v)) return v.test(json[k]);
    if (_.isObject(v)) return checkJSONExpression(v, json[k]);
    if (v === "$date") {
      try {
        new Date(json[k]);
        return true;
      } catch (e) {
        return false;
      }
    }
    if (v === "$int") {
      //http://stackoverflow.com/questions/3885817/how-to-check-if-a-number-is-float-or-integer
      return (typeof json[k] === 'number' && json[k] % 1 === 0);
    }

    // check a strict equals
    return (v === json[k]);
  });
}
1161515
<T extends ListBuffer<? super JCExpressionStatement>> T moreStatementExpressions(int pos,
                                                                    JCExpression first,
                                                                    T stats) {
        // This Exec is a "StatementExpression"; it subsumes no terminating token
        stats.append(toP(F.at(pos).Exec(checkExprStat(first))));
        while (token.kind == COMMA) {
            nextToken();
            pos = token.pos;
            JCExpression t = parseExpression();
            // This Exec is a "StatementExpression"; it subsumes no terminating token
            stats.append(toP(F.at(pos).Exec(checkExprStat(t))));
        }
        return stats;
    }
1367715
@Override
    public boolean hasStatement(Resource subject, URI predicate, Value object, boolean includeInferred, Resource... contexts) throws RepositoryException {
        if(!this.isOpen()){throw new RepositoryException("Connection is closed.");}
        String queryString = null;
        if(contexts == null) {
            queryString="ASK { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (IRI(\""+DEFAULT_GRAPH_URI+"\")))}";
        }else if (contexts.length == 0) {
            queryString = SOMETHING;
        }
        else {
            StringBuilder sb= new StringBuilder();
            sb.append("ASK { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (");
                boolean first = true;
                for (Resource context : contexts) {
                    if (first) {
                        first = !first;
                    }
                    else {
                        sb.append(",");
                    }
                    if (context == null) {
                        sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
                    } else {
                        sb.append("IRI(\"" + context.toString() + "\")");
                    }
                }
                sb.append(") ) }");
            queryString = sb.toString();
        }
        try {
            logger.debug(queryString);
            MarkLogicBooleanQuery query = prepareBooleanQuery(queryString); // baseuri ?

            setBindings(query, subject, predicate, object, contexts);
            return query.evaluate();
        }
        catch (MalformedQueryException e) {
            throw new RepositoryException(e);
        }
        catch (QueryEvaluationException e) {
            throw new RepositoryException(e);
        }
    }
137008
public static boolean hasHaving(JPQLExpression jpqlExpression)
    {
        if (isSelectStatement(jpqlExpression))
        {
            return ((SelectStatement) jpqlExpression.getQueryStatement()).hasHavingClause();
        }
        return false;
    }
1367876
public boolean hasNext() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.next();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
157599
private static boolean checkPureColumnIndex(Index index, int aggCol, List<AbstractExpression> filterExprs) {

        boolean found = false;

        // all left child of filterExprs must be of type TupleValueExpression in equality comparison
        for (AbstractExpression expr : filterExprs) {
            if (expr.getExpressionType() != ExpressionType.COMPARE_EQUAL) {
                return false;
            }
            if (!(expr.getLeft() instanceof TupleValueExpression)) {
                return false;
            }
            if (((TupleValueExpression)expr.getLeft()).getColumnIndex() == aggCol) {
                found = true;
            }
        }

        if (found) {
            return true;
        }
        if (index.getColumns().size() > filterExprs.size()) {
            List<ColumnRef> indexedColRefs = CatalogUtil.getSortedCatalogItems(index.getColumns(), "index");

            if (indexedColRefs.get(filterExprs.size()).getColumn().getIndex() == aggCol) {
                return true;
            }
        }

        return false;
    }
688407
private boolean checkSimpleExpression(String tagExpression, List<String> scenarioTags) {
        Set<String> expressionTags = extractTagsFromSimpleExpression(tagExpression);

        for (String expressionTag : expressionTags) {
            if (expressionTag.startsWith("@")) {
                if (!scenarioTags.contains(expressionTag)) {
                    //this tag is not listed on the scenario so don't execute
                    return false;
                }
            } else if (expressionTag.startsWith("!")) {
                String expressionTagWithoutNot = expressionTag.substring(1, expressionTag.length());
                if (scenarioTags.contains(expressionTagWithoutNot)) {
                    //this is a negated tag and it exists on the scenario so don't execute
                    return false;
                }
            } else {
                throw new IllegalStateException(String.format("'%s' is not a valid tag, no @ or !@ prefix", expressionTag));
            }
        }

        //there are no reasons left for not executing
        return true;
    }
243342
@Override
    public boolean hasNext() {
        if (answerIterator.hasNext()) return true;

        while (conjIterator.hasNext()) {
            answerIterator = conjunctionIterator(conjIterator.next(), tx);
            if (answerIterator.hasNext()) return true;
        }
        return false;
    }
415148
private TermsBuilder processGroupByClause(Expression expression, EntityMetadata entityMetadata, KunderaQuery query)
    {
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                entityMetadata.getPersistenceUnit());
        Expression groupByClause = ((GroupByClause) expression).getGroupByItems();

        if (groupByClause instanceof CollectionExpression)
        {
            logger.error("More than one item found in group by clause.");
            throw new UnsupportedOperationException("Currently, Group By on more than one field is not supported.");
        }

        SelectStatement selectStatement = query.getSelectStatement();

        // To apply terms and tophits aggregation to serve group by
        String jPAField = KunderaCoreUtils.getJPAColumnName(groupByClause.toParsedText(), entityMetadata, metaModel);
        TermsBuilder termsBuilder = AggregationBuilders.terms(ESConstants.GROUP_BY).field(jPAField).size(0);

        // Hard coded value for a max number of record that a group can contain.
        TopHitsBuilder topHitsBuilder = getTopHitsAggregation(selectStatement, null, entityMetadata);
        termsBuilder.subAggregation(topHitsBuilder);

        // To apply the metric aggregations (Min, max... etc) in select clause
        buildSelectAggregations(termsBuilder, query.getSelectStatement(), entityMetadata);

        if (KunderaQueryUtils.hasHaving(query.getJpqlExpression()))
        {
            addHavingClause(((HavingClause) selectStatement.getHavingClause()).getConditionalExpression(),
                    termsBuilder, entityMetadata);
        }

        if (KunderaQueryUtils.hasOrderBy(query.getJpqlExpression()))
        {
            processOrderByClause(termsBuilder, KunderaQueryUtils.getOrderByClause(query.getJpqlExpression()),
                    groupByClause, entityMetadata);
        }

        return termsBuilder;
    }