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.logic.op.oclop;
12:
13: import de.uka.ilkd.key.logic.Name;
14: import de.uka.ilkd.key.logic.Term;
15: import de.uka.ilkd.key.logic.sort.Sort;
16: import de.uka.ilkd.key.logic.sort.oclsort.CollectionSort;
17: import de.uka.ilkd.key.logic.sort.oclsort.OclSort;
18:
19: /**
20: * Represents the OCL operation: sortedBy()
21: */
22: public class OclSortedBy extends OclCollOpBound {
23:
24: public OclSortedBy() {
25: super (new Name("$sortedBy"), OclSort.REAL,
26: OclSort.SEQUENCE_OF_OCLANY);
27: }
28:
29: public Sort sort(Term[] subTerm) {
30: helpSort(subTerm);
31: OclSort elemSort = ((CollectionSort) subTerm[0].sort())
32: .getElemSort();
33: return CollectionSort.getCollectionSort(
34: CollectionSort.SEQUENCE, elemSort);
35: }
36:
37: public String toString() {
38: return (name() + ":" + OclSort.SEQUENCE_OF_OCLANY);
39: }
40:
41: public String proofToString() {
42: String s = OclSort.SEQUENCE_OF_OCLANY + " " + name();
43: s += "(" + OclSort.COLLECTION_OF_OCLANY + "," + OclSort.REAL;
44: s += ");\n";
45: return s;
46: }
47: }
|