Class APIDataSet


  • public class APIDataSet
    extends java.lang.Object
    Represents a collection of OsmPrimitives 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.
    Since:
    2025
    • Constructor Detail

      • APIDataSet

        public APIDataSet()
        creates a new empty data set
      • APIDataSet

        public APIDataSet​(DataSet ds)
        initializes the API data set with the modified primitives in ds
        Parameters:
        ds - the data set. Ignored, if null.
      • APIDataSet

        public APIDataSet​(java.util.Collection<OsmPrimitive> primitives)
        initializes the API data set with the primitives in primitives
        Parameters:
        primitives - the collection of primitives
    • Method Detail

      • init

        public void init​(DataSet ds)
        initializes the API data set with the modified primitives in ds
        Parameters:
        ds - the data set. Ignored, if null.
      • init

        public final void init​(java.util.Collection<OsmPrimitive> primitives)
        Initializes the API data set with the modified primitives, ignores unmodified primitives.
        Parameters:
        primitives - the primitives
      • participatesInConflict

        public 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
        Parameters:
        conflicts - the collection of conflicts
        Returns:
        true if one of the primitives to be updated or to be deleted participates in at least one conflict in conflicts
      • isEmpty

        public boolean isEmpty()
        Replies true if there are no primitives to upload
        Returns:
        true if there are no primitives to upload
      • getPrimitivesToAdd

        public java.util.List<OsmPrimitivegetPrimitivesToAdd()
        Replies the primitives which should be added to the OSM database
        Returns:
        the primitives which should be added to the OSM database
      • getPrimitivesToUpdate

        public java.util.List<OsmPrimitivegetPrimitivesToUpdate()
        Replies the primitives which should be updated in the OSM database
        Returns:
        the primitives which should be updated in the OSM database
      • getPrimitivesToDelete

        public java.util.List<OsmPrimitivegetPrimitivesToDelete()
        Replies the primitives which should be deleted in the OSM database
        Returns:
        the primitives which should be deleted in the OSM database
      • getSize

        public int getSize()
        Replies the number of objects to upload
        Returns:
        the number of objects to upload
      • removeProcessed

        public void removeProcessed​(java.util.Collection<IPrimitive> processed)
        Removes the given primitives from this APIDataSet
        Parameters:
        processed - The primitives to remove
      • filterRelationsNotReferringToNewRelations

        protected java.util.List<RelationfilterRelationsNotReferringToNewRelations​(java.util.Collection<Relation> relations)
        Replies the subset of relations in relations which are not referring to any new relation
        Parameters:
        relations - a list of relations
        Returns:
        the subset of relations in relations which are not referring to any new relation