public abstract class JSONFlagDiffSubCommand
extends java.lang.Object
implements org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommand
| Modifier and Type | Class and Description |
|---|---|
protected static class |
JSONFlagDiffSubCommand.DiffReturn
Expected returns from
getDiff(HashMap, HashMap, DiffReturn). |
protected class |
JSONFlagDiffSubCommand.JSONFlagDiff
Helper class for storing diff results.
|
| Constructor and Description |
|---|
JSONFlagDiffSubCommand(java.lang.String name,
java.lang.String description,
java.lang.String fileExtension) |
| Modifier and Type | Method and Description |
|---|---|
int |
execute(org.openstreetmap.atlas.utilities.runtime.CommandMap command) |
java.lang.String |
getDescription() |
protected JSONFlagDiffSubCommand.JSONFlagDiff |
getDiff(java.util.HashMap source,
java.util.HashMap target,
JSONFlagDiffSubCommand.DiffReturn returnType)
Takes two
HashMaps containing atlas-checks flags mapped by id. |
protected com.google.gson.Gson |
getGson()
Getter for
gson |
java.lang.String |
getName() |
protected java.util.HashMap |
getSource()
Getter for
source |
protected int |
getSourceSize()
A getter for the number of flags in
source |
protected java.util.HashMap |
getTarget()
Getter for
target |
protected boolean |
identicalFeatureIds(com.google.gson.JsonArray sourceArray,
com.google.gson.JsonArray targetArray)
Helper function for
getMissingAndChanged to check for changes in Atlas ids. |
protected void |
mapFeatures(org.openstreetmap.atlas.streaming.resource.File file,
java.util.HashMap map)
Parses an atlas-checks flag file and maps each flag to its id.
|
org.openstreetmap.atlas.utilities.runtime.Command.SwitchList |
switches() |
void |
usage(java.io.PrintStream writer) |
protected void |
writeSetToGeoJSON(java.util.Set<com.google.gson.JsonObject> flags,
org.openstreetmap.atlas.streaming.resource.File output)
Writes a Set of geoJSON atlas-checks flags to a file.
|
public JSONFlagDiffSubCommand(java.lang.String name,
java.lang.String description,
java.lang.String fileExtension)
public java.lang.String getName()
getName in interface org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommandpublic java.lang.String getDescription()
getDescription in interface org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommandpublic org.openstreetmap.atlas.utilities.runtime.Command.SwitchList switches()
switches in interface org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommandpublic void usage(java.io.PrintStream writer)
usage in interface org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommandpublic int execute(org.openstreetmap.atlas.utilities.runtime.CommandMap command)
execute in interface org.openstreetmap.atlas.utilities.runtime.FlexibleSubCommandprotected void mapFeatures(org.openstreetmap.atlas.streaming.resource.File file,
java.util.HashMap map)
file - File containing the flagsmap - HashMap to store the mapped flagsprotected JSONFlagDiffSubCommand.JSONFlagDiff getDiff(java.util.HashMap source, java.util.HashMap target, JSONFlagDiffSubCommand.DiffReturn returnType)
HashMaps containing atlas-checks flags mapped by id. Finds missing elements
in the target based on keys. Optionally computes changes in the AtlasObject ids found in each
flag.source - HashMap of the flags to compare fromtarget - HashMap of the flags to compare toreturnType - JSONFlagDiffSubCommand.DiffReturn; If this is CHANGED the changed attribute of
the returned JSONFlagDiffSubCommand.JSONFlagDiff will be populated.JSONFlagDiffSubCommand.JSONFlagDiffprotected boolean identicalFeatureIds(com.google.gson.JsonArray sourceArray,
com.google.gson.JsonArray targetArray)
getMissingAndChanged to check for changes in Atlas ids.sourceArray - feature JsonArray to check fromtargetArray - feature JsonArray to check tosource are present in target, and visa versaprotected void writeSetToGeoJSON(java.util.Set<com.google.gson.JsonObject> flags,
org.openstreetmap.atlas.streaming.resource.File output)
flags - Set of JsonObjects representing geoJSON flagsoutput - File to output toprotected int getSourceSize()
sourceintprotected com.google.gson.Gson getGson()
gsonGsonprotected java.util.HashMap getSource()
sourceHashMapprotected java.util.HashMap getTarget()
targetHashMap