Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ public abstract class AbstractRepeatPlugin extends AbstractPlugin {
protected static final String BEGIN = "begin";
protected static final String STEP = "step";
protected static final String END = "end";
protected static final String LENGTH = "length";

protected MapLiteral buildStatusObj(String indexVar, String sizeVar) {
HashMap<String, ExpressionNode> obj = new HashMap<>();
Identifier indexId = new Identifier(indexVar);
Identifier size = new Identifier(size);
BinaryOperation firstExpr = new BinaryOperation(BinaryOperator.EQ, indexId, NumericConstant.ZERO);
BinaryOperation lastExpr = new BinaryOperation(
BinaryOperator.EQ,
indexId,
new BinaryOperation(BinaryOperator.SUB, new Identifier(sizeVar), NumericConstant.ONE));
new BinaryOperation(BinaryOperator.SUB, size, NumericConstant.ONE));
obj.put(INDEX, indexId);
obj.put(COUNT, new BinaryOperation(BinaryOperator.ADD, indexId, NumericConstant.ONE));
obj.put(FIRST, firstExpr);
Expand All @@ -59,6 +61,7 @@ protected MapLiteral buildStatusObj(String indexVar, String sizeVar) {
obj.put(LAST, lastExpr);
obj.put(ODD, parityCheck(indexId, NumericConstant.ZERO));
obj.put(EVEN, parityCheck(indexId, NumericConstant.ONE));
obj.put(LENGTH, size);
return new MapLiteral(obj);
}

Expand Down