MATSIM
AbstractRoutingNetwork.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * AbstractRoutingNetwork.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2012 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.core.router.util;
22 
23 import java.util.LinkedHashMap;
24 import java.util.Map;
25 
26 import org.matsim.api.core.v01.Id;
32 
33 public abstract class AbstractRoutingNetwork implements RoutingNetwork {
34 
35  /*package*/ final Map<Id<Node>, RoutingNetworkNode> nodes = new LinkedHashMap<>(); // needs to be a LinkedHashMap since the order is relevant for the router-preprocessing!
36  /*package*/ final Network network;
37 
38  public AbstractRoutingNetwork(Network network) {
39  this.network = network;
40  }
41 
42  @Override
43  public void initialize() {
44  // Some classes might override this method and do some additional stuff...
45  }
46 
47  @Override
49  return network.getFactory();
50  }
51 
52  @Override
53  public Map<Id<Node>, RoutingNetworkNode> getNodes() {
54  return nodes;
55  }
56 
57  public void addNode(RoutingNetworkNode nn) {
58  this.nodes.put(nn.getId(), nn);
59  }
60 
61  @Override
63  return nodes.remove(nodeId);
64  }
65 
66  @Override
67  public void addLink(Link ll) {
68  throw new RuntimeException("Not supported operation!");
69  }
70 
71  @Override
72  public void addNode(Node nn) {
73  throw new RuntimeException("Not supported operation!");
74  }
75 
76  @Override
77  public double getCapacityPeriod() {
78  throw new RuntimeException("Not supported operation!");
79  }
80 
81  @Override
82  public double getEffectiveLaneWidth() {
83  throw new RuntimeException("Not supported operation!");
84  }
85 
86  @Override
87  public Map<Id<Link>, ? extends Link> getLinks() {
88  throw new RuntimeException("Not supported operation!");
89  }
90 
91  @Override
92  public Link removeLink(Id<Link> linkId) {
93  throw new RuntimeException("Not supported operation!");
94  }
95  @Override
96  public void setCapacityPeriod(double capPeriod) {
97  throw new RuntimeException("not implemented") ;
98  }
99 
100  @Override
101  public void setEffectiveCellSize(double effectiveCellSize) {
102  throw new RuntimeException("not implemented") ;
103  }
104 
105  @Override
106  public void setEffectiveLaneWidth(double effectiveLaneWidth) {
107  throw new RuntimeException("not implemented") ;
108  }
109  @Override
110  public double getEffectiveCellSize() {
111  throw new RuntimeException("not implemented") ;
112  }
113 
114  @Override
116  return this.network.getAttributes();
117  }
118 }
Map< Id< Node >, RoutingNetworkNode > getNodes()