mirror of
https://gitlab.com/arnekeller/kit-programmieren-ws1920-final1.git
synced 2024-11-24 09:24:58 +00:00
Checkstyle
This commit is contained in:
parent
33138162fb
commit
5b9f9b8da7
@ -477,9 +477,9 @@ public class ModelRailwaySimulation {
|
|||||||
});
|
});
|
||||||
// check for block collisions
|
// check for block collisions
|
||||||
trains.values().stream().filter(train -> train.isPlaced()
|
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);
|
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> occupiedByOtherTrainPreviously = occupiedRails.get(otherTrain);
|
||||||
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
|
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
|
||||||
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
|
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
|
||||||
@ -551,11 +551,11 @@ public class ModelRailwaySimulation {
|
|||||||
}
|
}
|
||||||
// check for block collisions
|
// check for block collisions
|
||||||
for (Train train : trains.values()) {
|
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
|
continue; // already included in collision
|
||||||
}
|
}
|
||||||
Set<Rail> occupiedByThisTrain = nextOccupiedRails.get(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> occupiedByOtherTrainPreviously = occupiedRails.get(otherTrain);
|
||||||
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
|
Set<Rail> occupiedByOtherTrain = nextOccupiedRails.get(otherTrain);
|
||||||
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
|
if (occupiedByOtherTrain == null || occupiedByOtherTrainPreviously == null) {
|
||||||
@ -622,7 +622,7 @@ public class ModelRailwaySimulation {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Terminal.printLine("Crash of train " + String.join(",",
|
Terminal.printLine("Crash of train " + String.join(",",
|
||||||
collision.stream().map(
|
collision.stream().map(
|
||||||
(x) -> Integer.toString(x.getIdentifier())).toArray(String[]::new)));
|
x -> Integer.toString(x.getIdentifier())).toArray(String[]::new)));
|
||||||
}
|
}
|
||||||
continue train;
|
continue train;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user