Search in sources :

Example 6 with StreamStateElement

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

the class SiddhiQLBaseVisitorImpl method visitLogical_absent_stateful_source.

@Override
public Object visitLogical_absent_stateful_source(SiddhiQLParser.Logical_absent_stateful_sourceContext ctx) {
    // ;
    if (ctx.logical_absent_stateful_source() != null) {
        return visit(ctx.logical_absent_stateful_source());
    } else if (ctx.AND() != null) {
        if (ctx.basic_absent_pattern_source().size() == 2) {
            StateElement stateElement = State.logicalNotAnd((AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(0)), (AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(1)));
            populateQueryContext(stateElement, ctx);
            return stateElement;
        } else {
            StreamStateElement presentStreamState = (StreamStateElement) visit(ctx.standard_stateful_source());
            AbsentStreamStateElement absentStreamState;
            if (!ctx.basic_absent_pattern_source().isEmpty()) {
                absentStreamState = (AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(0));
            } else {
                absentStreamState = State.logicalNot(new StreamStateElement((BasicSingleInputStream) visit(ctx.basic_source())), null);
            }
            StateElement stateElement = State.logicalNotAnd(absentStreamState, presentStreamState);
            populateQueryContext(stateElement, ctx);
            return stateElement;
        }
    } else if (ctx.OR() != null) {
        if (ctx.basic_absent_pattern_source().size() == 2) {
            return State.logicalOr((AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(0)), (AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(1)));
        } else {
            StreamStateElement streamStateElement1 = (StreamStateElement) visit(ctx.standard_stateful_source());
            AbsentStreamStateElement streamStateElement2 = (AbsentStreamStateElement) visit(ctx.basic_absent_pattern_source(0));
            StateElement stateElement = State.logicalOr(streamStateElement2, streamStateElement1);
            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) BasicSingleInputStream(io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream) 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 7 with StreamStateElement

use of io.siddhi.query.api.execution.query.input.state.StreamStateElement 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())), (TimeConstant) visit(ctx.for_time()));
    populateQueryContext(stateElement, ctx);
    return stateElement;
}
Also used : StreamStateElement(io.siddhi.query.api.execution.query.input.state.StreamStateElement) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement) BasicSingleInputStream(io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream) AbsentStreamStateElement(io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)

Aggregations

AbsentStreamStateElement (io.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)7 StreamStateElement (io.siddhi.query.api.execution.query.input.state.StreamStateElement)7 CountStateElement (io.siddhi.query.api.execution.query.input.state.CountStateElement)5 BasicSingleInputStream (io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream)4 EveryStateElement (io.siddhi.query.api.execution.query.input.state.EveryStateElement)3 NextStateElement (io.siddhi.query.api.execution.query.input.state.NextStateElement)3 StateElement (io.siddhi.query.api.execution.query.input.state.StateElement)3 OperationNotSupportedException (io.siddhi.core.exception.OperationNotSupportedException)1 EntryValveProcessor (io.siddhi.core.query.input.stream.single.EntryValveProcessor)1 SingleStreamRuntime (io.siddhi.core.query.input.stream.single.SingleStreamRuntime)1 AbsentLogicalPostStateProcessor (io.siddhi.core.query.input.stream.state.AbsentLogicalPostStateProcessor)1 AbsentLogicalPreStateProcessor (io.siddhi.core.query.input.stream.state.AbsentLogicalPreStateProcessor)1 AbsentStreamPostStateProcessor (io.siddhi.core.query.input.stream.state.AbsentStreamPostStateProcessor)1 AbsentStreamPreStateProcessor (io.siddhi.core.query.input.stream.state.AbsentStreamPreStateProcessor)1 CountPostStateProcessor (io.siddhi.core.query.input.stream.state.CountPostStateProcessor)1 CountPreStateProcessor (io.siddhi.core.query.input.stream.state.CountPreStateProcessor)1 LogicalPostStateProcessor (io.siddhi.core.query.input.stream.state.LogicalPostStateProcessor)1 LogicalPreStateProcessor (io.siddhi.core.query.input.stream.state.LogicalPreStateProcessor)1 PreStateProcessor (io.siddhi.core.query.input.stream.state.PreStateProcessor)1 StreamPostStateProcessor (io.siddhi.core.query.input.stream.state.StreamPostStateProcessor)1