|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.MultiStrategy
public class MultiStrategy
An ANoOpStrategy-based strategy that is the composition of two IUpdateStrategies. All behaviors are delegated sequentially to each of the composees.
| Field Summary | |
|---|---|
private IUpdateStrategy |
_s1
First IUpdateStrategy composee |
private IUpdateStrategy |
_s2
Second IUpdateStrategy composee |
| Fields inherited from interface ballwar.model.IUpdateStrategy |
|---|
NullObject |
| Constructor Summary | |
|---|---|
MultiStrategy(IUpdateStrategy s1,
IUpdateStrategy s2)
Constructor for the class. |
|
| Method Summary | |
|---|---|
void |
init(Ball context)
Initializes the context with the first then the second composee. |
void |
kill(Ball context)
Delegates the kill request to the first then the second composee. |
void |
updateCollision(Ball context,
Ball target)
Delegates first to the first composee and then to the second composee. |
void |
updateState(Ball context)
Updates the state of the context with the first composee and then the second composee. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private IUpdateStrategy _s1
private IUpdateStrategy _s2
| Constructor Detail |
|---|
public MultiStrategy(IUpdateStrategy s1,
IUpdateStrategy s2)
s1 - The first IUpdateStrategy composees2 - The second IUpdateStrategy composee| Method Detail |
|---|
public void updateState(Ball context)
updateState in interface IUpdateStrategyupdateState in class ANoOpStrategycontext - This strategy's context.public void init(Ball context)
init in interface IUpdateStrategyinit in class ANoOpStrategycontext - This strategy's context.
public void updateCollision(Ball context,
Ball target)
updateCollision in interface IUpdateStrategyupdateCollision in class ANoOpStrategycontext - This strategy's context.target - The ball the context collided with.public void kill(Ball context)
kill in interface IUpdateStrategykill in class ANoOpStrategycontext - This strategy's context.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||