Skip to content

Commit

Permalink
Refactoring Chain of Responsability example
Browse files Browse the repository at this point in the history
  • Loading branch information
peterm85 committed Nov 21, 2019
1 parent b738911 commit 50b8fa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/chain/examples/army/Officer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public Officer(String name, String order) {
public String order() {
String result=null;

if(super.order()!=null && !super.order().equals("(sin orden)")) {
if(super.order()!=null && !super.order().equals(UNKNOWN_ORDER)) {
result = super.order();

}else if (_order != null) {
Expand Down
4 changes: 3 additions & 1 deletion src/chain/examples/army/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public abstract class Unit {

static final String UNKNOWN_ORDER = "(sin orden)";

private Unit _command;
private String _name;

Expand All @@ -19,6 +21,6 @@ public void setCommand(Unit command) {
}

public String order() {
return (_command != null ? _command.order() : "(sin orden)");
return (_command != null ? _command.order() : UNKNOWN_ORDER);
}
}

0 comments on commit 50b8fa0

Please sign in to comment.