Search in sources :

Example 6 with NextStateElement

use of org.wso2.siddhi.query.api.execution.query.input.state.NextStateElement 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 7 with NextStateElement

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

the class SiddhiQLBaseVisitorImpl method visitLeft_absent_pattern_source.

@Override
public Object visitLeft_absent_pattern_source(SiddhiQLParser.Left_absent_pattern_sourceContext ctx) {
    if (ctx.left_absent_pattern_source().size() == 1 && ctx.every_absent_pattern_source() == null && ctx.every_pattern_source_chain() == null) {
        // EVERY? '('left_absent_pattern_source')' within_time?
        StateElement stateElement = (StateElement) visit(ctx.left_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.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) EveryStateElement(org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement)

Example 8 with NextStateElement

use of org.wso2.siddhi.query.api.execution.query.input.state.NextStateElement 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')' within_time?
        StateElement stateElement = ((StateElement) visit(ctx.every_pattern_source_chain(0)));
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
        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 ')' within_time?
            EveryStateElement everyStateElement = new EveryStateElement((StateElement) visit(ctx.pattern_source_chain()));
            if (ctx.within_time() != null) {
                everyStateElement.setWithin((TimeConstant) visit(ctx.within_time()));
            }
            populateQueryContext(everyStateElement, ctx);
            return everyStateElement;
        } else if (ctx.pattern_source() != null) {
            // EVERY pattern_source within_time?
            EveryStateElement everyStateElement = new EveryStateElement((StateElement) visit(ctx.pattern_source()));
            if (ctx.within_time() != null) {
                everyStateElement.setWithin((TimeConstant) visit(ctx.within_time()));
            }
            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()));
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
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) EveryStateElement(org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement) TimeConstant(org.wso2.siddhi.query.api.expression.constant.TimeConstant)

Example 9 with NextStateElement

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

the class SiddhiQLBaseVisitorImpl method visitSequence_source_chain.

/**
 * {@inheritDoc}
 * <p>The default implementation returns the result of calling
 * {@link #visitChildren} on {@code ctx}.</p>
 *
 * @param ctx
 */
@Override
public StateElement visitSequence_source_chain(@NotNull SiddhiQLParser.Sequence_source_chainContext ctx) {
    if (ctx.sequence_source_chain().size() == 1) {
        StateElement stateElement = ((StateElement) visit(ctx.sequence_source_chain(0)));
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else if (ctx.sequence_source_chain().size() == 2) {
        NextStateElement nextStateElement = new NextStateElement(((StateElement) visit(ctx.sequence_source_chain(0))), ((StateElement) visit(ctx.sequence_source_chain(1))));
        populateQueryContext(nextStateElement, ctx);
        return nextStateElement;
    } else if (ctx.sequence_source() != null) {
        StateElement stateElement = ((StateElement) visit(ctx.sequence_source()));
        if (ctx.within_time() != null) {
            stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
        }
        populateQueryContext(stateElement, ctx);
        return stateElement;
    } else {
        throw newSiddhiParserException(ctx);
    }
}
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 10 with NextStateElement

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

Aggregations

AbsentStreamStateElement (org.wso2.siddhi.query.api.execution.query.input.state.AbsentStreamStateElement)10 CountStateElement (org.wso2.siddhi.query.api.execution.query.input.state.CountStateElement)10 EveryStateElement (org.wso2.siddhi.query.api.execution.query.input.state.EveryStateElement)10 NextStateElement (org.wso2.siddhi.query.api.execution.query.input.state.NextStateElement)10 StateElement (org.wso2.siddhi.query.api.execution.query.input.state.StateElement)10 StreamStateElement (org.wso2.siddhi.query.api.execution.query.input.state.StreamStateElement)10 StateInputStream (org.wso2.siddhi.query.api.execution.query.input.stream.StateInputStream)2 AbstractMap (java.util.AbstractMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 OperationNotSupportedException (org.wso2.siddhi.core.exception.OperationNotSupportedException)1 EntryValveProcessor (org.wso2.siddhi.core.query.input.stream.single.EntryValveProcessor)1 SingleStreamRuntime (org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime)1 AbsentLogicalPostStateProcessor (org.wso2.siddhi.core.query.input.stream.state.AbsentLogicalPostStateProcessor)1 AbsentLogicalPreStateProcessor (org.wso2.siddhi.core.query.input.stream.state.AbsentLogicalPreStateProcessor)1 AbsentStreamPostStateProcessor (org.wso2.siddhi.core.query.input.stream.state.AbsentStreamPostStateProcessor)1 AbsentStreamPreStateProcessor (org.wso2.siddhi.core.query.input.stream.state.AbsentStreamPreStateProcessor)1 CountPostStateProcessor (org.wso2.siddhi.core.query.input.stream.state.CountPostStateProcessor)1 CountPreStateProcessor (org.wso2.siddhi.core.query.input.stream.state.CountPreStateProcessor)1 LogicalPostStateProcessor (org.wso2.siddhi.core.query.input.stream.state.LogicalPostStateProcessor)1