1 package eu.simuline.relana.model;
2
3 import java.util.Map;
4 import java.util.Set;
5
6 /**
7 * Represents the declaration of a map.
8 *
9 *
10 * Created: Mon May 23 18:54:29 2005
11 *
12 * @author <a href="mailto:ernst.reissner@simuline.eu">Ernst Reissner</a>
13 * @version 1.0
14 */
15 public final class MapDecl {
16
17 /* -------------------------------------------------------------------- *
18 * attributes. *
19 * -------------------------------------------------------------------- */
20
21 private boolean isRedeclare; // NOPMD ****
22 private String mapName; // NOPMD ****
23 private final Map<Set<Deficiency>, Deficiency> setOfNew2old;
24 private final SClass source;
25
26 private final SClass target;
27
28 /*
29 * The set of deficiencies mapped identically.
30 * As a consequence, this is a subset of both
31 * the set represented by {@link #source}
32 * and the set represented by {@link #target}.
33 */
34 //private final Set<Deficiency> idDom;
35
36 /**
37 * The <code>map</code> declared here.
38 */
39 private final DeficiencyMap map;
40
41 /* -------------------------------------------------------------------- *
42 * constructors. *
43 * -------------------------------------------------------------------- */
44
45 @edu.umd.cs.findbugs.annotations.SuppressWarnings
46 (value = "URF_UNREAD_FIELD",
47 justification = "to be used in later versions ")
48 public MapDecl(boolean isRedeclare,
49 String mapName,
50 Map<Set<Deficiency>, Deficiency> setOfNew2old,
51 SClass source,
52 SClass target,
53 Set<Deficiency> idDom) {
54 this.isRedeclare = isRedeclare;
55 this.mapName = mapName;
56 this.setOfNew2old = setOfNew2old;
57 this.source = source;
58 this.target = target;
59 // this.idDom = idDom;
60 this.map = new DeficiencyMap(this.setOfNew2old,
61 this.source,
62 this.target,
63 /* */idDom);
64 } // MapDecl constructor
65
66 /* -------------------------------------------------------------------- *
67 * methods. *
68 * -------------------------------------------------------------------- */
69
70 public DeficiencyMap getMap() {
71 return this.map;
72 }
73
74 public String toString() {
75 StringBuffer res = new StringBuffer();
76 res.append("<MapDecl source=\"");
77 res.append(source.getPathName().toString());
78 res.append("\" target=\"");
79 res.append(target.getPathName().toString());
80 res.append("\">\n");
81 res.append(this.setOfNew2old.toString());
82 res.append("\n</MapDecl>");
83 return res.toString();
84 }
85
86 } // MapDecl