ballwar.view
Interface IBallCreateAdapter


public interface IBallCreateAdapter

Interface that represents the ball creattion capabilities of the model offered to the view.


Method Summary
 Object addPaintStrategy(String classname)
          Add a paint strategy to the the model.
 Object addStrategy(String classname)
          Add a strategy to the the model.
 Object combineStrategies(Object fac1, Object fac2)
          Add a combination of two strategies to the model.
 void makeBall(Object strategyFac, Object paintFac)
          Makes a ball in the model using the given factory, whose type and usage is unavailable to the view.
 void makeSwitcher(Object pfac)
          Tells the model to add a ball using the currently defined SwitcherStrategy.
 

Method Detail

makeBall

void makeBall(Object strategyFac,
              Object paintFac)
Makes a ball in the model using the given factory, whose type and usage is unavailable to the view. The view simply stores factories given to it from the model and returns them when requested.

Parameters:
strategyFac - The UpdateStrategy factory for the model to use to make a new ball.
paintFac - The PaintStrategy factory for the model to use to make a new ball.

addStrategy

Object addStrategy(String classname)
Add a strategy to the the model. The model returns a factory that can be used to create a ball with that stategy. The view does not need to know the type and usage of the returned factory. It simply returns it to the model through the makeBall() method. In thi implementation, a factory to instantiate the strategy is returned, as their is only one concrete class of balls, but the view is unaware of this.

Parameters:
classname - The classname of the strategy to add.
Returns:
The factory to be used to create a ball with this factory.

combineStrategies

Object combineStrategies(Object fac1,
                         Object fac2)
Add a combination of two strategies to the model. The model is given the factories for the two strategies (balls, so far as the view knows), and a factory to make a ball with the combine strategies is returned. In this implementation, the model does not actually provide (or need to provide) this service. Instead, the controller intercepts the call, and constructs a new factory on the fly (via anonymous inner class) and returns it. This can be accomplished simply by knowing the interface supported by the factory and by knowing about MultiStrategy, which the controller does.

Parameters:
fac1 - The first factory to use
fac2 - The second factory to use
Returns:
A factory to create a ball (strategy actually) using the combined strategies.

addPaintStrategy

Object addPaintStrategy(String classname)
Add a paint strategy to the the model. The model returns a factory that can be used to create a ball with that paint stategy. The view does not need to know the type and usage of the returned factory. It simply returns it to the model through the makeBall() method. In thi implementation, a factory to instantiate the strategy is returned, as their is only one concrete class of balls, but the view is unaware of this.

Parameters:
classname - The classname of the strategy to add.
Returns:
The factory to be used to create a ball with this factory.

makeSwitcher

void makeSwitcher(Object pfac)
Tells the model to add a ball using the currently defined SwitcherStrategy.