1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.impl;
26
27 import static net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.tag.PlantUMLClassesDiagramElementTag.INTERFACE_TAG;
28 import static net.sourceforge.plantumldependency.common.constants.CommonConstants.BLANK_STRING;
29 import net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.AbstractPlantUMLClassesDiagramElement;
30 import net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.PlantUMLClassesDiagramElement;
31 import net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.PlantUMLClassesDiagramInterfaceElement;
32 import net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.stereotype.PlantUMLStereotype;
33
34
35
36
37
38
39
40
41 public class PlantUMLClassesDiagramInterfaceElementImpl extends AbstractPlantUMLClassesDiagramElement implements
42 PlantUMLClassesDiagramInterfaceElement {
43
44
45 private static final long serialVersionUID = 9121299518759595597L;
46
47
48 private PlantUMLStereotype stereotype;
49
50
51
52
53
54
55
56
57 public PlantUMLClassesDiagramInterfaceElementImpl(final String fullName) {
58 this(fullName, null);
59 }
60
61
62
63
64
65
66
67
68
69
70 public PlantUMLClassesDiagramInterfaceElementImpl(final String fullName, final PlantUMLStereotype stereotyp) {
71 super(fullName, INTERFACE_TAG);
72 stereotype = stereotyp;
73 }
74
75
76
77
78
79
80 @Override
81 public PlantUMLClassesDiagramElement deepClone() {
82 final PlantUMLClassesDiagramInterfaceElementImpl p = (PlantUMLClassesDiagramInterfaceElementImpl) super
83 .deepClone();
84 p.stereotype = getStereotype() == null ? null : getStereotype().deepClone();
85 return p;
86 }
87
88
89
90
91
92
93 @Override
94 public boolean equals(final Object obj) {
95 if (this == obj) {
96 return true;
97 }
98 if (!super.equals(obj)) {
99 return false;
100 }
101 if (getClass() != obj.getClass()) {
102 return false;
103 }
104 final PlantUMLClassesDiagramInterfaceElementImpl other = (PlantUMLClassesDiagramInterfaceElementImpl) obj;
105 if (stereotype == null) {
106 if (other.stereotype != null) {
107 return false;
108 }
109 } else if (!stereotype.equals(other.stereotype)) {
110 return false;
111 }
112 return true;
113 }
114
115
116
117
118
119
120 @Override
121 protected String getAdditionalPlantUMLTextDescription() {
122 return getStereotype() != null ? getStereotype().getPlantUMLTextDescription() : BLANK_STRING;
123 }
124
125
126
127
128
129
130 @Override
131 public PlantUMLStereotype getStereotype() {
132 return stereotype;
133 }
134
135
136
137
138
139
140 @Override
141 public int hashCode() {
142 final int prime = 31;
143 int result = super.hashCode();
144 result = prime * result + ((stereotype == null) ? 0 : stereotype.hashCode());
145 return result;
146 }
147
148
149
150
151
152
153 @Override
154 public String toString() {
155 return getClass().getSimpleName() + " [" + super.toString() + ",stereotype=" + stereotype + "]";
156 }
157 }