X Tutup
Skip to content

Commit 98abe5b

Browse files
committed
iluwatar#107 Improvements for Command example JavaDocs
1 parent fa0acb4 commit 98abe5b

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

command/src/main/java/com/iluwatar/command/App.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
/**
44
*
55
* In Command pattern actions are objects that can be executed and undone.
6-
*
6+
* <p>
77
* Four terms always associated with the command pattern are command, receiver, invoker and client. A command
8-
* object (spell) knows about receiver (target) and invokes a method of the receiver. Values for parameters of
8+
* object (spell) knows about the receiver (target) and invokes a method of the receiver. Values for parameters of
99
* the receiver method are stored in the command. The receiver then does the work. An invoker object (wizard)
1010
* knows how to execute a command, and optionally does bookkeeping about the command execution. The invoker
1111
* does not know anything about a concrete command, it knows only about command interface. Both an invoker object
1212
* and several command objects are held by a client object (app). The client decides which commands to execute at
1313
* which points. To execute a command, it passes the command object to the invoker object.
14-
*
14+
* <p>
1515
* In other words, in this example the wizard casts spells on the goblin. The wizard keeps track of the previous
1616
* spells cast, so it is easy to undo them. In addition, the wizard keeps track of the spells undone, so they
1717
* can be redone.
@@ -20,6 +20,10 @@
2020
*/
2121
public class App {
2222

23+
/**
24+
* Program entry point
25+
* @param args command line args
26+
*/
2327
public static void main(String[] args) {
2428
Wizard wizard = new Wizard();
2529
Goblin goblin = new Goblin();
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
package com.iluwatar.command;
2-
3-
import org.junit.Test;
4-
5-
import com.iluwatar.command.App;
6-
7-
public class AppTest {
8-
9-
@Test
10-
public void test() {
11-
String[] args = {};
12-
App.main(args);
13-
}
14-
}
1+
package com.iluwatar.command;
2+
3+
import org.junit.Test;
4+
5+
import com.iluwatar.command.App;
6+
7+
/**
8+
*
9+
* Application test
10+
*
11+
*/
12+
public class AppTest {
13+
14+
@Test
15+
public void test() {
16+
String[] args = {};
17+
App.main(args);
18+
}
19+
}

0 commit comments

Comments
 (0)
X Tutup