Search in sources :

Example 6 with StateElement

use of org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitPattern_stream.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitPattern_stream(@NotNull SiddhiQLParser.Pattern_streamContext ctx) {
    // pattern_stream
    // : every_pattern_source_chain
    // | every_absent_pattern_source_chain
    // ;
    StateElement stateElement;
    if (ctx.every_pattern_source_chain() != null) {
        stateElement = ((StateElement) visit(ctx.every_pattern_source_chain()));
    } else {
        stateElement = ((StateElement) visit(ctx.absent_pattern_source_chain()));
    }
    StateInputStream stateInputStream = new StateInputStream(StateInputStream.Type.PATTERN, stateElement);
    populateQueryContext(stateInputStream, ctx);
    return stateInputStream;
}
Also used : EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement) StateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement) AbsentStreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) CountStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement) StateInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.StateInputStream)

Example 7 with StateElement

use of org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitEvery_absent_sequence_source_chain.

@Override
public Object visitEvery_absent_sequence_source_chain(SiddhiQLParser.Every_absent_sequence_source_chainContext ctx) {
    // every_absent_sequence_source_chain
    // : EVERY? absent_sequence_source_chain  within_time? ',' sequence_source_chain
    // | EVERY? sequence_source  within_time? ',' absent_sequence_source_chain
    // ;
    StateElement stateElement1;
    StateElement stateElement2;
    if (ctx.EVERY() != null) {
        stateElement1 = new EveryStateElement((StateElement) visit(ctx.getChild(1)));
    } else {
        stateElement1 = (StateElement) visit(ctx.getChild(0));
    }
    if (ctx.within_time() != null) {
        stateElement1.setWithin((TimeConstant) visit(ctx.within_time()));
    }
    stateElement2 = (StateElement) visit(ctx.getChild(ctx.getChildCount() - 1));
    populateQueryContext(stateElement1, ctx);
    populateQueryContext(stateElement2, ctx);
    NextStateElement nextStateElement = new NextStateElement(stateElement1, stateElement2);
    populateQueryContext(nextStateElement, ctx);
    StateInputStream stateInputStream = new StateInputStream(StateInputStream.Type.SEQUENCE, nextStateElement);
    populateQueryContext(stateInputStream, ctx);
    return stateInputStream;
}
Also used : NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement) StateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement) AbsentStreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) CountStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement) StateInputStream(org.ballerinalang.siddhi.query.api.execution.query.input.stream.StateInputStream) EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 8 with StateElement

use of org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitRight_absent_pattern_source.

@Override
public Object visitRight_absent_pattern_source(SiddhiQLParser.Right_absent_pattern_sourceContext ctx) {
    // ;
    if (ctx.right_absent_pattern_source().size() == 1 && ctx.every_absent_pattern_source() == null && ctx.every_pattern_source_chain() == null) {
        // EVERY? '('right_absent_pattern_source')' within_time?
        StateElement stateElement = (StateElement) visit(ctx.right_absent_pattern_source(0));
        if (ctx.EVERY() != null) {
            stateElement = new EveryStateElement(stateElement);
        }
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else {
        NextStateElement nextStateElement = new NextStateElement((StateElement) visit(ctx.getChild(0)), (StateElement) visit(ctx.getChild(2)));
        populateQueryContext(nextStateElement, ctx);
        return nextStateElement;
    }
}
Also used : NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement) StateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement) AbsentStreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) CountStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement) EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 9 with StateElement

use of org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitAbsent_sequence_source_chain.

@Override
public Object visitAbsent_sequence_source_chain(SiddhiQLParser.Absent_sequence_source_chainContext ctx) {
    // absent_sequence_source_chain
    // : '('absent_sequence_source_chain')' within_time?
    // | basic_absent_pattern_source
    // | left_absent_sequence_source
    // | right_absent_sequence_source
    // ;
    StateElement stateElement;
    if (ctx.absent_sequence_source_chain() != null) {
        stateElement = (StateElement) visit(ctx.absent_sequence_source_chain());
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
    } else {
        stateElement = (StateElement) visit(ctx.getChild(0));
    }
    populateQueryContext(stateElement, ctx);
    return stateElement;
}
Also used : EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement) StateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement) AbsentStreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) CountStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement)

Example 10 with StateElement

use of org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement in project ballerina by ballerina-lang.

the class SiddhiQLBaseVisitorImpl method visitEvery_absent_pattern_source.

@Override
public Object visitEvery_absent_pattern_source(SiddhiQLParser.Every_absent_pattern_sourceContext ctx) {
    // every_absent_pattern_source
    // : EVERY? basic_absent_pattern_source
    // ;
    StateElement stateElement = (StateElement) visit(ctx.basic_absent_pattern_source());
    if (ctx.EVERY() != null) {
        stateElement = new EveryStateElement(stateElement);
    }
    populateQueryContext(stateElement, ctx);
    return stateElement;
}
Also used : EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement) StateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement) AbsentStreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) NextStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement) CountStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement) StreamStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement) EveryStateElement(org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement)

Aggregations

CountStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.CountStateElement)18 EveryStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.EveryStateElement)18 NextStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.NextStateElement)18 StateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.StateElement)18 StreamStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.StreamStateElement)18 AbsentStreamStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)17 StateInputStream (org.ballerinalang.siddhi.query.api.execution.query.input.stream.StateInputStream)4 LogicalStateElement (org.ballerinalang.siddhi.query.api.execution.query.input.state.LogicalStateElement)3 SingleStreamRuntime (org.ballerinalang.siddhi.core.query.input.stream.single.SingleStreamRuntime)2 AbsentStreamPreStateProcessor (org.ballerinalang.siddhi.core.query.input.stream.state.AbsentStreamPreStateProcessor)2 StateStreamRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.StateStreamRuntime)2 StreamPreStateProcessor (org.ballerinalang.siddhi.core.query.input.stream.state.StreamPreStateProcessor)2 CountInnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.CountInnerStateRuntime)2 EveryInnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.EveryInnerStateRuntime)2 InnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.InnerStateRuntime)2 LogicalInnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.LogicalInnerStateRuntime)2 NextInnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.NextInnerStateRuntime)2 StreamInnerStateRuntime (org.ballerinalang.siddhi.core.query.input.stream.state.runtime.StreamInnerStateRuntime)2 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1