ballwar.model.strategy
Class HeavyStrategy
java.lang.Object
ballwar.model.strategy.ANoOpStrategy
ballwar.model.strategy.HeavyStrategy
- All Implemented Interfaces:
- IUpdateStrategy
public class HeavyStrategy
- extends ANoOpStrategy
An ANoOpStrategy-based strategy who initializes its context to have an infinitely large (positive) mass.
Thus the velocity of the context is not altered by a collision. Can be combined with RockStrategy to
create an immovable object. Warning: infinitely heavy balls continuously add energy into the system,
causing the velocitiy of all other balls to increase without an upper bound.
Method Summary |
void |
init(Ball context)
Initializes the context's mass to positive infinity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HeavyStrategy
public HeavyStrategy()
init
public void init(Ball context)
- Initializes the context's mass to positive infinity.
- Specified by:
init
in interface IUpdateStrategy
- Overrides:
init
in class ANoOpStrategy
- Parameters:
context
- The strategy's context.