public class APIDataSet extends 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 List<OsmPrimitive> |
toAdd |
private List<OsmPrimitive> |
toDelete |
private List<OsmPrimitive> |
toUpdate |
Constructor and Description |
---|
APIDataSet()
creates a new empty data set
|
APIDataSet(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 List<Relation> |
filterRelationsNotReferringToNewRelations(Collection<Relation> relations)
Replies the subset of relations in
relations which are not referring to any
new relation |
List<OsmPrimitive> |
getPrimitives()
Replies all primitives
|
List<OsmPrimitive> |
getPrimitivesToAdd()
Replies the primitives which should be added to the OSM database
|
List<OsmPrimitive> |
getPrimitivesToDelete()
Replies the primitives which should be deleted in the OSM database
|
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(Collection<OsmPrimitive> 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(Conflict<?> conflict)
Replies true if one of the primitives to be updated or to be deleted
participates in the conflict
conflict |
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(Collection<IPrimitive> processed) |
private List<OsmPrimitive> toAdd
private List<OsmPrimitive> toUpdate
private List<OsmPrimitive> toDelete
public APIDataSet()
public APIDataSet(DataSet ds)
ds
ds
- the data set. Ignored, if null.public APIDataSet(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(Collection<OsmPrimitive> primitives)
public boolean participatesInConflict(Conflict<?> conflict)
conflict
conflict
- the conflictconflict
public boolean participatesInConflict(ConflictCollection conflicts)
conflicts
conflicts
- the collection of conflictsconflicts
public boolean isEmpty()
public List<OsmPrimitive> getPrimitivesToAdd()
public List<OsmPrimitive> getPrimitivesToUpdate()
public List<OsmPrimitive> getPrimitivesToDelete()
public List<OsmPrimitive> getPrimitives()
public int getSize()
public void removeProcessed(Collection<IPrimitive> processed)
public void adjustRelationUploadOrder() throws CyclicUploadDependencyException
CyclicUploadDependencyException
- thrown, if a cyclic dependency is detectedprotected List<Relation> filterRelationsNotReferringToNewRelations(Collection<Relation> relations)
relations
which are not referring to any
new relationrelations
- a list of relationsrelations
which are not referring to any
new relation