Class Network
java.lang.Object
|
+----Network
- class Network
- extends Object
- implements StoreElement
A class describing a network.
- Version:
- $Revision: 1.74 $
-
basenames
- The selection of basenames for this network.
-
connections
-
-
currentBasename
- A reference to the basename for which the network is currently being
executed.
-
maxInConnector
-
-
maxOutConnector
-
-
maxParameter
-
-
moduleStore
-
-
moduleTypeList
-
-
name
-
-
nrOfModuleTypes
-
-
observable
-
-
runPath
- The run path.
-
state
- The state the Network currently is in.
-
Network(int, int)
-
-
addConnection(InConnector, OutConnector)
- Add a new Connection to the Network.
-
addModule(Module)
- Adds an existing Module to the Network.
-
addModule(Module, InfoHandler)
- Adds an existing Module to the Network with view-specific information.
-
addModule(String)
- Adds a module to the Network.
-
addModuleType(ModuleType)
-
-
checkOutConnectors(ModuleStore)
- Check if all OutConnectors of the Modules in a specified ModuleStore
can write their Data to a file, that is, check if the method
fileAvailable() of the OutConnectors returns
true
for all
OutConnectors.
-
clearNetwork()
-
-
determineRunPath()
- Determine the run path of the current network.
-
disconnect(Connection)
- Remove a Connection from the Network's list of Connections.
-
findModuleType(String)
-
-
getBasenames()
-
-
getConnection(int)
-
-
getConnections()
-
-
getCurrentBasename()
-
-
getEndModule(int)
-
-
getMaxInConnector()
-
-
getMaxOutConnector()
-
-
getMaxParameter()
-
-
getModule(int)
-
-
getModules()
-
-
getName()
-
-
getNrOfConnections()
-
-
getNrOfModules()
-
-
getObservable()
-
-
getStartModule(int)
-
-
getState()
- Get the current state of the Network.
-
loadNetwork(String)
- Load the network from disk.
-
makeModule(String)
- Creates a new instance of Module.
-
preserveBackSlash(String)
- StreamTokenizer does not correctly handle the backslash, it wants to
have 2 backslashes.
-
printItems()
-
-
readNetworkConnectionLine(String, String)
- Read a connection line from the network file.
-
readNetworkModuleLine(String, String)
- Read a module line from the network file.
-
removeConnection(Connection)
-
-
removeModule(Module)
- Remove a Module from the Network.
-
run()
-
-
runSingleBasename()
-
-
saveNetwork(String)
- Save the network to disk.
-
setBasenames(FileStore)
-
-
setEndModule(int, boolean)
-
-
setName(String)
-
-
setStartModule(int, boolean)
-
-
setState(NetworkState)
- Set the new state of the Network.
maxInConnector
private int maxInConnector
maxOutConnector
private int maxOutConnector
maxParameter
private int maxParameter
name
private String name
observable
private NetworkObservable observable
moduleStore
private ModuleStore moduleStore
moduleTypeList
private ModuleType moduleTypeList[]
connections
private ConnectionStore connections
nrOfModuleTypes
private int nrOfModuleTypes
basenames
private FileStore basenames
- The selection of basenames for this network.
state
private NetworkState state
- The state the Network currently is in. This can be either Idle or
Running. The state is set by the Network itself and can be queried by
others.
- See Also:
- getState
currentBasename
private String currentBasename
- A reference to the basename for which the network is currently being
executed.
runPath
private ModuleStore runPath
- The run path. Only valid while the Network is in Running state.
Network
public Network(int maxModules,
int maxConnections)
getCurrentBasename
String getCurrentBasename()
getName
String getName()
setName
private void setName(String name)
getMaxInConnector
int getMaxInConnector()
getMaxOutConnector
int getMaxOutConnector()
getMaxParameter
int getMaxParameter()
setStartModule
void setStartModule(int moduleNr,
boolean set)
setEndModule
void setEndModule(int moduleNr,
boolean set)
getStartModule
boolean getStartModule(int moduleNr)
getEndModule
boolean getEndModule(int moduleNr)
getModule
Module getModule(int moduleNr)
getModules
ModuleStore getModules()
getNrOfModules
int getNrOfModules()
getConnection
Connection getConnection(int connectionNr)
getNrOfConnections
int getNrOfConnections()
getConnections
ConnectionStore getConnections()
removeModule
void removeModule(Module m)
- Remove a Module from the Network.
removeConnection
void removeConnection(Connection c)
disconnect
void disconnect(Connection c)
- Remove a Connection from the Network's list of Connections. This is
called by a Connection when it disconnects itself from Modules.
clearNetwork
public void clearNetwork()
printItems
public void printItems()
saveNetwork
public void saveNetwork(String fileName)
- Save the network to disk. Save al modules (doubles are allowed), save
all connections. Connections are between in connectors and out
connectors.
loadNetwork
public void loadNetwork(String fileName)
- Load the network from disk. The network file contains all modules in
the network (doubles are allowed), the start and end modules and the
connections between the connectors of the modules.
readNetworkModuleLine
private boolean readNetworkModuleLine(String moduleString,
String fileName)
- Read a module line from the network file. A module line contains the
module description file, whether it is a start/end module and parameters
of the modules (if not default).
When a faulty module line is detected or the module can not be loaded
then the rest of the network will not be loaded, when there is a problem
with loading the parameters the parameters of that module are skipped.
preserveBackSlash
public String preserveBackSlash(String str)
- StreamTokenizer does not correctly handle the backslash, it wants to
have 2 backslashes. Unfortunately the StreamReader already deleted 1
of the 2 backslashes. This method adds a backslash every time a bs is
found.
readNetworkConnectionLine
private boolean readNetworkConnectionLine(String connectionString,
String fileName)
- Read a connection line from the network file. A connection line is
constructed of a description of the connection: it holds a from module
and a to module and for both modules the connector number that is
connected. Note: when a non parsable connection line or an invalid
connection is detected it is (simply) skipped.
findModuleType
ModuleType findModuleType(String MDFileName)
addModuleType
void addModuleType(ModuleType newModuleType)
run
void run()
runSingleBasename
private void runSingleBasename()
determineRunPath
ModuleStore determineRunPath()
- Determine the run path of the current network.
- Returns:
- a ModuleStore containing all Modules that are part of the
run path.
setBasenames
void setBasenames(FileStore basenames)
getBasenames
FileStore getBasenames()
makeModule
private Module makeModule(String MDFName)
- Creates a new instance of Module. Reads the specified Module
Description File and stores the results are stored in the new Module.
The new Module is not part of the model yet and the views will not be
notified if this Module changes until it becomes part of the model. A
Module can be added to the model using addModule(Module) or
addModule(Module, InfoHandler).
- Parameters:
- MDFName - the name of the Module Description File to read.
- See Also:
- addModule, addModule
addModule
Module addModule(String MDFName)
- Adds a module to the Network. A new Module is created using
makeModule(). The Module is added to the ModuleStore of the Network
and the views on the Network are updated using addModule(Module).
- Returns:
- a reference to the newly created Module or
null
if the Module could not be created. In the last case, error messages
will have been displayed by the methods in class Module.
- See Also:
- makeModule, addModule
addModule
private void addModule(Module m)
- Adds an existing Module to the Network. The Module is added to the
ModuleStore of the Network and the views on the Network are updated.
Afterwards, the Module is a part of the model and the views will be
notified if the Module changes.
- Parameters:
- m - the Module to add.
- See Also:
- addModule
addModule
private void addModule(Module m,
InfoHandler infoHandler)
- Adds an existing Module to the Network with view-specific information.
The Module is added to the ModuleStore of the Network and the views on
the Network are updated. The views will be notified with
view-specific information. Afterwards, the Module is a part of the
model and the views will be notified if the Module changes.
- Parameters:
- m - the Module to add.
- infoHandler - an InfoHandler object that contains the
view-specific information that is passed to the views.
- See Also:
- addModule, InfoHandler
addConnection
AddConnectionResult addConnection(InConnector inConnector,
OutConnector outConnector)
- Add a new Connection to the Network.
- Returns:
- an instance of class AddConnectionResult that
indicates if the function succeeded or the reason why
it failed.
getObservable
NetworkObservable getObservable()
setState
private void setState(NetworkState state)
- Set the new state of the Network.
getState
NetworkState getState()
- Get the current state of the Network.
checkOutConnectors
private boolean checkOutConnectors(ModuleStore s)
- Check if all OutConnectors of the Modules in a specified ModuleStore
can write their Data to a file, that is, check if the method
fileAvailable() of the OutConnectors returns
true
for all
OutConnectors.
- See Also:
- fileAvailable