1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.pcmsolver.handler; |
5 | |
6 | import org.apache.log4j.Logger; |
7 | |
8 | import de.uka.ipd.sdq.pcm.seff.LoopAction; |
9 | import de.uka.ipd.sdq.pcmsolver.visitors.ExpressionHelper; |
10 | import de.uka.ipd.sdq.pcmsolver.visitors.SeffVisitor; |
11 | |
12 | /** |
13 | * @author Koziolek |
14 | * |
15 | */ |
16 | public class LoopActionHandler extends AbstractLoopActionHandler { |
17 | |
18 | private static Logger logger = Logger.getLogger(LoopActionHandler.class.getName()); |
19 | |
20 | public LoopActionHandler(SeffVisitor seffVisitor) { |
21 | super(seffVisitor); |
22 | } |
23 | |
24 | public void handle(LoopAction loop) { |
25 | String specification = loop.getIterationCount_LoopAction().getSpecification(); |
26 | String solvedSpecification = |
27 | ExpressionHelper.getSolvedExpressionAsString(specification, visitor.getContextWrapper()); |
28 | |
29 | if (solvedSpecification == null){ |
30 | logger.error("Could not determine iterations specification. Skipping execution of loop body!"); |
31 | return; |
32 | } |
33 | |
34 | logger.debug("NumberOfIterations: "+solvedSpecification); |
35 | |
36 | storeToUsageContext(loop, solvedSpecification); |
37 | |
38 | visitLoopBody(loop, solvedSpecification); |
39 | } |
40 | |
41 | |
42 | |
43 | |
44 | } |