Class diagram & fix relation between units
This commit is contained in:
parent
678524704c
commit
c92a8daeda
BIN
extension-objects/etc/extension_obj.png
Normal file
BIN
extension-objects/etc/extension_obj.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
180
extension-objects/etc/extension_obj.ucls
Normal file
180
extension-objects/etc/extension_obj.ucls
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<class-diagram version="1.2.0" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
|
||||||
|
realizations="true" associations="true" dependencies="false" nesting-relationships="true" router="FAN">
|
||||||
|
<class id="1" language="java" name="concreteextensions.Soldier" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/concreteextensions/Soldier.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="483" y="339"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<class id="2" language="java" name="units.Unit" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/units/Unit.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="192" y="115"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<interface id="3" language="java" name="abstractextensions.SoldierExtension" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/abstractextensions/SoldierExtension.java" binary="false"
|
||||||
|
corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="510" y="229"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</interface>
|
||||||
|
<interface id="4" language="java" name="abstractextensions.UnitExtension" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/abstractextensions/UnitExtension.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="510" y="116"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</interface>
|
||||||
|
<class id="5" language="java" name="units.SoldierUnit" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/units/SoldierUnit.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="157" y="355"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<class id="6" language="java" name="concreteextensions.Sergeant" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/concreteextensions/Sergeant.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="650" y="375"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<interface id="7" language="java" name="abstractextensions.SergeantExtension" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/abstractextensions/SergeantExtension.java" binary="false"
|
||||||
|
corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="672" y="230"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</interface>
|
||||||
|
<class id="8" language="java" name="units.SergeantUnit" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/units/SergeantUnit.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="315" y="460"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<class id="9" language="java" name="units.CommanderUnit" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/units/CommanderUnit.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="99" width="210" x="429" y="476"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<class id="10" language="java" name="concreteextensions.Commander" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/concreteextensions/Commander.java" binary="false" corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="823" y="477"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</class>
|
||||||
|
<interface id="11" language="java" name="abstractextensions.CommanderExtension" project="extension-objects"
|
||||||
|
file="/extension-objects/src/main/java/abstractextensions/CommanderExtension.java" binary="false"
|
||||||
|
corner="BOTTOM_RIGHT">
|
||||||
|
<position height="-1" width="-1" x="827" y="217"/>
|
||||||
|
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</display>
|
||||||
|
</interface>
|
||||||
|
<realization id="12">
|
||||||
|
<end type="SOURCE" refId="1"/>
|
||||||
|
<end type="TARGET" refId="3"/>
|
||||||
|
</realization>
|
||||||
|
<realization id="13">
|
||||||
|
<end type="SOURCE" refId="10"/>
|
||||||
|
<end type="TARGET" refId="11"/>
|
||||||
|
</realization>
|
||||||
|
<generalization id="14">
|
||||||
|
<end type="SOURCE" refId="9"/>
|
||||||
|
<end type="TARGET" refId="2"/>
|
||||||
|
</generalization>
|
||||||
|
<association id="15">
|
||||||
|
<end type="SOURCE" refId="1" navigable="false">
|
||||||
|
<attribute id="16" name="unit"/>
|
||||||
|
<multiplicity id="17" minimum="0" maximum="1"/>
|
||||||
|
</end>
|
||||||
|
<end type="TARGET" refId="5" navigable="true"/>
|
||||||
|
<display labels="true" multiplicity="true"/>
|
||||||
|
</association>
|
||||||
|
<association id="18">
|
||||||
|
<end type="SOURCE" refId="10" navigable="false">
|
||||||
|
<attribute id="19" name="unit"/>
|
||||||
|
<multiplicity id="20" minimum="0" maximum="1"/>
|
||||||
|
</end>
|
||||||
|
<end type="TARGET" refId="9" navigable="true"/>
|
||||||
|
<display labels="true" multiplicity="true"/>
|
||||||
|
</association>
|
||||||
|
<association id="21">
|
||||||
|
<end type="SOURCE" refId="2" navigable="false">
|
||||||
|
<attribute id="22" name="unitExtension"/>
|
||||||
|
<multiplicity id="23" minimum="0" maximum="1"/>
|
||||||
|
</end>
|
||||||
|
<end type="TARGET" refId="4" navigable="true"/>
|
||||||
|
<display labels="true" multiplicity="true"/>
|
||||||
|
</association>
|
||||||
|
<realization id="24">
|
||||||
|
<end type="SOURCE" refId="6"/>
|
||||||
|
<end type="TARGET" refId="7"/>
|
||||||
|
</realization>
|
||||||
|
<generalization id="25">
|
||||||
|
<end type="SOURCE" refId="3"/>
|
||||||
|
<end type="TARGET" refId="4"/>
|
||||||
|
</generalization>
|
||||||
|
<generalization id="26">
|
||||||
|
<end type="SOURCE" refId="5"/>
|
||||||
|
<end type="TARGET" refId="2"/>
|
||||||
|
</generalization>
|
||||||
|
<generalization id="27">
|
||||||
|
<end type="SOURCE" refId="7"/>
|
||||||
|
<end type="TARGET" refId="4"/>
|
||||||
|
</generalization>
|
||||||
|
<generalization id="28">
|
||||||
|
<end type="SOURCE" refId="8"/>
|
||||||
|
<end type="TARGET" refId="2"/>
|
||||||
|
</generalization>
|
||||||
|
<association id="29">
|
||||||
|
<end type="SOURCE" refId="6" navigable="false">
|
||||||
|
<attribute id="30" name="unit"/>
|
||||||
|
<multiplicity id="31" minimum="0" maximum="1"/>
|
||||||
|
</end>
|
||||||
|
<end type="TARGET" refId="8" navigable="true"/>
|
||||||
|
<display labels="true" multiplicity="true"/>
|
||||||
|
</association>
|
||||||
|
<generalization id="32">
|
||||||
|
<end type="SOURCE" refId="11"/>
|
||||||
|
<end type="TARGET" refId="4"/>
|
||||||
|
</generalization>
|
||||||
|
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
|
||||||
|
sort-features="false" accessors="true" visibility="true">
|
||||||
|
<attributes public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
<operations public="true" package="true" protected="true" private="true" static="true"/>
|
||||||
|
</classifier-display>
|
||||||
|
<association-display labels="true" multiplicity="true"/>
|
||||||
|
</class-diagram>
|
BIN
extension-objects/etc/extension_obj1.png
Normal file
BIN
extension-objects/etc/extension_obj1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -9,8 +9,6 @@ import concreteextensions.Commander;
|
|||||||
*/
|
*/
|
||||||
public class CommanderUnit extends Unit {
|
public class CommanderUnit extends Unit {
|
||||||
|
|
||||||
private CommanderExtension commanderExtension;
|
|
||||||
|
|
||||||
public CommanderUnit(String name) {
|
public CommanderUnit(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
@ -19,10 +17,10 @@ public class CommanderUnit extends Unit {
|
|||||||
public UnitExtension getUnitExtension(String extensionName) {
|
public UnitExtension getUnitExtension(String extensionName) {
|
||||||
|
|
||||||
if (extensionName.equals("CommanderExtension")) {
|
if (extensionName.equals("CommanderExtension")) {
|
||||||
if (commanderExtension == null) {
|
if (unitExtension == null) {
|
||||||
commanderExtension = new Commander(this);
|
unitExtension = new Commander(this);
|
||||||
}
|
}
|
||||||
return commanderExtension;
|
return unitExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getUnitExtension(extensionName);
|
return super.getUnitExtension(extensionName);
|
||||||
|
@ -9,8 +9,6 @@ import concreteextensions.Sergeant;
|
|||||||
*/
|
*/
|
||||||
public class SergeantUnit extends Unit {
|
public class SergeantUnit extends Unit {
|
||||||
|
|
||||||
private SergeantExtension sergeantExtension;
|
|
||||||
|
|
||||||
public SergeantUnit(String name) {
|
public SergeantUnit(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
@ -19,10 +17,10 @@ public class SergeantUnit extends Unit {
|
|||||||
public UnitExtension getUnitExtension(String extensionName) {
|
public UnitExtension getUnitExtension(String extensionName) {
|
||||||
|
|
||||||
if (extensionName.equals("SergeantExtension")) {
|
if (extensionName.equals("SergeantExtension")) {
|
||||||
if (sergeantExtension == null) {
|
if (unitExtension == null) {
|
||||||
sergeantExtension = new Sergeant(this);
|
unitExtension = new Sergeant(this);
|
||||||
}
|
}
|
||||||
return sergeantExtension;
|
return unitExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getUnitExtension(extensionName);
|
return super.getUnitExtension(extensionName);
|
||||||
|
@ -9,8 +9,6 @@ import concreteextensions.Soldier;
|
|||||||
*/
|
*/
|
||||||
public class SoldierUnit extends Unit {
|
public class SoldierUnit extends Unit {
|
||||||
|
|
||||||
private SoldierExtension soldierExtension;
|
|
||||||
|
|
||||||
public SoldierUnit(String name) {
|
public SoldierUnit(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
@ -19,11 +17,11 @@ public class SoldierUnit extends Unit {
|
|||||||
public UnitExtension getUnitExtension(String extensionName) {
|
public UnitExtension getUnitExtension(String extensionName) {
|
||||||
|
|
||||||
if (extensionName.equals("SoldierExtension")) {
|
if (extensionName.equals("SoldierExtension")) {
|
||||||
if (soldierExtension == null) {
|
if (unitExtension == null) {
|
||||||
soldierExtension = new Soldier(this);
|
unitExtension = new Soldier(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return soldierExtension;
|
return unitExtension;
|
||||||
}
|
}
|
||||||
return super.getUnitExtension(extensionName);
|
return super.getUnitExtension(extensionName);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import abstractextensions.UnitExtension;
|
|||||||
public class Unit {
|
public class Unit {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
protected UnitExtension unitExtension = null;
|
||||||
|
|
||||||
public Unit(String name) {
|
public Unit(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -11,8 +11,6 @@ import static org.junit.Assert.*;
|
|||||||
*/
|
*/
|
||||||
public class UnitTest {
|
public class UnitTest {
|
||||||
|
|
||||||
private Unit unit;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstGetSet() throws Exception {
|
public void testConstGetSet() throws Exception {
|
||||||
final String name = "testName";
|
final String name = "testName";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user