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 TypeSchemeAndConstraint implements TypeSchemeConstraint {
14: private ListOfTypeSchemeConstraint constraints;
15:
16: public TypeSchemeAndConstraint(
17: ListOfTypeSchemeConstraint constraints) {
18: this .constraints = constraints;
19: }
20:
21: public boolean evaluate() {
22: IteratorOfTypeSchemeConstraint it = constraints.iterator();
23: while (it.hasNext()) {
24: if (!it.next().evaluate()) {
25: return false;
26: }
27: }
28:
29: return true;
30: }
31:
32: public SetOfTypeSchemeVariable getFreeVars() {
33: SetOfTypeSchemeVariable result = SetAsListOfTypeSchemeVariable.EMPTY_SET;
34:
35: IteratorOfTypeSchemeConstraint it = constraints.iterator();
36: while (it.hasNext()) {
37: result = result.union(it.next().getFreeVars());
38: }
39:
40: return result;
41: }
42:
43: public String toString() {
44: String result = "and(";
45:
46: IteratorOfTypeSchemeConstraint it = constraints.iterator();
47: while (it.hasNext()) {
48: result += it.next() + ", ";
49: }
50:
51: if (constraints.size() > 0) {
52: result = result.substring(0, result.length() - 1);
53: }
54:
55: result += ")";
56:
57: return result;
58: }
59: }
|