Class APIDataSet

java.lang.Object
org.openstreetmap.josm.data.APIDataSet

public class APIDataSet extends 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
  • Field Details

  • Constructor Details

    • 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(Collection<OsmPrimitive> primitives)
      initializes the API data set with the primitives in primitives
      Parameters:
      primitives - the collection of primitives
  • Method Details

    • 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(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

      Replies the primitives which should be added to the OSM database
      Returns:
      the primitives which should be added to the OSM database
    • getPrimitivesToUpdate

      Replies the primitives which should be updated in the OSM database
      Returns:
      the primitives which should be updated in the OSM database
    • getPrimitivesToDelete

      Replies the primitives which should be deleted in the OSM database
      Returns:
      the primitives which should be deleted in the OSM database
    • getPrimitives

      Replies all primitives
      Returns:
      all primitives
    • getSize

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

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

      Adjusts the upload order for new relations. Child relations are uploaded first, parent relations second.

      This method detects cyclic dependencies in new relation. Relations with cyclic dependencies can't be uploaded.

      Throws:
      CyclicUploadDependencyException - if a cyclic dependency is detected
    • filterRelationsNotReferringToNewRelations

      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