use of org.wso2.siddhi.query.api.expression.constant.TimeConstant 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;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitConstant_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Constant visitConstant_value(@NotNull SiddhiQLParser.Constant_valueContext ctx) {
// constant_value
// :bool_value
// |signed_double_value
// |signed_float_value
// |signed_long_value
// |signed_int_value
// |time_value
// |string_value
// ;
Constant constant;
if (ctx.bool_value() != null) {
constant = Expression.value(((BoolConstant) visit(ctx.bool_value())).getValue());
} else if (ctx.signed_double_value() != null) {
constant = Expression.value(((DoubleConstant) visit(ctx.signed_double_value())).getValue());
} else if (ctx.signed_float_value() != null) {
constant = Expression.value(((FloatConstant) visit(ctx.signed_float_value())).getValue());
} else if (ctx.signed_long_value() != null) {
constant = Expression.value(((LongConstant) visit(ctx.signed_long_value())).getValue());
} else if (ctx.signed_int_value() != null) {
constant = Expression.value(((IntConstant) visit(ctx.signed_int_value())).getValue());
} else if (ctx.time_value() != null) {
constant = (TimeConstant) visit(ctx.time_value());
} else if (ctx.string_value() != null) {
constant = Expression.value(((StringConstant) visit(ctx.string_value())).getValue());
} else {
throw newSiddhiParserException(ctx);
}
populateQueryContext(constant, ctx);
return constant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant 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;
}
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant 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);
}
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant 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);
}
}
Aggregations