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)
| 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() { |
no test coverage detected