MCPcopy Create free account
hub / github.com/Neop/mudmap2 / updatePlaceNameCache

Method updatePlaceNameCache

src/main/java/mudmap2/backend/Layer.java:387–406  ·  view source on GitHub ↗

Recreates place name chache

()

Source from the content-addressed store, hash-verified

385 * Recreates place name chache
386 */
387 private void updatePlaceNameCache() {
388 if(placeNameCacheNeedsUpdate) {
389 placeNameCache.clear();
390
391 for(LayerElement element: getPlaces()) {
392 if(element instanceof Place) {
393 Place place = (Place) element;
394 Integer value = placeNameCache.get(place.getName());
395 if(value == null) {
396 value = 1;
397 } else {
398 value += 1;
399 }
400 placeNameCache.put(place.getName(), value);
401 }
402 }
403
404 placeNameCacheNeedsUpdate = false;
405 }
406 }
407
408 private void updateSizeCache(){
409 if(sizeCacheNeedsUpdated){

Callers 1

isPlaceNameUniqueMethod · 0.95

Calls 4

getPlacesMethod · 0.95
getNameMethod · 0.95
putMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected