Search in sources :

Example 1 with StateElement

use of io.siddhi.query.api.execution.query.input.state.StateElement in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitEvery_pattern_source_chain.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitEvery_pattern_source_chain(@NotNull SiddhiQLParser.Every_pattern_source_chainContext ctx) {
    if (ctx.every_pattern_source_chain().size() == 1) {
        // '('every_pattern_source_chain')'
        StateElement stateElement = ((StateElement) visit(ctx.every_pattern_source_chain(0)));
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else if (ctx.every_pattern_source_chain().size() == 2) {
        // every_pattern_source_chain  '->'
        // every_pattern_source_chain
        NextStateElement nextStateElement = new NextStateElement(((StateElement) visit(ctx.every_pattern_source_chain(0))), ((StateElement) visit(ctx.every_pattern_source_chain(1))));
        populateQueryContext(nextStateElement, ctx);
        return nextStateElement;
    } else if (ctx.EVERY() != null) {
        if (ctx.pattern_source_chain() != null) {
            // EVERY '('pattern_source_chain ')'
            EveryStateElement everyStateElement = new EveryStateElement((StateElement) visit(ctx.pattern_source_chain()));
            populateQueryContext(everyStateElement, ctx);
            return everyStateElement;
        } else if (ctx.pattern_source() != null) {
            // EVERY pattern_source
            EveryStateElement everyStateElement = new EveryStateElement((StateElement) visit(ctx.pattern_source()));
            populateQueryContext(everyStateElement, ctx);
            return everyStateElement;
        } else {
            throw newSiddhiParserException(ctx);
        }
    } else if (ctx.pattern_source_chain() != null) {
        // pattern_source_chain
        StateElement stateElement = ((StateElement) visit(ctx.pattern_source_chain()));
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) StateElement(io.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(io.siddhi.query.api.execution.query.input.state.CountStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 2 with StateElement

use of io.siddhi.query.api.execution.query.input.state.StateElement in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitLogical_stateful_source.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public Object visitLogical_stateful_source(@NotNull SiddhiQLParser.Logical_stateful_sourceContext ctx) {
    if (ctx.AND() != null) {
        StreamStateElement streamStateElement1 = (StreamStateElement) visit(ctx.standard_stateful_source(0));
        StreamStateElement streamStateElement2 = (StreamStateElement) visit(ctx.standard_stateful_source(1));
        StateElement stateElement = State.logicalAnd(streamStateElement1, streamStateElement2);
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else if (ctx.OR() != null) {
        StreamStateElement streamStateElement1 = (StreamStateElement) visit(ctx.standard_stateful_source(0));
        StreamStateElement streamStateElement2 = (StreamStateElement) visit(ctx.standard_stateful_source(1));
        StateElement stateElement = State.logicalOr(streamStateElement1, streamStateElement2);
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
Also used : StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) StateElement(io.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(io.siddhi.query.api.execution.query.input.state.CountStateElement)

Example 3 with StateElement

use of io.siddhi.query.api.execution.query.input.state.StateElement in project siddhi by wso2.

the class SiddhiQLBaseVisitorImpl method visitEvery_sequence_source_chain.

@Override
public Object visitEvery_sequence_source_chain(SiddhiQLParser.Every_sequence_source_chainContext ctx) {
    // every_sequence_source_chain
    // : EVERY? sequence_source ',' sequence_source_chain
    // ;
    StateElement stateElement1;
    if (ctx.EVERY() != null) {
        stateElement1 = new EveryStateElement((StateElement) visit(ctx.sequence_source()));
    } else {
        stateElement1 = (StateElement) visit(ctx.sequence_source());
    }
    populateQueryContext(stateElement1, ctx);
    NextStateElement nextStateElement = new NextStateElement(stateElement1, ((StateElement) visit(ctx.sequence_source_chain())));
    populateQueryContext(nextStateElement, ctx);
    return nextStateElement;
}
Also used : NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) StateElement(io.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(io.siddhi.query.api.execution.query.input.state.CountStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 4 with StateElement

use of io.siddhi.query.api.execution.query.input.state.StateElement in project siddhi by wso2.

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(io.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) StateElement(io.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(io.siddhi.query.api.execution.query.input.state.CountStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 5 with StateElement

use of io.siddhi.query.api.execution.query.input.state.StateElement in project siddhi by wso2.

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')'
        StateElement stateElement = (StateElement) visit(ctx.right_absent_pattern_source(0));
        if (ctx.EVERY() != null) {
            stateElement = new EveryStateElement(stateElement);
        }
        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(io.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(io.siddhi.query.api.execution.query.input.state.NextStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) StateElement(io.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(io.siddhi.query.api.execution.query.input.state.CountStateElement) EveryStateElement(io.siddhi.query.api.execution.query.input.state.EveryStateElement)

Aggregations

CountStateElement (io.siddhi.query.api.execution.query.input.state.CountStateElement)19 EveryStateElement (io.siddhi.query.api.execution.query.input.state.EveryStateElement)19 NextStateElement (io.siddhi.query.api.execution.query.input.state.NextStateElement)19 StateElement (io.siddhi.query.api.execution.query.input.state.StateElement)19 StreamStateElement (io.siddhi.query.api.execution.query.input.state.StreamStateElement)19 AbsentStreamStateElement (io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)18 LogicalStateElement (io.siddhi.query.api.execution.query.input.state.LogicalStateElement)3 StateInputStream (io.siddhi.query.api.execution.query.input.stream.StateInputStream)3 ArrayList (java.util.ArrayList)3 SingleStreamRuntime (io.siddhi.core.query.input.stream.single.SingleStreamRuntime)2 AbsentLogicalPreStateProcessor (io.siddhi.core.query.input.stream.state.AbsentLogicalPreStateProcessor)2 AbsentStreamPreStateProcessor (io.siddhi.core.query.input.stream.state.AbsentStreamPreStateProcessor)2 CountPreStateProcessor (io.siddhi.core.query.input.stream.state.CountPreStateProcessor)2 LogicalPreStateProcessor (io.siddhi.core.query.input.stream.state.LogicalPreStateProcessor)2 PreStateProcessor (io.siddhi.core.query.input.stream.state.PreStateProcessor)2 StateStreamRuntime (io.siddhi.core.query.input.stream.state.StateStreamRuntime)2 StreamPreStateProcessor (io.siddhi.core.query.input.stream.state.StreamPreStateProcessor)2 CountInnerStateRuntime (io.siddhi.core.query.input.stream.state.runtime.CountInnerStateRuntime)2 EveryInnerStateRuntime (io.siddhi.core.query.input.stream.state.runtime.EveryInnerStateRuntime)2 InnerStateRuntime (io.siddhi.core.query.input.stream.state.runtime.InnerStateRuntime)2