mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-11 22:13:34 +00:00
Class diagram & fix relation between units
This commit is contained in:
1 parent
678524704c
commit
c92a8daeda
8 files changed
+190
-17
No files matched your search
@@ -9,8 +9,6 @@ import concreteextensions.Commander;
|
||||
*/
|
||||
public class CommanderUnit extends Unit {
|
||||
|
||||
private CommanderExtension commanderExtension;
|
||||
|
||||
public CommanderUnit(String name) {
|
||||
super(name);
|
||||
}
|
||||
@@ -19,10 +17,10 @@ public class CommanderUnit extends Unit {
|
||||
public UnitExtension getUnitExtension(String extensionName) {
|
||||
|
||||
if (extensionName.equals("CommanderExtension")) {
|
||||
if (commanderExtension == null) {
|
||||
commanderExtension = new Commander(this);
|
||||
if (unitExtension == null) {
|
||||
unitExtension = new Commander(this);
|
||||
}
|
||||
return commanderExtension;
|
||||
return unitExtension;
|
||||
}
|
||||
|
||||
return super.getUnitExtension(extensionName);
|
||||
|
||||
Reference in new issue
Block a user