|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectballworld.model.strategy.SwitcherStrategy
public class SwitcherStrategy
Decorator design pattern strategy that provides an indirection layer and encapsulation over another strategy, enabling it to be switched without disturbing the context ball.
| Field Summary | |
|---|---|
private IUpdateStrategy |
_strategy
The decoree strategy. |
| Constructor Summary | |
|---|---|
SwitcherStrategy()
Constructor for the strategy. |
|
| Method Summary | |
|---|---|
void |
setStrategy(IUpdateStrategy newStrategy)
Set the decoree strategy to a new value |
void |
updateState(Ball context)
Delegates to the decoree strategy as the context's strategy. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private IUpdateStrategy _strategy
| Constructor Detail |
|---|
public SwitcherStrategy()
| Method Detail |
|---|
public void updateState(Ball context)
updateState in interface IUpdateStrategycontext - The host ball for this strategypublic void setStrategy(IUpdateStrategy newStrategy)
newStrategy - The new strategy that wil set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||