Commands: Override getParticipatingPrimitives for better error reports

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head
Taylor Smock 2022-03-01 16:25:22 -07:00
rodzic b5f6eae7f3
commit 2b9c88040c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
6 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -161,6 +161,12 @@ public abstract class AbstractConflationCommand extends Command {
}
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
// This is used for debugging. Default to anything that might be affected.
return Collections.unmodifiableCollection(this.possiblyAffectedPrimitives);
}
/**
* Use this to ensure that something that cannot be undone without errors isn't
* undone.

Wyświetl plik

@ -94,6 +94,11 @@ public class AddNodeToWayCommand extends Command {
modified.addAll(Arrays.asList(getToAddNode(), getWay()));
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
return changeCommand.getParticipatingPrimitives();
}
/**
* Get the node that will be added to a way
*

Wyświetl plik

@ -141,6 +141,11 @@ public class CreateConnectionsCommand extends Command {
command.fillModifiedData(modified, deleted, added);
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
return command.getParticipatingPrimitives();
}
/**
* Add third-party commands that are run when conflating data.
*

Wyświetl plik

@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.concurrent.locks.Lock;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.openstreetmap.josm.command.Command;
import org.openstreetmap.josm.command.SequenceCommand;
@ -152,6 +153,12 @@ public class MapWithAIAddCommand extends Command implements Runnable {
modified.addAll(primitives);
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
return Stream.of(command.getParticipatingPrimitives(), primitives).flatMap(Collection::stream)
.collect(Collectors.toSet());
}
/**
* Calculate the number of objects added in this command that are not deleted
* (may not count significantly modified objects as well).

Wyświetl plik

@ -371,4 +371,10 @@ public class MergeDuplicateWays extends Command {
currentCommand.fillModifiedData(modified, deleted, added);
}
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
return commands.stream().flatMap(currentCommand -> currentCommand.getParticipatingPrimitives().stream())
.collect(Collectors.toSet());
}
}

Wyświetl plik

@ -178,4 +178,9 @@ public class MovePrimitiveDataSetCommand extends Command {
Collection<OsmPrimitive> added) {
command.fillModifiedData(modified, deleted, added);
}
@Override
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
return command.getParticipatingPrimitives();
}
}