1 package spoon.reflect.eval; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 10 public class SymbolicEvaluationPath { 11 12 15 public SymbolicEvaluationPath() { 16 } 17 18 List <SymbolicEvaluationStep> steps = new ArrayList <SymbolicEvaluationStep>(); 19 20 29 public void addStep(StepKind kind, SymbolicEvaluator evaluator) { 30 steps 31 .add(new SymbolicEvaluationStep(kind, new SymbolicStackFrame(evaluator.getStack() 32 .getFrameStack().peek()), new SymbolicHeap(evaluator 33 .getHeap()))); 34 } 35 36 39 public SymbolicEvaluationStep getStep(int i) { 40 return steps.get(i); 41 } 42 43 46 public List <SymbolicEvaluationStep> getSteps() { 47 return steps; 48 } 49 50 53 public int getStepCount() { 54 return steps.size(); 55 } 56 57 60 public void dump() { 61 for (int i = 0; i < steps.size(); i++) { 62 System.out.println((i + 1) + "\t" + steps.get(i).getKind() + " " 63 + steps.get(i).getFrame()); 64 steps.get(i).getHeap().dump(); 65 } 66 } 67 68 71 @Override 72 public String toString() { 73 String res=""; 74 for (int i = 0; i < steps.size(); i++) { 75 res+=steps.get(i).getKind()+"("+steps.get(i).getFrame().getExecutable().getSimpleName()+");"; 76 } 77 return res; 78 } 79 80 } 81 | Popular Tags |