MATSIM
ImaginaryNode.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * ImaginaryNode.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2013 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;
22 
23 import java.util.Collection;
24 import java.util.Map;
25 
26 import org.matsim.api.core.v01.Coord;
27 import org.matsim.api.core.v01.Id;
31 
39 public class ImaginaryNode implements Node {
40 
41  /*package*/ final Collection<? extends InitialNode> initialNodes;
42  /*package*/ final Coord coord;
43 
44  ImaginaryNode(Collection<? extends InitialNode> initialNodes, Coord coord) {
45  this.initialNodes = initialNodes;
46  this.coord = coord;
47  }
48 
49  ImaginaryNode(Collection<? extends InitialNode> initialNodes) {
50  this.initialNodes = initialNodes;
51 
52  double sumX = 0.0;
53  double sumY = 0.0;
54 
55  for (InitialNode initialNode : initialNodes) {
56  sumX += initialNode.node.getCoord().getX();
57  sumY += initialNode.node.getCoord().getY();
58  }
59 
60  sumX /= initialNodes.size();
61  sumY /= initialNodes.size();
62 
63  this.coord = new Coord(sumX, sumY);
64  }
65 
66  @Override
67  public Coord getCoord() {
68  return this.coord;
69  }
70 
71  @Override
72  public Id<Node> getId() {
73  return null;
74  }
75 
76  @Override
77  public boolean addInLink(Link link) {
78  return false;
79  }
80 
81  @Override
82  public boolean addOutLink(Link link) {
83  return false;
84  }
85 
86  @Override
87  public Map<Id<Link>, ? extends Link> getInLinks() {
88  return null;
89  }
90 
91  @Override
92  public Map<Id<Link>, ? extends Link> getOutLinks() {
93  return null;
94  }
95 
96  @Override
97  public Link removeInLink(Id<Link> linkId) {
98  throw new RuntimeException("not implemented") ;
99  }
100 
101  @Override
102  public Link removeOutLink(Id<Link> outLinkId) {
103  throw new RuntimeException("not implemented") ;
104  }
105 
106  @Override
107  public void setCoord(Coord coord) {
108  throw new RuntimeException("not implemented") ;
109  }
110 
111  @Override
113  throw new UnsupportedOperationException();
114  }
115 }
Link removeInLink(Id< Link > linkId)
Link removeOutLink(Id< Link > outLinkId)
Map< Id< Link >, ? extends Link > getInLinks()
Map< Id< Link >, ? extends Link > getOutLinks()