Search in sources :

Example 1 with WhereNode

use of org.ballerinalang.model.tree.clauses.WhereNode in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangStreamingInput streamingInput) {
    streamingInputClause = new StringBuilder();
    streamingInputClause.append(((BLangSimpleVarRef) streamingInput.getStreamReference()).getVariableName().value);
    WhereNode beforeWhereNode = streamingInput.getBeforeStreamingCondition();
    WhereNode afterWhereNode = streamingInput.getAfterStreamingCondition();
    WindowClauseNode windowClauseNode = streamingInput.getWindowClause();
    if (beforeWhereNode != null) {
        ((BLangWhere) beforeWhereNode).accept(this);
        streamingInputClause.append(" ").append(whereClause);
    }
    if (windowClauseNode != null) {
        ((BLangWindow) windowClauseNode).accept(this);
        streamingInputClause.append(" ").append(windowClause);
    }
    if (afterWhereNode != null) {
        ((BLangWhere) afterWhereNode).accept(this);
        streamingInputClause.append(" ").append(whereClause);
    }
    if (streamingInput.getAlias() != null) {
        streamingInputClause.append(" as ").append(streamingInput.getAlias()).append(" ");
    }
    BLangExpression streamReference = (BLangExpression) streamingInput.getStreamReference();
    if (streamReference != null) {
        streamReference.accept(this);
        streamIds.add(varRef);
        varRef = "";
        addInRefs(streamReference);
    }
}
Also used : BLangSimpleVarRef(org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef) BLangWindow(org.wso2.ballerinalang.compiler.tree.clauses.BLangWindow) WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) WindowClauseNode(org.ballerinalang.model.tree.clauses.WindowClauseNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 2 with WhereNode

use of org.ballerinalang.model.tree.clauses.WhereNode in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangStreamingInput streamingInput) {
    BLangExpression streamRef = (BLangExpression) streamingInput.getStreamReference();
    typeChecker.checkExpr(streamRef, env);
    WhereNode beforeWhereNode = streamingInput.getBeforeStreamingCondition();
    if (beforeWhereNode != null) {
        ((BLangWhere) beforeWhereNode).accept(this);
    }
    WindowClauseNode windowClauseNode = streamingInput.getWindowClause();
    if (windowClauseNode != null) {
        ((BLangWindow) windowClauseNode).accept(this);
    }
    WhereNode afterWhereNode = streamingInput.getAfterStreamingCondition();
    if (afterWhereNode != null) {
        ((BLangWhere) afterWhereNode).accept(this);
    }
}
Also used : BLangWindow(org.wso2.ballerinalang.compiler.tree.clauses.BLangWindow) WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) WindowClauseNode(org.ballerinalang.model.tree.clauses.WindowClauseNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 3 with WhereNode

use of org.ballerinalang.model.tree.clauses.WhereNode in project ballerina by ballerina-lang.

the class SiddhiQueryBuilder method visit.

@Override
public void visit(BLangPatternStreamingEdgeInput patternStreamingEdgeInput) {
    BLangExpression streamRef = (BLangExpression) patternStreamingEdgeInput.getStreamReference();
    streamRef.accept(this);
    streamIds.add(varRef);
    varRef = "";
    addInRefs(streamRef);
    String alias = patternStreamingEdgeInput.getAliasIdentifier();
    patternStreamingClause.append(alias).append(" = ").append(patternStreamingEdgeInput.getStreamReference());
    WhereNode whereNode = patternStreamingEdgeInput.getWhereClause();
    if (whereNode != null) {
        ((BLangWhere) whereNode).accept(this);
        patternStreamingClause.append(" ").append(whereClause);
        whereClause = new StringBuilder();
    }
    ExpressionNode expression = patternStreamingEdgeInput.getExpression();
    if (expression != null) {
        ((BLangExpression) expression).accept(this);
        patternStreamingClause.append(intRangeExpr.toString());
    }
}
Also used : SelectExpressionNode(org.ballerinalang.model.tree.clauses.SelectExpressionNode) ExpressionNode(org.ballerinalang.model.tree.expressions.ExpressionNode) WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 4 with WhereNode

use of org.ballerinalang.model.tree.clauses.WhereNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method endWhereClauseNode.

public void endWhereClauseNode(DiagnosticPos pos, Set<Whitespace> ws) {
    WhereNode whereNode = this.whereClauseStack.peek();
    ((BLangWhere) whereNode).pos = pos;
    whereNode.addWS(ws);
    whereNode.setExpression(exprNodeStack.pop());
}
Also used : WhereNode(org.ballerinalang.model.tree.clauses.WhereNode)

Example 5 with WhereNode

use of org.ballerinalang.model.tree.clauses.WhereNode in project ballerina by ballerina-lang.

the class BLangPackageBuilder method startWhereClauseNode.

public void startWhereClauseNode(DiagnosticPos pos, Set<Whitespace> ws) {
    WhereNode whereNode = TreeBuilder.createWhereNode();
    ((BLangWhere) whereNode).pos = pos;
    whereNode.addWS(ws);
    this.whereClauseStack.push(whereNode);
}
Also used : WhereNode(org.ballerinalang.model.tree.clauses.WhereNode)

Aggregations

WhereNode (org.ballerinalang.model.tree.clauses.WhereNode)6 BLangWhere (org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere)4 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)4 WindowClauseNode (org.ballerinalang.model.tree.clauses.WindowClauseNode)2 BLangWindow (org.wso2.ballerinalang.compiler.tree.clauses.BLangWindow)2 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)1 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)1 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)1