MCPcopy Create free account
hub / github.com/akeranen/the-one / createOrUpdateNode

Method createOrUpdateNode

input/WKTMapReader.java:135–157  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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}

Callers 1

updateMapMethod · 0.95

Calls 4

addNeighborMethod · 0.95
addTypeMethod · 0.95
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected