Browse Source

accumulation: smaller formulas for singleTrack mode

accumulation
Sascha Wunderlich 7 years ago
parent
commit
30a69bd2b2
  1. 2
      prism/src/explicit/AccumulationTransformation.java
  2. 2
      prism/src/parser/visitor/ReplaceAccumulationBox.java
  3. 8
      prism/src/parser/visitor/ReplaceAccumulationExpressionComplex.java

2
prism/src/explicit/AccumulationTransformation.java

@ -186,7 +186,7 @@ public class AccumulationTransformation<M extends ModelExplicit> implements Mode
if(ctx.simpleMethod) {
replace = new ReplaceAccumulationExpressionSimple(ctx.accexp, goalLabels.get(0), product.getNumberOfTracks()-1);
} else {
replace = new ReplaceAccumulationExpressionComplex(ctx.accexp, initLabels, runLabels, goalLabels, product.getNumberOfTracks()-1);
replace = new ReplaceAccumulationExpressionComplex(ctx.accexp, initLabels, runLabels, goalLabels, product.getNumberOfTracks()-1, ctx.singleTrack);
}
transformedExpression = (Expression)transformedExpression.accept(replace);
clock.stop("got " + transformedExpression);

2
prism/src/parser/visitor/ReplaceAccumulationBox.java

@ -40,7 +40,7 @@ public class ReplaceAccumulationBox extends ASTTraverseModify {
throw new PrismLangException("Error: Accsymbol is a box and not a box.");
}
// Make a copy and set constraint an symbol
// Make a copy and set constraint and symbol
ExpressionAccumulation newAccexp = (ExpressionAccumulation)accexp.deepCopy();
newAccexp.setSymbol(newSym);
newAccexp.setConstraint(newConstr);

8
prism/src/parser/visitor/ReplaceAccumulationExpressionComplex.java

@ -18,13 +18,16 @@ public class ReplaceAccumulationExpressionComplex extends ASTTraverseModify {
private ArrayList<String> goalLabels;
private int accLength;
public ReplaceAccumulationExpressionComplex(ExpressionAccumulation accexp, ArrayList<String> initLabels, ArrayList<String> runLabels, ArrayList<String> goalLabels, int accLength) {
private boolean singleTrack;
public ReplaceAccumulationExpressionComplex(ExpressionAccumulation accexp, ArrayList<String> initLabels, ArrayList<String> runLabels, ArrayList<String> goalLabels, int accLength, boolean singleTrack) {
super();
this.accexp = accexp;
this.initLabels = initLabels;
this.runLabels = runLabels;
this.goalLabels = goalLabels;
this.accLength = accLength;
this.singleTrack = singleTrack;
}
private Object replaceWithUntil(ExpressionAccumulation accexp) throws PrismLangException {
@ -35,6 +38,9 @@ public class ReplaceAccumulationExpressionComplex extends ASTTraverseModify {
Expression result = null;
for(int i=0; i<accLength; i++) {
// if this is singleTrack: break after the first loop
if(singleTrack && i>0) { break; }
Expression init = new ExpressionLabel(initLabels.get(i));
Expression run = new ExpressionLabel(runLabels.get(i));
Expression goal = new ExpressionLabel(goalLabels.get(i));

Loading…
Cancel
Save