String variableName = null;
Double rate = null;
ExprNode whenExpression = null;
List<ExprNode> crontabScheduleSpec = null;
List<OnTriggerSetAssignment> thenExpressions = null;
ExprTimePeriod timePeriodExpr = null;
OutputLimitRateType rateType;
ExprNode andAfterTerminateExpr = null;
List<OnTriggerSetAssignment> andAfterTerminateSetExpressions = null;
if (ctx.t != null) {
rateType = OutputLimitRateType.TERM;
if (ctx.expression() != null) {
andAfterTerminateExpr = ASTExprHelper.exprCollectSubNodes(ctx.expression(), 0, astExprNodeMap).get(0);
}
if (ctx.onSetExpr() != null) {
andAfterTerminateSetExpressions = ASTExprHelper.getOnTriggerSetAssignments(ctx.onSetExpr().onSetAssignmentList(), astExprNodeMap);
}
}
else if (ctx.wh != null) {
rateType = OutputLimitRateType.WHEN_EXPRESSION;
whenExpression = ASTExprHelper.exprCollectSubNodes(ctx.expression(), 0, astExprNodeMap).get(0);
if (ctx.onSetExpr() != null) {
thenExpressions = ASTExprHelper.getOnTriggerSetAssignments(ctx.onSetExpr().onSetAssignmentList(), astExprNodeMap);
}
}
else if (ctx.at != null) {
rateType = OutputLimitRateType.CRONTAB;
crontabScheduleSpec = ASTExprHelper.exprCollectSubNodes(ctx.crontabLimitParameterSet(), 0, astExprNodeMap);
}
else {
if (ctx.ev != null) {
rateType = ctx.e != null ? OutputLimitRateType.EVENTS : OutputLimitRateType.TIME_PERIOD;
if (ctx.i != null) {
variableName = ctx.i.getText();
}
else if (ctx.timePeriod() != null){
timePeriodExpr = (ExprTimePeriod) ASTExprHelper.exprCollectSubNodes(ctx.timePeriod(), 0, astExprNodeMap).get(0);
}
else {
ASTExprHelper.exprCollectSubNodes(ctx.number(), 0, astExprNodeMap); // remove
rate = Double.parseDouble(ctx.number().getText());
}
}
else {
rateType = OutputLimitRateType.AFTER;
}
}
// get the AFTER time period
ExprTimePeriod afterTimePeriodExpr = null;
Integer afterNumberOfEvents = null;
if (ctx.outputLimitAfter() != null) {
if (ctx.outputLimitAfter().timePeriod() != null) {
ExprNode expression = ASTExprHelper.exprCollectSubNodes(ctx.outputLimitAfter(), 0, astExprNodeMap).get(0);
afterTimePeriodExpr = (ExprTimePeriod) expression;