use of io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitBasic_source.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public BasicSingleInputStream visitBasic_source(@NotNull SiddhiQLParser.Basic_sourceContext ctx) {
// basic_source
// : io (basic_source_stream_handler)*
// ;
Source source = (Source) visit(ctx.source());
BasicSingleInputStream basicSingleInputStream = new BasicSingleInputStream(null, source.streamId, source.isInnerStream, source.isFaultStream);
if (ctx.basic_source_stream_handlers() != null) {
basicSingleInputStream.addStreamHandlers((List<StreamHandler>) visit(ctx.basic_source_stream_handlers()));
}
populateQueryContext(basicSingleInputStream, ctx);
return basicSingleInputStream;
}
use of io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitStandard_stateful_source.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public StreamStateElement visitStandard_stateful_source(@NotNull SiddhiQLParser.Standard_stateful_sourceContext ctx) {
if (ctx.event() != null) {
activeStreams.add(visitEvent(ctx.event()));
}
BasicSingleInputStream basicSingleInputStream = (BasicSingleInputStream) visit(ctx.basic_source());
if (ctx.event() != null) {
if (basicSingleInputStream.isInnerStream()) {
activeStreams.remove("#" + basicSingleInputStream.getStreamId());
} else if (basicSingleInputStream.isFaultStream()) {
activeStreams.remove("!" + basicSingleInputStream.getStreamId());
} else {
activeStreams.remove(basicSingleInputStream.getStreamId());
}
StreamStateElement streamStateElement = new StreamStateElement(basicSingleInputStream.as((String) visit(ctx.event())));
populateQueryContext(streamStateElement, ctx);
return streamStateElement;
} else {
StreamStateElement streamStateElement = new StreamStateElement(basicSingleInputStream);
populateQueryContext(streamStateElement, ctx);
return streamStateElement;
}
}
use of io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream 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);
}
}
use of io.siddhi.query.api.execution.query.input.stream.BasicSingleInputStream 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;
}
Aggregations