Skip to content

Commit c92a8da

Browse files
Class diagram & fix relation between units
1 parent 6785247 commit c92a8da

File tree

8 files changed

+190
-17
lines changed

8 files changed

+190
-17
lines changed
37.1 KB
Loading
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<class-diagram version="1.2.0" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
3+
realizations="true" associations="true" dependencies="false" nesting-relationships="true" router="FAN">
4+
<class id="1" language="java" name="concreteextensions.Soldier" project="extension-objects"
5+
file="/extension-objects/src/main/java/concreteextensions/Soldier.java" binary="false" corner="BOTTOM_RIGHT">
6+
<position height="-1" width="-1" x="483" y="339"/>
7+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
8+
sort-features="false" accessors="true" visibility="true">
9+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
10+
<operations public="true" package="true" protected="true" private="true" static="true"/>
11+
</display>
12+
</class>
13+
<class id="2" language="java" name="units.Unit" project="extension-objects"
14+
file="/extension-objects/src/main/java/units/Unit.java" binary="false" corner="BOTTOM_RIGHT">
15+
<position height="-1" width="-1" x="192" y="115"/>
16+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
17+
sort-features="false" accessors="true" visibility="true">
18+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
19+
<operations public="true" package="true" protected="true" private="true" static="true"/>
20+
</display>
21+
</class>
22+
<interface id="3" language="java" name="abstractextensions.SoldierExtension" project="extension-objects"
23+
file="/extension-objects/src/main/java/abstractextensions/SoldierExtension.java" binary="false"
24+
corner="BOTTOM_RIGHT">
25+
<position height="-1" width="-1" x="510" y="229"/>
26+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
27+
sort-features="false" accessors="true" visibility="true">
28+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
29+
<operations public="true" package="true" protected="true" private="true" static="true"/>
30+
</display>
31+
</interface>
32+
<interface id="4" language="java" name="abstractextensions.UnitExtension" project="extension-objects"
33+
file="/extension-objects/src/main/java/abstractextensions/UnitExtension.java" binary="false" corner="BOTTOM_RIGHT">
34+
<position height="-1" width="-1" x="510" y="116"/>
35+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
36+
sort-features="false" accessors="true" visibility="true">
37+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
38+
<operations public="true" package="true" protected="true" private="true" static="true"/>
39+
</display>
40+
</interface>
41+
<class id="5" language="java" name="units.SoldierUnit" project="extension-objects"
42+
file="/extension-objects/src/main/java/units/SoldierUnit.java" binary="false" corner="BOTTOM_RIGHT">
43+
<position height="-1" width="-1" x="157" y="355"/>
44+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
45+
sort-features="false" accessors="true" visibility="true">
46+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
47+
<operations public="true" package="true" protected="true" private="true" static="true"/>
48+
</display>
49+
</class>
50+
<class id="6" language="java" name="concreteextensions.Sergeant" project="extension-objects"
51+
file="/extension-objects/src/main/java/concreteextensions/Sergeant.java" binary="false" corner="BOTTOM_RIGHT">
52+
<position height="-1" width="-1" x="650" y="375"/>
53+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
54+
sort-features="false" accessors="true" visibility="true">
55+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
56+
<operations public="true" package="true" protected="true" private="true" static="true"/>
57+
</display>
58+
</class>
59+
<interface id="7" language="java" name="abstractextensions.SergeantExtension" project="extension-objects"
60+
file="/extension-objects/src/main/java/abstractextensions/SergeantExtension.java" binary="false"
61+
corner="BOTTOM_RIGHT">
62+
<position height="-1" width="-1" x="672" y="230"/>
63+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
64+
sort-features="false" accessors="true" visibility="true">
65+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
66+
<operations public="true" package="true" protected="true" private="true" static="true"/>
67+
</display>
68+
</interface>
69+
<class id="8" language="java" name="units.SergeantUnit" project="extension-objects"
70+
file="/extension-objects/src/main/java/units/SergeantUnit.java" binary="false" corner="BOTTOM_RIGHT">
71+
<position height="-1" width="-1" x="315" y="460"/>
72+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
73+
sort-features="false" accessors="true" visibility="true">
74+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
75+
<operations public="true" package="true" protected="true" private="true" static="true"/>
76+
</display>
77+
</class>
78+
<class id="9" language="java" name="units.CommanderUnit" project="extension-objects"
79+
file="/extension-objects/src/main/java/units/CommanderUnit.java" binary="false" corner="BOTTOM_RIGHT">
80+
<position height="99" width="210" x="429" y="476"/>
81+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
82+
sort-features="false" accessors="true" visibility="true">
83+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
84+
<operations public="true" package="true" protected="true" private="true" static="true"/>
85+
</display>
86+
</class>
87+
<class id="10" language="java" name="concreteextensions.Commander" project="extension-objects"
88+
file="/extension-objects/src/main/java/concreteextensions/Commander.java" binary="false" corner="BOTTOM_RIGHT">
89+
<position height="-1" width="-1" x="823" y="477"/>
90+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
91+
sort-features="false" accessors="true" visibility="true">
92+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
93+
<operations public="true" package="true" protected="true" private="true" static="true"/>
94+
</display>
95+
</class>
96+
<interface id="11" language="java" name="abstractextensions.CommanderExtension" project="extension-objects"
97+
file="/extension-objects/src/main/java/abstractextensions/CommanderExtension.java" binary="false"
98+
corner="BOTTOM_RIGHT">
99+
<position height="-1" width="-1" x="827" y="217"/>
100+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
101+
sort-features="false" accessors="true" visibility="true">
102+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
103+
<operations public="true" package="true" protected="true" private="true" static="true"/>
104+
</display>
105+
</interface>
106+
<realization id="12">
107+
<end type="SOURCE" refId="1"/>
108+
<end type="TARGET" refId="3"/>
109+
</realization>
110+
<realization id="13">
111+
<end type="SOURCE" refId="10"/>
112+
<end type="TARGET" refId="11"/>
113+
</realization>
114+
<generalization id="14">
115+
<end type="SOURCE" refId="9"/>
116+
<end type="TARGET" refId="2"/>
117+
</generalization>
118+
<association id="15">
119+
<end type="SOURCE" refId="1" navigable="false">
120+
<attribute id="16" name="unit"/>
121+
<multiplicity id="17" minimum="0" maximum="1"/>
122+
</end>
123+
<end type="TARGET" refId="5" navigable="true"/>
124+
<display labels="true" multiplicity="true"/>
125+
</association>
126+
<association id="18">
127+
<end type="SOURCE" refId="10" navigable="false">
128+
<attribute id="19" name="unit"/>
129+
<multiplicity id="20" minimum="0" maximum="1"/>
130+
</end>
131+
<end type="TARGET" refId="9" navigable="true"/>
132+
<display labels="true" multiplicity="true"/>
133+
</association>
134+
<association id="21">
135+
<end type="SOURCE" refId="2" navigable="false">
136+
<attribute id="22" name="unitExtension"/>
137+
<multiplicity id="23" minimum="0" maximum="1"/>
138+
</end>
139+
<end type="TARGET" refId="4" navigable="true"/>
140+
<display labels="true" multiplicity="true"/>
141+
</association>
142+
<realization id="24">
143+
<end type="SOURCE" refId="6"/>
144+
<end type="TARGET" refId="7"/>
145+
</realization>
146+
<generalization id="25">
147+
<end type="SOURCE" refId="3"/>
148+
<end type="TARGET" refId="4"/>
149+
</generalization>
150+
<generalization id="26">
151+
<end type="SOURCE" refId="5"/>
152+
<end type="TARGET" refId="2"/>
153+
</generalization>
154+
<generalization id="27">
155+
<end type="SOURCE" refId="7"/>
156+
<end type="TARGET" refId="4"/>
157+
</generalization>
158+
<generalization id="28">
159+
<end type="SOURCE" refId="8"/>
160+
<end type="TARGET" refId="2"/>
161+
</generalization>
162+
<association id="29">
163+
<end type="SOURCE" refId="6" navigable="false">
164+
<attribute id="30" name="unit"/>
165+
<multiplicity id="31" minimum="0" maximum="1"/>
166+
</end>
167+
<end type="TARGET" refId="8" navigable="true"/>
168+
<display labels="true" multiplicity="true"/>
169+
</association>
170+
<generalization id="32">
171+
<end type="SOURCE" refId="11"/>
172+
<end type="TARGET" refId="4"/>
173+
</generalization>
174+
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
175+
sort-features="false" accessors="true" visibility="true">
176+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
177+
<operations public="true" package="true" protected="true" private="true" static="true"/>
178+
</classifier-display>
179+
<association-display labels="true" multiplicity="true"/>
180+
</class-diagram>
14.1 KB
Loading

extension-objects/src/main/java/units/CommanderUnit.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*/
1010
public class CommanderUnit extends Unit {
1111

12-
private CommanderExtension commanderExtension;
13-
1412
public CommanderUnit(String name) {
1513
super(name);
1614
}
@@ -19,10 +17,10 @@ public CommanderUnit(String name) {
1917
public UnitExtension getUnitExtension(String extensionName) {
2018

2119
if (extensionName.equals("CommanderExtension")) {
22-
if (commanderExtension == null) {
23-
commanderExtension = new Commander(this);
20+
if (unitExtension == null) {
21+
unitExtension = new Commander(this);
2422
}
25-
return commanderExtension;
23+
return unitExtension;
2624
}
2725

2826
return super.getUnitExtension(extensionName);

extension-objects/src/main/java/units/SergeantUnit.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*/
1010
public class SergeantUnit extends Unit {
1111

12-
private SergeantExtension sergeantExtension;
13-
1412
public SergeantUnit(String name) {
1513
super(name);
1614
}
@@ -19,10 +17,10 @@ public SergeantUnit(String name) {
1917
public UnitExtension getUnitExtension(String extensionName) {
2018

2119
if (extensionName.equals("SergeantExtension")) {
22-
if (sergeantExtension == null) {
23-
sergeantExtension = new Sergeant(this);
20+
if (unitExtension == null) {
21+
unitExtension = new Sergeant(this);
2422
}
25-
return sergeantExtension;
23+
return unitExtension;
2624
}
2725

2826
return super.getUnitExtension(extensionName);

extension-objects/src/main/java/units/SoldierUnit.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*/
1010
public class SoldierUnit extends Unit {
1111

12-
private SoldierExtension soldierExtension;
13-
1412
public SoldierUnit(String name) {
1513
super(name);
1614
}
@@ -19,11 +17,11 @@ public SoldierUnit(String name) {
1917
public UnitExtension getUnitExtension(String extensionName) {
2018

2119
if (extensionName.equals("SoldierExtension")) {
22-
if (soldierExtension == null) {
23-
soldierExtension = new Soldier(this);
20+
if (unitExtension == null) {
21+
unitExtension = new Soldier(this);
2422
}
2523

26-
return soldierExtension;
24+
return unitExtension;
2725
}
2826
return super.getUnitExtension(extensionName);
2927
}

extension-objects/src/main/java/units/Unit.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class Unit {
99

1010
private String name;
11+
protected UnitExtension unitExtension = null;
1112

1213
public Unit(String name) {
1314
this.name = name;

extension-objects/src/test/java/units/UnitTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
*/
1212
public class UnitTest {
1313

14-
private Unit unit;
15-
1614
@Test
1715
public void testConstGetSet() throws Exception {
1816
final String name = "testName";

0 commit comments

Comments
 (0)