Search in sources :

Example 11 with StateElement

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

the class SiddhiQLBaseVisitorImpl method visitRight_absent_sequence_source.

@Override
public Object visitRight_absent_sequence_source(SiddhiQLParser.Right_absent_sequence_sourceContext ctx) {
    if (ctx.right_absent_sequence_source().size() == 1 && ctx.basic_absent_pattern_source() == null && ctx.sequence_source_chain() == null) {
        // '('right_absent_pattern_source')' within_time?
        StateElement stateElement = (StateElement) visit(ctx.right_absent_sequence_source(0));
        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.wso2.siddhi.query.api.execution.query.input.state.NextStateElement) EveryStateElement(org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(org.wso2.siddhi.query.api.execution.query.input.state.NextStateElement) StateElement(org.wso2.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(org.wso2.siddhi.query.api.execution.query.input.state.CountStateElement) AbsentStreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)

Example 12 with StateElement

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

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

Example 13 with StateElement

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

Example 14 with StateElement

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

the class SiddhiQLBaseVisitorImpl method visitAbsent_pattern_source_chain.

@Override
public Object visitAbsent_pattern_source_chain(SiddhiQLParser.Absent_pattern_source_chainContext ctx) {
    if (ctx.absent_pattern_source_chain() != null) {
        StateElement stateElement = (StateElement) visit(ctx.absent_pattern_source_chain());
        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 {
        return visit(ctx.getChild(0));
    }
}
Also used : EveryStateElement(org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement) StreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.StreamStateElement) NextStateElement(org.wso2.siddhi.query.api.execution.query.input.state.NextStateElement) StateElement(org.wso2.siddhi.query.api.execution.query.input.state.StateElement) CountStateElement(org.wso2.siddhi.query.api.execution.query.input.state.CountStateElement) AbsentStreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) EveryStateElement(org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 15 with StateElement

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

the class SiddhiQLBaseVisitorImpl method visitBasic_absent_pattern_source.

@Override
public Object visitBasic_absent_pattern_source(SiddhiQLParser.Basic_absent_pattern_sourceContext ctx) {
    // basic_absent_pattern_source
    // :NOT basic_source for_time
    // ;
    AbsentStreamStateElement stateElement = State.logicalNot(new StreamStateElement((BasicSingleInputStream) visit(ctx.basic_source())));
    stateElement.waitingTime((TimeConstant) visit(ctx.for_time()));
    populateQueryContext(stateElement, ctx);
    return stateElement;
}
Also used : StreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.StreamStateElement) AbsentStreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) BasicSingleInputStream(org.wso2.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream) AbsentStreamStateElement(org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)

Aggregations

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