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: // This file is part of KeY - Integrated Deductive Software Design
10: // Copyright (C) 2001-2004 Universitaet Karlsruhe, Germany
11: // Universitaet Koblenz-Landau, Germany
12: // Chalmers University of Technology, Sweden
13: //
14: // The KeY system is protected by the GNU General Public License.
15: // See LICENSE.TXT for details.
16: package de.uka.ilkd.key.proof.mgt;
17:
18: import java.util.HashMap;
19: import java.util.Map;
20:
21: import de.uka.ilkd.key.java.Services;
22: import de.uka.ilkd.key.rule.Rule;
23: import de.uka.ilkd.key.rule.RuleApp;
24: import de.uka.ilkd.key.util.Debug;
25:
26: public class RuleJustificationInfo {
27:
28: private Map rule2justif = new HashMap();
29: private RuleJustification contractJustification;
30:
31: public void addJustification(Rule r, RuleJustification j) {
32: if (j instanceof ComplexRuleJustificationBySpec) {
33: contractJustification = j;
34: }
35: rule2justif.put(r, j);
36: }
37:
38: public void addJustification(RuleApp r, RuleJustification j) {
39: rule2justif.put(r, j);
40: }
41:
42: private RuleJustification getJustification(Rule r) {
43: return (RuleJustification) rule2justif.get(r);
44: }
45:
46: public RuleJustification getJustification(RuleApp r,
47: Services services) {
48: RuleJustification just = getJustification(r.rule());
49: if (just instanceof ComplexRuleJustification) {
50: return ((ComplexRuleJustification) just)
51: .getSpecificJustification(r, services);
52: } else {
53: return just;
54: }
55: }
56:
57: public RuleJustification getContractJustification() {
58: Debug.assertTrue(contractJustification != null);
59: return contractJustification;
60: }
61:
62: }
|