| 1 | package com.rox; | |
| 2 | ||
| 3 | import java.nio.file.Path; | |
| 4 | import java.util.List; | |
| 5 | import java.util.Locale; | |
| 6 | import java.util.Optional; | |
| 7 | ||
| 8 | /** Which ROM, if any, files dropped on the game window are. */ | |
| 9 | final class DroppedRom { | |
| 10 | private DroppedRom(){ | |
| 11 | } | |
| 12 | ||
| 13 | /** The one {@code .nes} file dropped - empty for anything else, several files included. */ | |
| 14 | static Optional<Path> of(final List<Path> dropped){ | |
| 15 |
1
1. of : negated conditional → KILLED |
if (dropped.size() != 1){ |
| 16 | return Optional.empty(); | |
| 17 | } | |
| 18 | final Path file = dropped.get(0); | |
| 19 |
2
1. of : negated conditional → KILLED 2. of : negated conditional → KILLED |
return file.getFileName() != null && file.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".nes") |
| 20 | ? Optional.of(file) | |
| 21 | : Optional.empty(); | |
| 22 | } | |
| 23 | } | |
Mutations | ||
| 15 |
1.1 |
|
| 19 |
1.1 2.2 |