Creates or updates a node that is in location c and next to node previous @param c The location coordinates of the node @param previous Previous node whose neighbor node at c is @return The created/updated node
(Coord c, MapNode previous)
| 133 | * @return The created/updated node |
| 134 | */ |
| 135 | private MapNode createOrUpdateNode(Coord c, MapNode previous) { |
| 136 | MapNode n = null; |
| 137 | |
| 138 | n = nodes.get(c); // try to get the node at that location |
| 139 | |
| 140 | if (n == null) { // no node in that location -> create new |
| 141 | n = new MapNode(c); |
| 142 | nodes.put(c, n); |
| 143 | } |
| 144 | |
| 145 | if (previous != null) { |
| 146 | n.addNeighbor(previous); |
| 147 | if (bidirectionalPaths) { |
| 148 | previous.addNeighbor(n); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | if (nodeType != -1) { |
| 153 | n.addType(nodeType); |
| 154 | } |
| 155 | |
| 156 | return n; |
| 157 | } |
| 158 | |
| 159 | } |
no test coverage detected