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

Method checkCache

movement/MapBasedMovement.java:381–397  ·  view source on GitHub ↗

Checks map cache if the requested map file(s) match to the cached sim map @param settings The Settings where map file names are found @return A cached map or null if the cached map didn't match

(Settings settings)

Source from the content-addressed store, hash-verified

379 * @return A cached map or null if the cached map didn't match
380 */
381 private SimMap checkCache(Settings settings) {
382 int nrofMapFiles = settings.getInt(NROF_FILES_S);
383
384 if (nrofMapFiles != cachedMapFiles.size() || cachedMap == null) {
385 return null; // wrong number of files
386 }
387
388 for (int i = 1; i <= nrofMapFiles; i++ ) {
389 String pathFile = settings.getSetting(FILE_S + i);
390 if (!pathFile.equals(cachedMapFiles.get(i-1))) {
391 return null; // found wrong file name
392 }
393 }
394
395 // all files matched -> return cached map
396 return cachedMap;
397 }
398
399 @Override
400 public MapBasedMovement replicate() {

Callers 1

readMapMethod · 0.95

Calls 4

getSettingMethod · 0.80
getIntMethod · 0.45
equalsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected