The WASA project |
|
||
|
Null ObjectIn fr.jussieu.gla.wasa.core, DefaultCustomizer.NullEditor implements ICustomizer.ICustomizerEditor, providing a do-nothing implementation when needed. Abstract FactoryThe Abstract Factory is implemented in order to let non-visual objects provide visual editors. fr.jussieu.gla.wasa.core.ICustomizer plays the Abstract Factory role, and ICustomizer.ICustomizerEditor defines the Product to be created. Concrete Factories are :
SingletonWe avoided the use of the Singleton Pattern, since we want to avoid unwanted
side-effects between several Engines or Monitors running in the same VM.
Singleton Pattern is used only with stateless classes, as :
PrototypeThe Monitor GUI allows to create several Engine Nodes, which hold fr.jussieu.gla.wasa.core.IEngineParameters instances. An IEngineParameter instance should provide "a mean" to get a fresh fr.jussieu.gla.wasa.core.ICustomizer instance for each new Engine created. "Fresh instance" means that two Engines should not share the same ICustomizer instance, since it makes sense for the developer to make them stateful. So, a mean could be to use the Factory Method Pattern, which would create configured instances of ICustomizer. The problem is that it would require a Factory class for each concrete ICustomizer class. Using the Prototype Pattern allows to define several instances and passing them to the Monitor GUI. The Monitor GUI lets the user choose the Prototype instance to use when creating a new Engine Node, and the new Engine instance receives a prototype's clone as Customizer. StrategyUser-defined behaviors may be plugged in, using Strategy objects. fr.jussieu.gla.wasa.core.ErrorMixer is a concrete class calculating errors on Vars. One can derive it and plug it in the Problem instance. fr.jussieu.gla.wasa.core.ICustomizer defines methods called at certain steps of the Algorithm. ICustomizer is the Abstract Strategy. Concrete Strategy is implemented by :
CommandCommand pattern is implemented by *Action classes in fr.jussieu.gla.wasa.monitor.gui.actions package. They derive from javax.swing.AbstractAction class. MementoThe Memento Pattern is used for saving Buisness Objects state, in order to restore it later. fr.jussieu.gla.wasa.core.Configuration class plays the Memento role. fr.jussieu.gla.wasa.core.Problem is the Originator. fr.jussieu.gla.wasa.core.Engine and Algorithm play the Caretaker role, deciding of creating and restoring Configurations. IteratorThe fr.jussieu.gla.wasa.util.RandomIterator allows to iterate
on a java.util.List, whose order has been changed randomly. Iterating
a List with the RandomIterator means taking one element randomly, once
and only once. Statefr.jussieu.gla.wasa.monitor.model.StepNode objects can be asked to synthetize informations about owned Configuration objects. This allows discarding those objects, in order to save memory. A StepNode should provide the same statistics about Configuration, with two different concrete behaviors :
The Context role is handled by the StepNode class itself.
StepNode implements the IStatistic interface in order to make the compiler check that all IStatistics methods are implemented.
|
||