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


Ignore:
Timestamp:
2009-08-08T14:00:59+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3217: Split way does not work

File:
1 edited

Legend:

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

    r1924 r1932  
    104104
    105105    /**
    106      *
     106     * Sets whether this primitive is selected or not.
     107     *
     108     * @param selected  true, if this primitive is selected; false, otherwise
    107109     * @since 1899
    108110     */
     
    111113    }
    112114    /**
    113      *
     115     * Replies true, if this primitive is selected.
     116     *
     117     * @return true, if this primitive is selected
    114118     * @since 1899
    115119     */
     
    242246
    243247    /**
    244      *
     248     * Replies the map of key/value pairs. Never replies null. The map can be empty, though.
     249     *
    245250     * @return Keys of this primitive. Changes made in returned map are not mapped
    246251     * back to the primitive, use setKeys() to modify the keys
     
    249254    public Map<String, String> getKeys() {
    250255        // TODO More effective map
    251         return new HashMap<String, String>(keys);
    252     }
    253 
    254     /**
    255      *
     256        // fix for #3218
     257        if (keys == null)
     258            return new HashMap<String, String>();
     259        else
     260            return new HashMap<String, String>(keys);
     261    }
     262
     263    /**
     264     * Sets the keys of this primitives to the key/value pairs in <code>keys</code>.
     265     * If <code>keys</code> is null removes all existing key/value pairs.
     266     *
     267     * @param keys the key/value pairs to set. If null, removes all existing key/value pairs.
    256268     * @since 1924
    257269     */
     
    265277
    266278    /**
    267      * Set the given value to the given key
    268      * @param key The key, for which the value is to be set.
    269      * @param value The value for the key.
     279     * Set the given value to the given key. If key is null, does nothing. If value is null,
     280     * removes the key and behaves like {@see #remove(String)}.
     281     *
     282     * @param key  The key, for which the value is to be set. Can be null, does nothing in this case.
     283     * @param value The value for the key. If null, removes the respective key/value pair.
     284     *
     285     * @see #remove(String)
    270286     */
    271287    public final void put(String key, String value) {
    272         if (value == null) {
     288        if (key == null)
     289            return;
     290        else if (value == null) {
    273291            remove(key);
    274292        } else {
     
    281299    }
    282300    /**
    283      * Remove the given key from the list.
     301     * Remove the given key from the list
     302     *
     303     * @param key  the key to be removed. Ignored, if key is null.
    284304     */
    285305    public final void remove(String key) {
     
    294314
    295315    /**
    296      *
     316     * Removes all keys from this primitive.
     317     *
    297318     * @since 1843
    298319     */
     
    302323    }
    303324
     325    /**
     326     * Replies the value for key <code>key</code>. Replies null, if <code>key</code> is null.
     327     * Replies null, if there is no value for the given key.
     328     *
     329     * @param key the key. Can be null, replies null in this case.
     330     * @return the value for key <code>key</code>.
     331     */
    304332    public final String get(String key) {
     333        if (key == null) return null;
    305334        return keys == null ? null : keys.get(key);
    306335    }
     
    319348
    320349    /**
    321      *
     350     * Replies true, if the map of key/value pairs of this primitive is not empty.
     351     *
     352     * @return true, if the map of key/value pairs of this primitive is not empty; false
     353     *   otherwise
     354     *
    322355     * @since 1843
    323356     */
Note: See TracChangeset for help on using the changeset viewer.