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.logic.Term;
13: import de.uka.ilkd.key.logic.op.SchemaVariable;
14:
15: /** This class is used to store the instantiation of a schemavarible
16: * if it is a term.
17: */
18:
19: public class TermInstantiation extends InstantiationEntry {
20:
21: /** the term the schemavariable is instantiated with */
22: private final Term term;
23:
24: private static final RigidnessException RIGIDNESS_EXCEPTION = new RigidnessException(
25: "Tried to instantiate a rigid schema variable"
26: + " with a non-rigid term/formula");
27:
28: /** creates a new ContextInstantiationEntry
29: * @param sv the SchemaVariable that is
30: * instantiated
31: * @param term the Term the SchemaVariable is instantiated with
32: */
33: TermInstantiation(SchemaVariable sv, Term term) {
34: super (sv);
35: this .term = term;
36: if (!term.isRigid() && sv.isRigid()) {
37: throw RIGIDNESS_EXCEPTION;
38: }
39: }
40:
41: /** returns the Term the SchemaVariable is instantiated with
42: * @return the Term the SchemaVariable is instantiated with
43: */
44: public Term getTerm() {
45: return term;
46: }
47:
48: /** returns the instantiation of the SchemaVariable
49: * @return the instantiation of the SchemaVariable
50: */
51: public Object getInstantiation() {
52: return term;
53: }
54:
55: /** toString */
56: public String toString() {
57: return "[" + getSchemaVariable() + ", " + getTerm() + "]";
58: }
59:
60: }
|