Ignore:
Timestamp:
2009-09-07T23:06:19+02:00 (15 years ago)
Author:
Gubaer
Message:

Had to replace DataSet:getPrimitiveById(id) with DataSet:getPrimitiveById(id,type). Primitive ids are not globally unique, only per type of primitive.
Fixed problems in unit test, available unit tests passing again.

File:
1 edited

Legend:

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

    r2070 r2077  
    33
    44import java.util.ArrayList;
     5
    56import java.util.Arrays;
    67import java.util.Collection;
     
    1011import org.openstreetmap.josm.tools.CopyList;
    1112import org.openstreetmap.josm.tools.Pair;
     13import static org.openstreetmap.josm.tools.I18n.tr;
    1214
    1315/**
     
    123125     */
    124126    public Way(){
     127        super(0);
    125128    }
    126129
     
    197200    }
    198201
    199     public void addNode(Node n) {
     202    /**
     203     * Adds a node to the end of the list of nodes. Ignored, if n is null.
     204     *
     205     * @param n the node. Ignored, if null.
     206     * @throws IllegalStateException thrown, if this way is marked as incomplete. We can't add a node
     207     * to an incomplete way
     208     */
     209    public void addNode(Node n) throws IllegalStateException {
     210        if (n==null) return;
     211        if (incomplete)
     212            throw new IllegalStateException(tr("can't add node {0} to incomplete way {1}", n.getId(), getId()));
    200213        if (incomplete) return;
    201214        clearCached();
     
    203216    }
    204217
    205     public void addNode(int offs, Node n) {
    206         if (incomplete) return;
     218    /**
     219     * Adds a node at position offs.
     220     *
     221     * @param int offs the offset
     222     * @param n the node. Ignored, if null.
     223     * @throws IllegalStateException thrown, if this way is marked as incomplete. We can't add a node
     224     * to an incomplete way
     225     * @throws IndexOutOfBoundsException thrown if offs is out of bounds
     226     */
     227    public void addNode(int offs, Node n) throws IllegalStateException, IndexOutOfBoundsException {
     228        if (n==null) return;
     229        if (incomplete)
     230            throw new IllegalStateException(tr("can't add node {0} to incomplete way {1}", n.getId(), getId()));
    207231        clearCached();
    208232        nodes.add(offs, n);
Note: See TracChangeset for help on using the changeset viewer.