Decorator pattern: Improve the example

This commit is contained in:
Ilkka Seppälä
2016-11-22 23:08:39 +02:00
parent 68ec24c62e
commit 92f8501f7d
10 changed files with 225 additions and 184 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,66 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram version="1.1.9" icons="true" always-add-relationships="false" generalizations="true" realizations="true"
associations="true" dependencies="false" nesting-relationships="true" router="FAN">
<interface id="1" language="java" name="com.iluwatar.decorator.Hostile" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/Hostile.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="554" y="188"/>
<class-diagram version="1.1.11" 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="com.iluwatar.decorator.App" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/App.java" binary="false" corner="BOTTOM_RIGHT">
<position height="113" width="114" x="177" y="237"/>
<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="com.iluwatar.decorator.SimpleTroll" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/SimpleTroll.java" binary="false" corner="BOTTOM_RIGHT">
<position height="149" width="125" x="496" y="237"/>
<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="3" language="java" name="com.iluwatar.decorator.ClubbedTroll" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/ClubbedTroll.java" binary="false" corner="BOTTOM_RIGHT">
<position height="149" width="125" x="249" y="426"/>
<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="4" language="java" name="com.iluwatar.decorator.TrollDecorator" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/TrollDecorator.java" binary="false" corner="BOTTOM_RIGHT">
<position height="149" width="125" x="331" y="237"/>
<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="5" language="java" name="com.iluwatar.decorator.Troll" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/Troll.java" binary="false" corner="BOTTOM_RIGHT">
<position height="113" width="125" x="414" y="426"/>
<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="2" language="java" name="com.iluwatar.decorator.App" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/App.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="117" y="202"/>
<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="3" language="java" name="com.iluwatar.decorator.Troll" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/Troll.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="315" y="100"/>
<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="4" language="java" name="com.iluwatar.decorator.SmartHostile" project="decorator"
file="/decorator/src/main/java/com/iluwatar/decorator/SmartHostile.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="318" y="315"/>
<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>
<dependency id="5">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="4"/>
</dependency>
<realization id="6">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="1"/>
<end type="SOURCE" refId="4"/>
<end type="TARGET" refId="5"/>
</realization>
<association id="7">
<generalization id="7">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="4"/>
</generalization>
<realization id="8">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="5"/>
</realization>
<association id="9">
<end type="SOURCE" refId="4" navigable="false">
<attribute id="8" name="decorated"/>
<multiplicity id="9" minimum="0" maximum="1"/>
<attribute id="10" name="decorated"/>
<multiplicity id="11" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="1" navigable="true"/>
<end type="TARGET" refId="5" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<realization id="10">
<end type="SOURCE" refId="4"/>
<end type="TARGET" refId="1"/>
</realization>
<dependency id="11">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="3"/>
</dependency>
<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"/>