2014-08-23 13:37:42 +03:00
|
|
|
package com.iluwatar;
|
|
|
|
|
2014-08-31 11:31:03 +03:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Halfling thief uses StealingMethod to steal.
|
2014-10-08 13:42:12 +01:00
|
|
|
*
|
2014-08-31 11:31:03 +03:00
|
|
|
*/
|
2014-08-23 13:37:42 +03:00
|
|
|
public class HalflingThief {
|
|
|
|
|
|
|
|
private StealingMethod method;
|
|
|
|
|
|
|
|
public HalflingThief(StealingMethod method) {
|
|
|
|
this.method = method;
|
|
|
|
}
|
2014-10-08 13:42:12 +01:00
|
|
|
|
2014-08-23 13:37:42 +03:00
|
|
|
public void steal() {
|
|
|
|
method.steal();
|
|
|
|
}
|
2014-10-08 13:42:12 +01:00
|
|
|
|
2014-08-23 13:37:42 +03:00
|
|
|
public void changeMethod(StealingMethod method) {
|
|
|
|
this.method = method;
|
|
|
|
}
|
|
|
|
}
|