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.ENUM_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.PlantUMLClassesDiagramEnumElement;
32 import net.sourceforge.plantumldependency.cli.plantumldiagram.classes.element.stereotype.PlantUMLStereotype;
33
34
35
36
37
38
39
40
41 public class PlantUMLClassesDiagramEnumElementImpl extends AbstractPlantUMLClassesDiagramElement implements
42 PlantUMLClassesDiagramEnumElement {
43
44
45 private static final long serialVersionUID = -880278043290474038L;
46
47
48 private PlantUMLStereotype stereotype;
49
50
51
52
53
54
55
56
57 public PlantUMLClassesDiagramEnumElementImpl(final String fullName) {
58 this(fullName, null);
59 }
60
61
62
63
64
65
66
67
68
69
70 public PlantUMLClassesDiagramEnumElementImpl(final String fullName, final PlantUMLStereotype stereotyp) {
71 super(fullName, ENUM_TAG);
72 stereotype = stereotyp;
73 }
74
75
76
77
78
79
80 @Override
81 public PlantUMLClassesDiagramElement deepClone() {
82 final PlantUMLClassesDiagramEnumElementImpl p = (PlantUMLClassesDiagramEnumElementImpl) super.deepClone();
83 p.stereotype = getStereotype() == null ? null : getStereotype().deepClone();
84 return p;
85 }
86
87
88
89
90
91
92 @Override
93 public boolean equals(final Object obj) {
94 if (this == obj) {
95 return true;
96 }
97 if (!super.equals(obj)) {
98 return false;
99 }
100 if (getClass() != obj.getClass()) {
101 return false;
102 }
103 final PlantUMLClassesDiagramEnumElementImpl other = (PlantUMLClassesDiagramEnumElementImpl) obj;
104 if (stereotype == null) {
105 if (other.stereotype != null) {
106 return false;
107 }
108 } else if (!stereotype.equals(other.stereotype)) {
109 return false;
110 }
111 return true;
112 }
113
114
115
116
117
118
119 @Override
120 protected String getAdditionalPlantUMLTextDescription() {
121 return getStereotype() != null ? getStereotype().getPlantUMLTextDescription() : BLANK_STRING;
122 }
123
124
125
126
127
128
129 @Override
130 public PlantUMLStereotype getStereotype() {
131 return stereotype;
132 }
133
134
135
136
137
138
139 @Override
140 public int hashCode() {
141 final int prime = 31;
142 int result = super.hashCode();
143 result = prime * result + ((stereotype == null) ? 0 : stereotype.hashCode());
144 return result;
145 }
146
147
148
149
150
151
152 @Override
153 public String toString() {
154 return getClass().getSimpleName() + " [" + super.toString() + ",stereotype=" + stereotype + "]";
155 }
156 }