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 Details

    • NetworkBuilder

      public NetworkBuilder(String networkName, Context<T> context, boolean isDirected)
  • Method Details

    • 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 from
      format - the format of the file
      nodeCreator - 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 from
      format - the format of the file
      nodeCreator - a node creator that will be used to create the agents / nodes
      matrixIndex - 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

      public Network<T> buildNetwork()
      Builds the network using all the previously set properties.
      Returns:
      a network built using all the previously set properties.