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: //
09: //
10: package de.uka.ilkd.key.rule.inst;
11:
12: import de.uka.ilkd.key.java.ProgramElement;
13: import de.uka.ilkd.key.java.reference.ExecutionContext;
14: import de.uka.ilkd.key.logic.PosInProgram;
15: import de.uka.ilkd.key.logic.op.SchemaVariable;
16:
17: /** This class is used to store the information about a matched
18: * context of a dl formula. (the pi and omega part)
19: */
20:
21: public class ContextInstantiationEntry extends InstantiationEntry {
22:
23: /** the prefix and suffix instantiation */
24: private ContextStatementBlockInstantiation inst;
25:
26: /**
27: * creates a new ContextInstantiationEntry
28: * @param ctxt the SchemaVariable that is
29: * instantiated
30: * @param pi the PosInProgram describing the position
31: * of the first statement after the prefix
32: * @param omega the PosInProgram describing the position
33: * of the statement just before the suffix starts
34: * @param activeStatementContext the ExecutionContext of the first
35: * active statement
36: * @param pe the ProgramElement the context positions are related to
37: */
38: ContextInstantiationEntry(SchemaVariable ctxt, PosInProgram pi,
39: PosInProgram omega,
40: ExecutionContext activeStatementContext, ProgramElement pe) {
41: super (ctxt);
42: inst = new ContextStatementBlockInstantiation(pi, omega,
43: activeStatementContext, pe);
44: }
45:
46: /** returns the position of the first statement after the prefix
47: * @return the position of the first statement after the prefix
48: */
49: public PosInProgram prefix() {
50: return inst.prefix();
51: }
52:
53: /** returns the position of the statement just before the suffix
54: * starts
55: * @return the position of the statement just before the suffix
56: * starts
57: */
58: public PosInProgram suffix() {
59: return inst.suffix();
60: }
61:
62: /**
63: * returns the context program with an ignorable part between prefix
64: * and suffix position
65: */
66: public ProgramElement contextProgram() {
67: return inst.programElement();
68: }
69:
70: /**
71: * returns the execution context of the first active statement or
72: * null if match is performed outer most
73: */
74: public ExecutionContext activeStatementContext() {
75: return inst.activeStatementContext();
76: }
77:
78: /** returns the instantiation of the SchemaVariable
79: * @return the instantiation of the SchemaVariable
80: */
81: public Object getInstantiation() {
82: return inst;
83: }
84:
85: /** toString */
86: public String toString() {
87: return "[" + getSchemaVariable() + ",\npi:" + prefix()
88: + "\nomega:" + suffix() + "\n]";
89: }
90:
91: }
|