01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: package de.uka.ilkd.key.visualization;
09:
10: import java.util.ArrayList;
11:
12: import de.uka.ilkd.key.java.SourceElement;
13: import de.uka.ilkd.key.java.reference.IExecutionContext;
14: import de.uka.ilkd.key.proof.Node;
15:
16: public class ParentContextTraceElement extends ContextTraceElement {
17:
18: private ContextTraceElement stepOver;
19:
20: public ParentContextTraceElement(SourceElement prElement, Node n,
21: TraceElement nip, ContextTraceElement ne,
22: ContextTraceElement nsl) {
23: super (prElement, n, nip, ne);
24: stepOver = nsl;
25: }
26:
27: public ParentContextTraceElement(SourceElement prElement, Node n,
28: TraceElement nip, ContextTraceElement ne,
29: ContextTraceElement nsl, IExecutionContext exCont) {
30: super (prElement, n, nip, ne, exCont);
31: stepOver = nsl;
32: }
33:
34: public ParentContextTraceElement() {
35: nextInProof = this ;
36: stepInto = this ;
37: stepOver = this ;
38: }
39:
40: public void setStepOver(ContextTraceElement he) {
41: stepOver = he;
42: }
43:
44: public ContextTraceElement stepOver() {
45: return stepOver;
46: }
47:
48: public ContextTraceElement[] getChildren() {
49: ArrayList children = new ArrayList();
50: ContextTraceElement che = getNextExecuted();
51: while ((che != TraceElement.END)
52: && this .equals(che.getParent())) {
53: children.add(che);
54: if (che instanceof ParentContextTraceElement)
55: che = ((ParentContextTraceElement) che).stepOver();
56: else
57: che = che.getNextExecuted();
58: }
59: ContextTraceElement[] result = new ContextTraceElement[children
60: .size()];
61: children.toArray(result);
62: return result;
63: }
64:
65: public String toString() {
66: String s = "ParentContextTraceElement:\n";
67: if (this == END)
68: return "END";
69: if (this == PARENTROOT)
70: return "PARENTROOT";
71: if (node != null)
72: s = s + (serialNr() + "\n");
73: if (programElement != null)
74: s = s + programElement + "\n"
75: + programElement.getPositionInfo();
76: if (stepInto != null)
77: s = s + "\nStep Into: " + stepInto.serialNr();
78: if (stepOver != null)
79: s = s + "\nStep Over: " + stepOver.serialNr();
80: if (getParent() != null)
81: s = s + "\nParent: " + getParent().serialNr();
82: return s;
83: }
84:
85: }
|