Checkstyle

This commit is contained in:
Arne Keller 2020-02-19 18:47:00 +01:00
parent 33138162fb
commit 5b9f9b8da7

View File

@ -477,9 +477,9 @@ public class ModelRailwaySimulation {
});
// check for block collisions
trains.values().stream().filter(train -> train.isPlaced()
&& collisions.stream().noneMatch((x) -> x.contains(train))).forEach(train -> {
&& collisions.stream().noneMatch(x -> x.contains(train))).forEach(train -> {
Set<Rail> occupiedByThisTrain = nextOccupiedRails.get(train);
trains.values().stream().filter((x) -> x != train).forEach((otherTrain) -> {
trains.values().stream().filter(x -> x != train).forEach(otherTrain -> {
Set<Rail> occupiedByOtherTrainPreviously = occupiedRails.get(otherTrain);
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
@ -551,11 +551,11 @@ public class ModelRailwaySimulation {
}
// check for block collisions
for (Train train : trains.values()) {
if (!train.isPlaced() || collisions.stream().anyMatch((x) -> x.contains(train))) {
if (!train.isPlaced() || collisions.stream().anyMatch(x -> x.contains(train))) {
continue; // already included in collision
}
Set<Rail> occupiedByThisTrain = nextOccupiedRails.get(train);
trains.values().stream().filter((x) -> x != train).forEach((otherTrain) -> {
trains.values().stream().filter(x -> x != train).forEach(otherTrain -> {
Set<Rail> occupiedByOtherTrainPreviously = occupiedRails.get(otherTrain);
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
@ -622,7 +622,7 @@ public class ModelRailwaySimulation {
.collect(Collectors.toList());
Terminal.printLine("Crash of train " + String.join(",",
collision.stream().map(
(x) -> Integer.toString(x.getIdentifier())).toArray(String[]::new)));
x -> Integer.toString(x.getIdentifier())).toArray(String[]::new)));
}
continue train;
}