planet.commonapi.factory
Interface NetworkFactory

All Known Implementing Classes:
NetworkFactoryImpl

public interface NetworkFactory

This interface is focused to allow the ability of build networks of different topologies, size and Nodes. The future implementation must read the properties file to known the default values of the future networks. In that are four values:

Author:
Jordi Pujol
See Also:
Topology, NodeFactory, Network, Id

Method Summary
 Network buildNetwork()
          Generates a new Network with the actual size of the Network.
 Network buildNetwork(int size)
          Generates a new Network with the size of Nodes specified by parameter.
 Network buildNetwork(int size, NodeFactory nodeFactory)
          Generates a new Network with the size of Nodes specified by parameter.
 Network buildNetwork(int size, NodeFactory nodeFactory, java.lang.String topology)
          Generates a new Network with the size of Nodes specified by parameter.
 Network buildNetwork(int size, NodeFactory nodeFactory, java.lang.String topology, int k)
          Generates a new Network with the size of Nodes specified by parameter.
 Network buildNetwork(int size, java.lang.String topology)
          Generates a new Network with the size of Nodes specified by parameter.
 int getNetworkSize()
          Returns the actual size of the new Networks.
 NodeFactory getNodeFactory()
          Returns the actual NodeFactory to use to generate networks.
 java.lang.String getSerializedFile()
          Gets the actual file from where capture a serialized state of a network.
 java.lang.String getTopology()
          Gets the actual network's topology of the generated networks.
 void setNetworkSize(int size)
          Sets the size of new networks.
 void setNodeFactory(NodeFactory nodeFactory)
          Sets the NodeFactory to use in the future to generate new networks.
 void setSerializedFile(java.lang.String file)
          Sets the filename from where capture a serialized state of a network.
 void setTopology(java.lang.String topology)
          Sets the topology of the new generated networks.
 

Method Detail

buildNetwork

public Network buildNetwork()
                     throws InitializationException
Generates a new Network with the actual size of the Network. The class of Nodes is specified by the actual NodeFactory.

Returns:
A new instance of Network with the number of nodes specified.
Throws:
InitializationException

buildNetwork

public Network buildNetwork(int size)
                     throws InitializationException
Generates a new Network with the size of Nodes specified by parameter. The class of Nodes is specified by the actual NodeFactory.

Parameters:
size - Number of Nodes to generate in the network.
Returns:
A new instance of Network with the specified size.
Throws:
InitializationException

buildNetwork

public Network buildNetwork(int size,
                            NodeFactory nodeFactory)
                     throws InitializationException
Generates a new Network with the size of Nodes specified by parameter. The class of Nodes is specified by nodeFactory.

Parameters:
size - Number of Nodes to generate in the network.
nodeFactory - NodeFactory to use to build Nodes for the new network.
Returns:
A new instance of Network with the specified size.
Throws:
InitializationException

buildNetwork

public Network buildNetwork(int size,
                            java.lang.String topology)
                     throws InitializationException
Generates a new Network with the size of Nodes specified by parameter. The class of Nodes is the obtained by the default nodeFactory. The topology specifies the network topology for the new network.

Parameters:
size - Number of Nodes to generate in the network.
topology - The network topology for the new network.
Returns:
A new instance of Network with the specified size with the specified topology.
Throws:
InitializationException

buildNetwork

public Network buildNetwork(int size,
                            NodeFactory nodeFactory,
                            java.lang.String topology)
                     throws InitializationException
Generates a new Network with the size of Nodes specified by parameter. The class of Nodes is specified by nodeFactory. The topology specifies the network topology for the new network.

Parameters:
size - Number of Nodes to generate in the network.
nodeFactory - NodeFactory to use to build Nodes for the new network.
topology - The network topology for the new network.
Returns:
A new instance of Network with the specified size with the specified topology.
Throws:
InitializationException

buildNetwork

public Network buildNetwork(int size,
                            NodeFactory nodeFactory,
                            java.lang.String topology,
                            int k)
                     throws InitializationException
Generates a new Network with the size of Nodes specified by parameter. The class of Nodes is specified by nodeFactory. The topology specifies the network topology for the new network.

Parameters:
size - Number of Nodes to generate in the network.
nodeFactory - NodeFactory to use to build Nodes for the new network.
topology - The network topology for the new network.
k - The number of bits for the NodeImpl's Ids.
Returns:
A new instance of Network with the specified size with the specified topology.
Throws:
InitializationException
See Also:
Id

getNodeFactory

public NodeFactory getNodeFactory()
Returns the actual NodeFactory to use to generate networks.

Returns:
The actual NodeFactory to generate networks.

setNodeFactory

public void setNodeFactory(NodeFactory nodeFactory)
Sets the NodeFactory to use in the future to generate new networks.

Parameters:
nodeFactory - NodeFactory's instance to generate new networks.
See Also:
NodeFactory, Network

getNetworkSize

public int getNetworkSize()
Returns the actual size of the new Networks.

Returns:
Size of new Networks.
See Also:
Network

setNetworkSize

public void setNetworkSize(int size)
Sets the size of new networks.

Parameters:
size - Size of new networks.

getTopology

public java.lang.String getTopology()
Gets the actual network's topology of the generated networks.

Returns:
Topology of the new networks.

setTopology

public void setTopology(java.lang.String topology)
                 throws InitializationException
Sets the topology of the new generated networks.

Parameters:
topology - Topology of the new networks.
Throws:
InitializationException - if the topology is not suported.

getSerializedFile

public java.lang.String getSerializedFile()
Gets the actual file from where capture a serialized state of a network.

Returns:
The filename for the serialized state.

setSerializedFile

public void setSerializedFile(java.lang.String file)
                       throws InitializationException
Sets the filename from where capture a serialized state of a network.

Parameters:
file - Filename from read a serialized state of a network.
Throws:
InitializationException - if occur some problem with the filename.