#107 Chain example JavaDoc improvements

This commit is contained in:
Ilkka Seppala 2015-08-18 21:55:25 +03:00
parent b3b6479f6f
commit fa0acb4366
9 changed files with 229 additions and 190 deletions

View File

@ -2,14 +2,18 @@ package com.iluwatar.chain;
/**
*
* Chain of Responsibility organizes request handlers (RequestHandler) into a
* Chain of Responsibility organizes request handlers ({@link RequestHandler}) into a
* chain where each handler has a chance to act on the request on its turn. In
* this example the king (OrcKing) makes requests and the military orcs
* (OrcCommander, OrcOfficer, OrcSoldier) form the handler chain.
* this example the king ({@link OrcKing}) makes requests and the military orcs
* ({@link OrcCommander}, {@link OrcOfficer}, {@link OrcSoldier}) form the handler chain.
*
*/
public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) {
OrcKing king = new OrcKing();

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* OrcCommander
*
*/
public class OrcCommander extends RequestHandler {
public OrcCommander(RequestHandler handler) {

View File

@ -2,7 +2,7 @@ package com.iluwatar.chain;
/**
*
* Makes requests that are handled by the chain.
* OrcKing makes requests that are handled by the chain.
*
*/
public class OrcKing {

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* OrcOfficer
*
*/
public class OrcOfficer extends RequestHandler {
public OrcOfficer(RequestHandler handler) {

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* OrcSoldier
*
*/
public class OrcSoldier extends RequestHandler {
public OrcSoldier(RequestHandler handler) {

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* Request
*
*/
public class Request {
private String requestDescription;

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* RequestHandler
*
*/
public abstract class RequestHandler {
private RequestHandler next;

View File

@ -1,5 +1,10 @@
package com.iluwatar.chain;
/**
*
* RequestType enumeration
*
*/
public enum RequestType {
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX

View File

@ -4,6 +4,11 @@ import org.junit.Test;
import com.iluwatar.chain.App;
/**
*
* Application test
*
*/
public class AppTest {
@Test