Changeset 13924 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2018-06-12T22:19:16+02:00 (6 years ago)
Author:
Don-vip
Message:

add IPrimitive.getOsm*Id()

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java

    r13913 r13924  
    199199
    200200    /**
    201      * Replies the unique primitive id for this primitive
     201     * Replies the OSM id of this primitive.
     202     * By default, returns the same value as {@link #getId}.
     203     * Can be overidden by primitive implementations handling an internal id different from the OSM one.
     204     *
     205     * @return the OSM id of this primitive.
     206     * @since 13924
     207     */
     208    default long getOsmId() {
     209        return getId();
     210    }
     211
     212    /**
     213     * Replies the OSM primitive id for this primitive.
     214     *
     215     * @return the OSM primitive id for this primitive
     216     * @see #getOsmId
     217     * @since 13924
     218     */
     219    default PrimitiveId getOsmPrimitiveId() {
     220        return new SimplePrimitiveId(getOsmId(), getType());
     221    }
     222
     223    /**
     224     * Replies the unique primitive id for this primitive.
    202225     *
    203226     * @return the unique primitive id for this primitive
     227     * @see #getUniqueId
    204228     */
    205229    default PrimitiveId getPrimitiveId() {
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveId.java

    r8419 r13924  
    33
    44/**
    5 * interface to represent identifaction and type of the datatypes primitives.
     5* interface to represent identification and type of the datatypes primitives.
    66*
    77* @since 2399
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

    r13849 r13924  
    113113     * Adds an object to be loaded, the object is specified by an OSM primitive.
    114114     *
    115      * @param primitive the OSM primitive. Must not be null. primitive.getId() > 0 required.
     115     * @param primitive the OSM primitive. Must not be null. primitive.getOsmId() > 0 required.
    116116     * @return this task
    117117     * @throws IllegalArgumentException if the primitive is null
    118      * @throws IllegalArgumentException if primitive.getId() <= 0
     118     * @throws IllegalArgumentException if primitive.getOsmId() <= 0
    119119     */
    120120    public HistoryLoadTask add(OsmPrimitive primitive) {
    121         CheckParameterUtil.ensure(primitive, "primitive", "id > 0", prim -> prim.getUniqueId() > 0);
    122         return add(primitive.getPrimitiveId());
     121        CheckParameterUtil.ensure(primitive, "primitive", "id > 0", prim -> prim.getOsmId() > 0);
     122        return add(primitive.getOsmPrimitiveId());
    123123    }
    124124
Note: See TracChangeset for help on using the changeset viewer.