Changeset 1926 in josm for trunk/src/org


Ignore:
Timestamp:
2009-08-08T09:22:24+02:00 (15 years ago)
Author:
jttt
Message:

Replaced Relation.members with Relation.getMember() or Relation.getMembersCount()

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r1925 r1926  
    100100                }
    101101            }
    102             rnew.members.clear();
    103             rnew.members.addAll(members);
     102            rnew.setMembers(members);
    104103            map.put(r, rnew);
    105104        }
  • trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java

    r1814 r1926  
    4343
    4444    @Override public boolean executeCommand() {
    45         if (position < 0 || position >= relation.members.size()) {
     45        if (position < 0 || position >= relation.getMembersCount()) {
    4646            Main.debug("error changing the role");
    4747            return false;
    4848        }
    4949
    50         oldRole = relation.members.get(position).role;
    51         relation.members.get(position).role = newRole;
     50        oldRole = relation.getMember(position).role;
     51        relation.getMember(position).role = newRole;
    5252
    5353        oldModified = relation.modified;
     
    5757
    5858    @Override public void undoCommand() {
    59         relation.members.get(position).role = oldRole;
     59        relation.getMember(position).role = oldRole;
    6060        relation.modified = oldModified;
    6161    }
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r1925 r1926  
    3737    /**
    3838     *
    39      * @param members
     39     * @param members Can be null, in that case all members are removed
    4040     * @since 1925
    4141     */
    4242    public void setMembers(List<RelationMember> members) {
    4343        this.members.clear();
    44         this.members.addAll(members);
     44        if (members != null) {
     45            this.members.addAll(members);
     46        }
     47    }
     48
     49    /**
     50     *
     51     * @since 1926
     52     */
     53    public int getMembersCount() {
     54        return members.size();
     55    }
     56
     57    /**
     58     *
     59     * @param index
     60     * @return
     61     * @since 1926
     62     */
     63    public RelationMember getMember(int index) {
     64        return members.get(index);
    4565    }
    4666
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

    r1925 r1926  
    206206        }
    207207        if (replacedSomething) {
    208             r.members.clear();
    209             r.members.addAll(newMembers);
     208            r.setMembers(newMembers);
    210209        }
    211210    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r1925 r1926  
    1818
    1919import org.openstreetmap.josm.Main;
    20 import org.openstreetmap.josm.data.SelectionChangedListener;
    2120import org.openstreetmap.josm.data.osm.DataSet;
    2221import org.openstreetmap.josm.data.osm.Node;
     
    224223
    225224    public void applyToRelation(Relation relation) {
    226         relation.members.clear();
    227         relation.members.addAll(members);
     225        relation.setMembers(members);
    228226    }
    229227
Note: See TracChangeset for help on using the changeset viewer.