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: import de.uka.ilkd.key.util.Debug;
14:
15: class ReadonlyScheme implements TypeScheme {
16: public static final ReadonlyScheme INSTANCE = new ReadonlyScheme();
17:
18: private ReadonlyScheme() {
19: }
20:
21: public TypeScheme combineWith(TypeScheme ts) {
22: if (ts instanceof PrimitiveScheme) {
23: return ts;
24: } else if (ts instanceof RepScheme) {
25: return ReadonlyPrimeScheme.INSTANCE;
26: } else if (ts instanceof PeerScheme) {
27: return ReadonlyPrimeScheme.INSTANCE;
28: } else if (ts instanceof ReadonlyScheme) {
29: return ts;
30: } else if (ts instanceof RootScheme) {
31: return ts;
32: }
33:
34: Debug.fail("Undefined use of type scheme combinator");
35: return null;
36: }
37:
38: public boolean subSchemeOf(TypeScheme ts) {
39: return (ts instanceof ReadonlyScheme);
40: }
41:
42: public boolean equalTo(TypeScheme ts) {
43: return ts == INSTANCE;
44: }
45:
46: public String toString() {
47: return "readonlyS";
48: }
49: }
|