Class NetworkBuilder<T>
- java.lang.Object
-
- repast.simphony.context.space.graph.NetworkBuilder<T>
-
public class NetworkBuilder<T> extends Object
A builder used to build networks.- Author:
- Nick Collier
-
-
Constructor Summary
Constructors Constructor Description NetworkBuilder(String networkName, Context<T> context, boolean isDirected)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Network<T>
buildNetwork()
Builds the network using all the previously set properties.NetworkBuilder
load(String fileName, NetworkFileFormat format, NodeCreator nodeCreator)
Sets this NetworkBuilder to create the network from a file.NetworkBuilder
load(String fileName, NetworkFileFormat format, NodeCreator nodeCreator, int matrixIndex)
Sets this NetworkBuilder to create the network from a file.NetworkBuilder
setEdgeCreator(EdgeCreator edgeCreator)
Sets the class that will be used to create edges for the created network.NetworkBuilder
setGenerator(NetworkGenerator<T> generator)
Sets a generator to use to create the network topology.
-
-
-
Method Detail
-
setGenerator
public NetworkBuilder setGenerator(NetworkGenerator<T> generator)
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
public NetworkBuilder setEdgeCreator(EdgeCreator edgeCreator)
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
-
-