public class APIDataSet extends java.lang.Object
OsmPrimitive
s which should be uploaded to the API.
The collection is derived from the modified primitives of an DataSet
and it provides methods
for sorting the objects in upload order.Modifier and Type | Class and Description |
---|---|
private static class |
APIDataSet.RelationUploadDependencyGraph
Utility class to sort a collection of new relations with their dependencies
topologically.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<OsmPrimitive> |
toAdd |
private java.util.List<OsmPrimitive> |
toDelete |
private java.util.List<OsmPrimitive> |
toUpdate |
Constructor and Description |
---|
APIDataSet()
creates a new empty data set
|
APIDataSet(java.util.Collection<OsmPrimitive> primitives)
initializes the API data set with the primitives in
primitives |
APIDataSet(DataSet ds)
initializes the API data set with the modified primitives in
ds |
Modifier and Type | Method and Description |
---|---|
void |
adjustRelationUploadOrder()
Adjusts the upload order for new relations.
|
protected java.util.List<Relation> |
filterRelationsNotReferringToNewRelations(java.util.Collection<Relation> relations)
Replies the subset of relations in
relations which are not referring to any
new relation |
java.util.List<OsmPrimitive> |
getPrimitives()
Replies all primitives
|
java.util.List<OsmPrimitive> |
getPrimitivesToAdd()
Replies the primitives which should be added to the OSM database
|
java.util.List<OsmPrimitive> |
getPrimitivesToDelete()
Replies the primitives which should be deleted in the OSM database
|
java.util.List<OsmPrimitive> |
getPrimitivesToUpdate()
Replies the primitives which should be updated in the OSM database
|
int |
getSize()
Replies the number of objects to upload
|
void |
init(java.util.Collection<OsmPrimitive> primitives)
Initializes the API data set with the modified primitives, ignores unmodified primitives.
|
void |
init(DataSet ds)
initializes the API data set with the modified primitives in
ds |
boolean |
isEmpty()
Replies true if there are no primitives to upload
|
boolean |
participatesInConflict(ConflictCollection conflicts)
Replies true if one of the primitives to be updated or to be deleted
participates in at least one conflict in
conflicts |
void |
removeProcessed(java.util.Collection<IPrimitive> processed) |
private java.util.List<OsmPrimitive> toAdd
private java.util.List<OsmPrimitive> toUpdate
private java.util.List<OsmPrimitive> toDelete
public APIDataSet()
public APIDataSet(DataSet ds)
ds
ds
- the data set. Ignored, if null.public APIDataSet(java.util.Collection<OsmPrimitive> primitives)
primitives
primitives
- the collection of primitivespublic void init(DataSet ds)
ds
ds
- the data set. Ignored, if null.public final void init(java.util.Collection<OsmPrimitive> primitives)
primitives
- the primitivespublic boolean participatesInConflict(ConflictCollection conflicts)
conflicts
conflicts
- the collection of conflictsconflicts
public boolean isEmpty()
public java.util.List<OsmPrimitive> getPrimitivesToAdd()
public java.util.List<OsmPrimitive> getPrimitivesToUpdate()
public java.util.List<OsmPrimitive> getPrimitivesToDelete()
public java.util.List<OsmPrimitive> getPrimitives()
public int getSize()
public void removeProcessed(java.util.Collection<IPrimitive> processed)
public void adjustRelationUploadOrder() throws CyclicUploadDependencyException
CyclicUploadDependencyException
- if a cyclic dependency is detectedprotected java.util.List<Relation> filterRelationsNotReferringToNewRelations(java.util.Collection<Relation> relations)
relations
which are not referring to any
new relationrelations
- a list of relationsrelations
which are not referring to any
new relation