Improved code comments for template method example.
This commit is contained in:
parent
991653062d
commit
b12243b94c
@ -2,8 +2,11 @@ package com.iluwatar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Template Method (StealingMethod) defines skeleton for the algorithm and
|
* Template Method defines a skeleton for an algorithm. The algorithm subclasses
|
||||||
* subclasses (HitAndRunMethod, SubtleMethod) fill in the blanks.
|
* provide implementation for the blank parts.
|
||||||
|
*
|
||||||
|
* In this example HalflingThief contains StealingMethod that can be changed.
|
||||||
|
* First the thief hits with HitAndRunMethod and then with SubtleMethod.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* HitAndRunMethod implementation of StealingMethod.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class HitAndRunMethod extends StealingMethod {
|
public class HitAndRunMethod extends StealingMethod {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package com.iluwatar;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Template Method base class.
|
* StealingMethod defines skeleton for the algorithm.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class StealingMethod {
|
public abstract class StealingMethod {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* SubtleMethod implementation of StealingMethod.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class SubtleMethod extends StealingMethod {
|
public class SubtleMethod extends StealingMethod {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user