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:
11: package de.uka.ilkd.key.rule.encapsulation;
12:
13: class TypeSchemeVariable implements TypeSchemeTerm {
14: private final String name;
15: private final TypeSchemeUnion defaultValue;
16: private TypeSchemeUnion value;
17:
18: public TypeSchemeVariable(String name, TypeSchemeUnion defaultValue) {
19: this .name = name;
20: this .defaultValue = defaultValue;
21: assignDefaultValue();
22: }
23:
24: public TypeSchemeUnion getDefaultValue() {
25: return defaultValue;
26: }
27:
28: public SetOfTypeScheme getValueRange() {
29: return defaultValue.getPossibilities();
30: }
31:
32: public void assignDefaultValue() {
33: value = defaultValue;
34: }
35:
36: public void assignValue(TypeSchemeUnion value) {
37: this .value = value;
38: }
39:
40: public void assignValue(TypeScheme scheme) {
41: assignValue(new TypeSchemeUnion(scheme));
42: }
43:
44: public boolean valueIsExact() {
45: return value.isExact();
46: }
47:
48: public TypeSchemeUnion evaluate() {
49: return value;
50: }
51:
52: public SetOfTypeSchemeVariable getFreeVars() {
53: return SetAsListOfTypeSchemeVariable.EMPTY_SET.add(this );
54: }
55:
56: public String toString() {
57: return name;
58: }
59: }
|