public void addEagerVertexBinding()

in asterix-graphix/src/main/java/org/apache/asterix/graphix/lang/rewrite/lower/struct/ClauseCollection.java [97:128]


    public void addEagerVertexBinding(VariableExpr representativeVariable, LetClause vertexBinding)
            throws CompilationException {
        // An eager vertex binding should be found in the non-representative clauses...
        boolean isIllegalVertexBinding = true;
        for (AbstractClause nonRepresentativeClause : nonRepresentativeClauses) {
            if (nonRepresentativeClause.getClauseType() != Clause.ClauseType.LET_CLAUSE) {
                continue;
            }
            LetClause nonRepresentativeLetClause = (LetClause) nonRepresentativeClause;
            if (nonRepresentativeLetClause.getBindingExpr().equals(vertexBinding.getBindingExpr())) {
                isIllegalVertexBinding = false;
                break;
            }
        }
        if (isIllegalVertexBinding) {
            throw new CompilationException(ErrorCode.COMPILATION_ILLEGAL_STATE, "Illegal eager vertex binding added!");
        }

        // ... and the representative vertex bindings.
        isIllegalVertexBinding = true;
        for (LetClause representativeVertexBinding : representativeVertexBindings) {
            if (representativeVertexBinding.getBindingExpr().equals(vertexBinding.getBindingExpr())
                    && representativeVariable.equals(representativeVertexBinding.getVarExpr())) {
                isIllegalVertexBinding = false;
                break;
            }
        }
        if (isIllegalVertexBinding) {
            throw new CompilationException(ErrorCode.COMPILATION_ILLEGAL_STATE, "Illegal eager vertex binding added!");
        }
        eagerVertexBindings.add(new Pair<>(representativeVariable, vertexBinding));
    }