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;
}
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;
}
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;
}
}
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;
}
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;
}
Aggregations