MATSIM
AbstractRoutingNetworkNode.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * AbstractRoutingNetworkNode.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.Map;
24 
25 import org.matsim.api.core.v01.Coord;
26 import org.matsim.api.core.v01.Id;
31 
32 public abstract class AbstractRoutingNetworkNode implements RoutingNetworkNode {
33 
34  private final Node node;
35  private final RoutingNetworkLink[] outLinks;
36 
38 
39  /*
40  * We could get the number of out-links from the node. However,
41  * if some of those links should not be part of the routing network
42  * this would fail.
43  */
44  /*package*/ AbstractRoutingNetworkNode(Node node, int numOutLinks) {
45  this.node = node;
46  this.outLinks = new RoutingNetworkLink[numOutLinks];
47  }
48 
49  @Override
50  public Node getNode() {
51  return node;
52  }
53 
54  @Override
55  public void setOutLinksArray(RoutingNetworkLink[] outLinks) {
56  System.arraycopy(outLinks, 0, this.outLinks, 0, outLinks.length);
57  }
58 
59  @Override
61  return this.outLinks;
62  }
63 
64  @Override
65  public void setDeadEndData(DeadEndData deadEndData) {
66  this.deadEndData = deadEndData;
67  }
68 
69  @Override
71  return this.deadEndData;
72  }
73 
74  @Override
75  public Id<Node> getId() {
76  return node.getId();
77  }
78 
79  @Override
80  public Coord getCoord() {
81  return node.getCoord();
82  }
83 
84  @Override
85  public boolean addInLink(Link link) {
86  throw new RuntimeException("Not supported operation!");
87  }
88 
89  @Override
90  public boolean addOutLink(Link link) {
91  throw new RuntimeException("Not supported operation!");
92  }
93 
94  @Override
95  public Map<Id<Link>, ? extends Link> getInLinks() {
96  throw new RuntimeException("Not supported operation!");
97  }
98 
99 
100  @Override
101  public Map<Id<Link>, ? extends Link> getOutLinks() {
102  throw new RuntimeException("Not supported operation!");
103  }
104 
105  @Override
107  return node.getAttributes();
108  }
109 }