Class NetworkBuilder<T>
java.lang.Object
repast.simphony.context.space.graph.NetworkBuilder<T>
A builder used to build networks.
- Author:
- Nick Collier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionBuilds the network using all the previously set properties.load
(String fileName, NetworkFileFormat format, NodeCreator nodeCreator) Sets this NetworkBuilder to create the network from a file.load
(String fileName, NetworkFileFormat format, NodeCreator nodeCreator, int matrixIndex) Sets this NetworkBuilder to create the network from a file.setEdgeCreator
(EdgeCreator edgeCreator) Sets the class that will be used to create edges for the created network.setGenerator
(NetworkGenerator<T> generator) Sets a generator to use to create the network topology.
-
Constructor Details
-
NetworkBuilder
-
-
Method Details
-
setGenerator
Sets a generator to use to create the network topology.- Parameters:
generator
- the generator to use to create the network topology- Returns:
- this NetworkBuilder
-
setEdgeCreator
Sets the class that will be used to create edges for the created network.- Parameters:
edgeCreator
- the object to use to create edges for the created network- Returns:
- this NetworkBuilder
-
load
public NetworkBuilder load(String fileName, NetworkFileFormat format, NodeCreator nodeCreator) throws IOException Sets this NetworkBuilder to create the network from a file. This will use the first network found in the file.- Parameters:
fileName
- the name of the file to load fromformat
- the format of the filenodeCreator
- a node creator that will be used to create the agents / nodes- Returns:
- this NetworkBuilder
- Throws:
IOException
- if there is a file related error
-
load
public NetworkBuilder load(String fileName, NetworkFileFormat format, NodeCreator nodeCreator, int matrixIndex) throws IOException Sets this NetworkBuilder to create the network from a file. This will use the first network found in the file.- Parameters:
fileName
- the name of the file to load fromformat
- the format of the filenodeCreator
- a node creator that will be used to create the agents / nodesmatrixIndex
- the index of the matrix in the file to load. Starts with 0.- Returns:
- this NetworkBuilder
- Throws:
IOException
- if there is a file related error
-
buildNetwork
Builds the network using all the previously set properties.- Returns:
- a network built using all the previously set properties.
-