use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitMillisecond_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitMillisecond_value(@NotNull SiddhiQLParser.Millisecond_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.milliSec(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitPattern_source_chain.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Object visitPattern_source_chain(@NotNull SiddhiQLParser.Pattern_source_chainContext ctx) {
if (ctx.pattern_source_chain().size() == 1) {
StateElement stateElement = ((StateElement) visit(ctx.pattern_source_chain(0)));
if (ctx.within_time() != null) {
stateElement.setWithin((TimeConstant) visit(ctx.within_time()));
}
populateQueryContext(stateElement, ctx);
return stateElement;
} else if (ctx.pattern_source_chain().size() == 2) {
NextStateElement nextStateElement = new NextStateElement(((StateElement) visit(ctx.pattern_source_chain(0))), ((StateElement) visit(ctx.pattern_source_chain(1))));
populateQueryContext(nextStateElement, ctx);
return nextStateElement;
} else if (ctx.pattern_source() != null) {
StateElement stateElement = ((StateElement) visit(ctx.pattern_source()));
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 visitOutput_rate.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public OutputRate visitOutput_rate(@NotNull SiddhiQLParser.Output_rateContext ctx) {
if (ctx.SNAPSHOT() != null) {
SnapshotOutputRate snapshotOutputRate = new SnapshotOutputRate(((TimeConstant) visit(ctx.time_value())).value());
populateQueryContext(snapshotOutputRate, ctx);
return snapshotOutputRate;
} else if (ctx.time_value() != null) {
TimeOutputRate timeOutputRate = new TimeOutputRate(((TimeConstant) visit(ctx.time_value())).value());
if (ctx.output_rate_type() != null) {
timeOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
}
populateQueryContext(timeOutputRate, ctx);
return timeOutputRate;
} else if (ctx.EVENTS() != null) {
EventOutputRate eventOutputRate = new EventOutputRate(Integer.parseInt(ctx.INT_LITERAL().getText()));
if (ctx.output_rate_type() != null) {
eventOutputRate.output((OutputRate.Type) visit(ctx.output_rate_type()));
}
populateQueryContext(eventOutputRate, ctx);
return eventOutputRate;
} else {
throw newSiddhiParserException(ctx);
}
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitYear_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitYear_value(@NotNull SiddhiQLParser.Year_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.year(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
use of org.wso2.siddhi.query.api.expression.constant.TimeConstant in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitHour_value.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public TimeConstant visitHour_value(@NotNull SiddhiQLParser.Hour_valueContext ctx) {
TimeConstant timeConstant = Expression.Time.hour(Long.parseLong(ctx.INT_LITERAL().getText().replaceFirst("[lL]", "")));
populateQueryContext(timeConstant, ctx);
return timeConstant;
}
Aggregations