use of org.smartdata.rule.parser.SmartRuleParser.TimeintvalexprContext in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitTriCycle.
@Override
public TreeNode visitTriCycle(SmartRuleParser.TriCycleContext ctx) {
timeBasedScheduleInfo = new TimeBasedScheduleInfo();
List<TimeintvalexprContext> timeExprs = ctx.timeintvalexpr();
long[] everys = new long[timeExprs.size() + ((timeExprs.size() + 1) % 2)];
for (int i = 0; i < timeExprs.size(); i++) {
everys[i] = getLongConstFromTreeNode(visit(timeExprs.get(i)));
}
if (timeExprs.size() % 2 == 0) {
everys[everys.length - 1] = 5000;
}
timeBasedScheduleInfo.setEvery(everys);
if (ctx.duringexpr() != null) {
visit(ctx.duringexpr());
} else {
timeBasedScheduleInfo.setStartTime(getTimeNow());
timeBasedScheduleInfo.setEndTime(TimeBasedScheduleInfo.FOR_EVER);
}
return null;
}
Aggregations