コード例 #1
0
  // ----------------------------------------------------------------------------------------
  public void handleNetwork(String source, Network newNetwork) {
    System.out.println(
        "network ready, node count "
            + newNetwork.getNodes().length
            + ", edges: "
            + newNetwork.edgeCount());

    network = newNetwork;
    defaultSpecies = newNetwork.getSpecies();
  }
コード例 #2
0
  @Before
  public void setup() {
    nw = new Network();
    nw.setName("test network");

    dp = new DensityMap();

    nw.setNodes(new ArrayList<edu.berkeley.path.model_elements_base.Node>());
    nw.setLinks(new ArrayList<edu.berkeley.path.model_elements_base.Link>());

    Node nd1;
    Node nd2;
    Link ln;

    nd1 = new Node();
    nd1.setId(1L);
    nd1.setName("one");
    nd1.setType("Highway");
    nw.getNodes().add(nd1);

    nd2 = new Node();
    nd2.setId(2L);
    nd2.setName("two");
    nd2.setType("Highway");
    nw.getNodes().add(nd2);

    ln = new Link();
    ln.setId(3L);
    ln.setName("three");
    ln.setType("Highway");
    ln.setLaneCount(4.0);
    ln.setLength(1000.0);

    ln.setBegin(nd1);
    ln.setEnd(nd2);

    nw.getLinks().add(ln);
  }