|
||||||||||
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 |
updateCollision(Ball context,
Ball target)
Delegates first to the first composee and then to the second composee. |
void |
updateKill(Ball context)
Delegates the kill request to the first then 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 composeeMethod Detail |
---|
public void updateState(Ball context)
updateState
in interface IUpdateStrategy
updateState
in class ANoOpStrategy
context
- This strategy's context.public void init(Ball context)
init
in interface IUpdateStrategy
init
in class ANoOpStrategy
context
- This strategy's context.public void updateCollision(Ball context, Ball target)
updateCollision
in interface IUpdateStrategy
updateCollision
in class ANoOpStrategy
context
- This strategy's context.target
- The ball the context collided with.public void updateKill(Ball context)
updateKill
in interface IUpdateStrategy
updateKill
in class ANoOpStrategy
context
- This strategy's context.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |