Class Module

java.lang.Object
   |
   +----Module

class Module
extends Object
implements StoreElement
An occurrance of a module in a network.

Version:
$Revision: 1.81 $
See Also:
ModuleType, Network

Variable Index

 o endModule
 o inConnectors
 o marked
A module can be marked for several reasons.
 o messagesDialog
 o moduleCode
An instance of the class that implements the algoritm of the module.
 o moduleLoadResult
The result of the last try to load a class file by prepareToRun().
 o moduleType
 o network
 o outConnectors
 o parameters
 o partOfModel
This boolean indicates if the Module has been added to the model of the Model-View-Controller triad of the program.
 o startModule

Constructor Index

 o Module(Network, String)

Method Index

 o checkOutput(DataStore)
Check if the Data objects in a DataStore have the types for the OutConnectors described in the module description file of this module.
 o clearData()
Remove the Data of all Connectors.
 o disconnect()
Disconnect all Connections to or from this Module.
 o displayError()
 o displayOutput()
Ask all OutConnectors to display their Data.
 o distributeOutput(DataStore)
Distribute the data in a specific DataStore over the OutConnectors of the module.
 o finalize()
 o getCodeClassFilename()
 o getDescriptiveString()
 o getInConnector(int)
 o getInConnectors()
Return the InConnectors of the Module.
 o getMDFileName()
 o getModuleDescription()
 o getName()
 o getNetwork()
 o getNrOfInConnectors()
 o getNrOfOutConnectors()
 o getNrOfParameters()
 o getOutConnector(int)
 o getOutConnectors()
Return the OutConnectors of the Module.
 o getParameter(int)
Get a single parameter from the parameter store.
 o getParameters()
Return the Parameters of the Module.
 o getType()
 o isEndModule()
 o isMarked()
 o isStartModule()
 o markIt()
 o prepareToRun()
This method creates an instance of the class with the code for the Module.
 o readMDFile(String)
Read the Module Description File from disk.
 o resultText(int)
 o run()
 o saveOutput()
Ask all OutConnectors to save their Data.
 o setEndModule(boolean)
 o setStartModule(boolean)
 o toString()
 o unMarkIt()

Variables

 o network
 private Network network
 o messagesDialog
 private MessagesDialog messagesDialog
 o moduleType
 private ModuleType moduleType
 o inConnectors
 private InConnectorStore inConnectors
 o outConnectors
 private OutConnectorStore outConnectors
 o parameters
 private ParameterStore parameters
 o startModule
 private boolean startModule
 o endModule
 private boolean endModule
 o moduleCode
 private Modulable moduleCode
An instance of the class that implements the algoritm of the module. This object is used when the method run() of this module is called. It is setup by method prepareToRun().

After use this reference should be set to null because the object cannot be garbage collected while there are still references to it. When all instances of a class are gone, the class itself can be reloaded if there is a new version of it.

See Also:
run, prepareToRun
 o moduleLoadResult
 private ClassLoadResult moduleLoadResult
The result of the last try to load a class file by prepareToRun(). It is set by prepareToRun() and used by displayError().

See Also:
prepareToRun, displayError
 o marked
 private boolean marked
A module can be marked for several reasons. Examples of this are: When the runpath of the network is determined to indicate what modules are in the runpath or when the network is checked for loops.

 o partOfModel
 boolean partOfModel
This boolean indicates if the Module has been added to the model of the Model-View-Controller triad of the program. If it has been added, the Views must be notified if something in the Module changes. If it has not been added, the Views must not be notified because the Views should only get events on objects that are part of the model. This boolean serves as a temporary fix to make it possible to load Networks. When storing view-specific information in the model is implemented, this can change and this variable can be removed. The NetworkObservable uses this boolean to suppress any notifications of the Views for Modules (or its Connectors) which are not part of a model. This boolean is set by the makeModule() and addModule() methods of class Network.

Constructors

 o Module
 Module(Network network,
        String MDFileName)

Methods

 o getMDFileName
 String getMDFileName()
 o getName
 String getName()
 o getModuleDescription
 String getModuleDescription()
 o getCodeClassFilename
 String getCodeClassFilename()
 o getInConnector
 InConnector getInConnector(int conNr)
 o getOutConnector
 OutConnector getOutConnector(int conNr)
 o getNetwork
 public Network getNetwork()
 o getNrOfInConnectors
 int getNrOfInConnectors()
 o getNrOfOutConnectors
 int getNrOfOutConnectors()
 o setStartModule
 void setStartModule(boolean status)
 o setEndModule
 void setEndModule(boolean status)
 o isStartModule
 boolean isStartModule()
 o isEndModule
 boolean isEndModule()
 o markIt
 public void markIt()
 o unMarkIt
 public void unMarkIt()
 o isMarked
 public boolean isMarked()
 o getParameter
 Parameter getParameter(int parameterNr)
Get a single parameter from the parameter store.

Parameters:
parameterNr - The number of the parameter that is requested.
 o getNrOfParameters
 int getNrOfParameters()
 o readMDFile
 boolean readMDFile(String MDFileName)
Read the Module Description File from disk. The module description file is read from disk and stored in the interal representation.

 o toString
 public String toString()
Overrides:
toString in class Object
 o prepareToRun
 public boolean prepareToRun()
This method creates an instance of the class with the code for the Module. References to this instance should be set to null after use because the instance and its class cannot be garbage collected otherwise.

 o run
 public void run()
 o finalize
 public void finalize() throws Throwable
Throws: Throwable
never.
Overrides:
finalize in class Object
 o displayError
 public void displayError()
 o getInConnectors
 public InConnectorStore getInConnectors()
Return the InConnectors of the Module.

See Also:
InConnectorStore
 o getOutConnectors
 public OutConnectorStore getOutConnectors()
Return the OutConnectors of the Module.

See Also:
OutConnectorStore
 o getParameters
 public ParameterStore getParameters()
Return the Parameters of the Module.

See Also:
ParameterStore
 o checkOutput
 private boolean checkOutput(DataStore output)
Check if the Data objects in a DataStore have the types for the OutConnectors described in the module description file of this module.

Parameters:
output - the DataStore containing the data to be checked.
Returns:
true if the data can be accepted as correct output of this module, false otherwise.
 o distributeOutput
 private void distributeOutput(DataStore output)
Distribute the data in a specific DataStore over the OutConnectors of the module.

Parameters:
output - the DataStore containing the data to be distributed.
 o clearData
 void clearData()
Remove the Data of all Connectors.

 o saveOutput
 private void saveOutput()
Ask all OutConnectors to save their Data. They will do this if necessary.

 o displayOutput
 private DataVisualisationStore displayOutput()
Ask all OutConnectors to display their Data. They will do this if necessary.

 o resultText
 String resultText(int result)
 o getType
 ModuleType getType()
Returns:
a reference to the ModuleType representing the type of this Module.
 o disconnect
 void disconnect()
Disconnect all Connections to or from this Module.

 o getDescriptiveString
 public String getDescriptiveString()
Returns:
a String that describes the Module in such a way that it can be used in load and save network.
See Also:
loadNetwork, saveNetwork