#107 Template Method JavaDoc
This commit is contained in:
parent
934f99e2a9
commit
fde7f71704
@ -4,13 +4,17 @@ package com.iluwatar.templatemethod;
|
|||||||
*
|
*
|
||||||
* Template Method defines a skeleton for an algorithm. The algorithm subclasses
|
* Template Method defines a skeleton for an algorithm. The algorithm subclasses
|
||||||
* provide implementation for the blank parts.
|
* provide implementation for the blank parts.
|
||||||
*
|
* <p>
|
||||||
* In this example HalflingThief contains StealingMethod that can be changed.
|
* In this example {@link HalflingThief} contains {@link StealingMethod} that can be changed.
|
||||||
* First the thief hits with HitAndRunMethod and then with SubtleMethod.
|
* First the thief hits with {@link HitAndRunMethod} and then with {@link SubtleMethod}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Program entry point
|
||||||
|
* @param args command line args
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
HalflingThief thief = new HalflingThief(new HitAndRunMethod());
|
HalflingThief thief = new HalflingThief(new HitAndRunMethod());
|
||||||
thief.steal();
|
thief.steal();
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.templatemethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Halfling thief uses StealingMethod to steal.
|
* Halfling thief uses {@link StealingMethod} to steal.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HalflingThief {
|
public class HalflingThief {
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.templatemethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* HitAndRunMethod implementation of StealingMethod.
|
* HitAndRunMethod implementation of {@link StealingMethod}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HitAndRunMethod extends StealingMethod {
|
public class HitAndRunMethod extends StealingMethod {
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar.templatemethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* SubtleMethod implementation of StealingMethod.
|
* SubtleMethod implementation of {@link StealingMethod}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SubtleMethod extends StealingMethod {
|
public class SubtleMethod extends StealingMethod {
|
||||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import com.iluwatar.templatemethod.App;
|
import com.iluwatar.templatemethod.App;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Application test
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class AppTest {
|
public class AppTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user