Changeset 1925 in josm


Ignore:
Timestamp:
2009-08-08T08:52:03+02:00 (15 years ago)
Author:
jttt
Message:

Replaced Relation.members with Relation.getMembers()

Location:
trunk
Files:
33 edited

Legend:

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

    r1911 r1925  
    9393                continue;
    9494            }
    95             for (RelationMember rm : r.members) {
     95            for (RelationMember rm : r.getMembers()) {
    9696                if (rm.member instanceof Way) {
    9797                    for(Way w : selectedWays) {
     
    228228            newRel.members.clear();
    229229            HashSet<String> rolesToReAdd = new HashSet<String>();
    230             for (RelationMember rm : r.members) {
     230            for (RelationMember rm : r.getMembers()) {
    231231                // Don't copy the member if it to one of our ways, just keep a
    232232                // note to re-add it later on.
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r1862 r1925  
    9696                Relation enew = new Relation(e);
    9797                List<RelationMember> members = new ArrayList<RelationMember>();
    98                 for (RelationMember m : e.members) {
     98                for (RelationMember m : e.getMembers()) {
    9999                    if (! map.containsKey(m.member)) {
    100100                        m.member.visit(this);
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r1912 r1925  
    130130                continue;
    131131            }
    132             for (RelationMember rm : r.members) {
     132            for (RelationMember rm : r.getMembers()) {
    133133                if (rm.member instanceof Node) {
    134134                    for (Node n : allNodes) {
     
    278278            newRel.members.clear();
    279279            HashSet<String> rolesToReAdd = new HashSet<String>();
    280             for (RelationMember rm : r.members) {
     280            for (RelationMember rm : r.getMembers()) {
    281281                // Don't copy the member if it points to one of our nodes,
    282282                // just keep a note to re-add it later on.
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r1862 r1925  
    9191            rnew.id = 0;
    9292            List<RelationMember> members = new ArrayList<RelationMember>();
    93             for (RelationMember m : r.members) {
     93            for (RelationMember m : r.getMembers()) {
    9494                OsmPrimitive mo = map.get(m.member);
    9595                if(mo != null) /* TODO - This only prevents illegal data, but kills the relation */
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r1924 r1925  
    304304            int i = 0;
    305305
    306             for (RelationMember rm : r.members) {
     306            for (RelationMember rm : r.getMembers()) {
    307307                if (rm.member instanceof Way) {
    308308                    if (rm.member == selectedWay)
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r1924 r1925  
    327327            newRel = null;
    328328            rolesToReAdd = null;
    329             for (RelationMember rm : r.members) {
     329            for (RelationMember rm : r.getMembers()) {
    330330                if (rm.member instanceof Node) {
    331331                    if (rm.member == originalNode) {
     
    340340            }
    341341            if (newRel != null) {
    342                 for (RelationMember rm : r.members) {
     342                for (RelationMember rm : r.getMembers()) {
    343343                    //if (rm.member != selectedNode) {
    344344                    newRel.members.add(rm);
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r1924 r1925  
    445445                }
    446446            } else if (osm instanceof Relation) {
    447                 for (RelationMember member : ((Relation)osm).members) {
     447                for (RelationMember member : ((Relation)osm).getMembers()) {
    448448                    if (member.member != null) {
    449449                        isParent |= child.match(member.member);
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r1924 r1925  
    164164        PrimitiveNameFormatter formatter = new PrimitiveNameFormatter();
    165165        String role = new String();
    166         for (RelationMember m : ref.members) {
     166        for (RelationMember m : ref.getMembers()) {
    167167            if (m.member == osm) {
    168168                role = m.role;
  • trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java

    r1910 r1925  
    119119            } else if (parent instanceof Relation) {
    120120                Relation r = (Relation)parent;
    121                 for (RelationMember member : r.members) {
     121                for (RelationMember member : r.getMembers()) {
    122122                    if (member.member == child) {
    123123                        OsmParentChildPair pair = new OsmParentChildPair(parent, member.member);
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

    r1862 r1925  
    117117        for (Relation relation : Main.main.getCurrentDataSet().relations) {
    118118            int position = 0;
    119             for (RelationMember member : relation.members) {
     119            for (RelationMember member : relation.getMembers()) {
    120120                if (!member.member.hasEqualSemanticAttributes(oldway)
    121121                        || member.role.length() == 0) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r1910 r1925  
    401401    public void unlinkPrimitiveFromRelations(OsmPrimitive primitive) {
    402402        for (Relation relation : relations) {
    403             Iterator<RelationMember> it = relation.members.iterator();
     403            Iterator<RelationMember> it = relation.getMembers().iterator();
    404404            while(it.hasNext()) {
    405405                RelationMember member = it.next();
     
    442442                continue;
    443443            }
    444             for (RelationMember member: parent.members) {
     444            for (RelationMember member: parent.getMembers()) {
    445445                if (member.refersTo(child)) {
    446446                    parents.add(parent);
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r1762 r1925  
    44import static org.openstreetmap.josm.tools.I18n.trn;
    55
     6import java.util.ArrayList;
    67import java.util.Arrays;
    7 import java.util.ArrayList;
    88import java.util.Collection;
    99import java.util.List;
    1010
     11import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.data.osm.visitor.Visitor;
    12 import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.tools.CopyList;
    1314
    1415/**
     
    2425     */
    2526    public final List<RelationMember> members = new ArrayList<RelationMember>();
     27
     28    /**
     29     * @return Members of the relation. Changes made in returned list are not mapped
     30     * back to the primitive, use setMembers() to modify the members
     31     * @since 1925
     32     */
     33    public List<RelationMember> getMembers() {
     34        return new CopyList<RelationMember>(members.toArray(new RelationMember[members.size()]));
     35    }
     36
     37    /**
     38     *
     39     * @param members
     40     * @since 1925
     41     */
     42    public void setMembers(List<RelationMember> members) {
     43        this.members.clear();
     44        this.members.addAll(members);
     45    }
    2646
    2747    final static String[] defnames = {"name", "ref", "restriction", "note"};
     
    5979        // we must not add the members themselves, but instead
    6080        // add clones of the members
    61         for (RelationMember em : ((Relation)osm).members) {
     81        for (RelationMember em : ((Relation)osm).getMembers()) {
    6282            members.add(new RelationMember(em));
    6383        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java

    r1523 r1925  
    55import java.util.HashSet;
    66
     7import org.openstreetmap.josm.data.osm.Node;
     8import org.openstreetmap.josm.data.osm.OsmPrimitive;
    79import org.openstreetmap.josm.data.osm.Relation;
    810import org.openstreetmap.josm.data.osm.RelationMember;
    9 import org.openstreetmap.josm.data.osm.Node;
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1111import org.openstreetmap.josm.data.osm.Way;
    1212
     
    4343     */
    4444    public void visit(Relation e) {
    45         for (RelationMember m : e.members)
     45        for (RelationMember m : e.getMembers())
    4646            if (m.member instanceof Node) visit((Node)m.member);
    4747    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r1724 r1925  
    55import org.openstreetmap.josm.data.Bounds;
    66import org.openstreetmap.josm.data.ProjectionBounds;
     7import org.openstreetmap.josm.data.coor.CachedLatLon;
    78import org.openstreetmap.josm.data.coor.EastNorth;
    8 import org.openstreetmap.josm.data.coor.CachedLatLon;
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010import org.openstreetmap.josm.data.osm.Node;
     
    3333    public void visit(Relation e) {
    3434        // only use direct members
    35         for (RelationMember m : e.members) {
     35        for (RelationMember m : e.getMembers()) {
    3636            if (!(m.member instanceof Relation)) {
    3737                m.member.visit(this);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/CollectBackReferencesVisitor.java

    r1862 r1925  
    7373        for (Relation r : ds.relations) {
    7474            if (r.incomplete || r.deleted) continue;
    75             for (RelationMember m : r.members) {
     75            for (RelationMember m : r.getMembers()) {
    7676                if (m.member == p) {
    7777                    if (!data.contains(r)) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1899 r1925  
    485485        if(selectedCall)
    486486        {
    487             for (RelationMember m : r.members)
     487            for (RelationMember m : r.getMembers())
    488488            {
    489489                if (m.member != null && !m.member.incomplete && !m.member.deleted
     
    507507        if(r.isSelected()) /* draw ways*/
    508508        {
    509             for (RelationMember m : r.members)
     509            for (RelationMember m : r.getMembers())
    510510            {
    511511                if (m.member != null && !m.member.incomplete && !m.member.deleted
     
    532532
    533533        /* find the "from", "via" and "to" elements */
    534         for (RelationMember m : r.members)
     534        for (RelationMember m : r.getMembers())
    535535        {
    536536            //if(restrictionDebug)
     
    782782        r.clearErrors();
    783783
    784         for (RelationMember m : r.members)
     784        for (RelationMember m : r.getMembers())
    785785        {
    786786            if(m.member == null)
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r1910 r1925  
    9191        }
    9292        clone.members.clear();
    93         for (RelationMember member: r.members) {
     93        for (RelationMember member: r.getMembers()) {
    9494            RelationMember cloneMember = new RelationMember(member);
    9595            cloneMember.member = mappedPrimitives.get(member.member);
     
    189189        //
    190190        rememberRelationPartial(r);
    191         for (RelationMember member: r.members) {
     191        for (RelationMember member: r.getMembers()) {
    192192            if (isAlreadyRemembered(member.member)) {
    193193                // referred primitive already remembered
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

    r1862 r1925  
    192192        boolean replacedSomething = false;
    193193        LinkedList<RelationMember> newMembers = new LinkedList<RelationMember>();
    194         for (RelationMember myMember : r.members) {
     194        for (RelationMember myMember : r.getMembers()) {
    195195            OsmPrimitive mergedMember = merged.get(myMember.member);
    196196            if (mergedMember == null) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1899 r1925  
    348348        g.setColor(col);
    349349
    350         for (RelationMember m : r.members) {
     350        for (RelationMember m : r.getMembers()) {
    351351            if (m.member.incomplete || m.member.deleted) continue;
    352352
  • trunk/src/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModel.java

    r1898 r1925  
    570570
    571571        HashMap<Long,OsmPrimitive> candidates = new HashMap<Long, OsmPrimitive>();
    572         for (RelationMember m : r.members) {
     572        for (RelationMember m : r.getMembers()) {
    573573            if (m.member.id > 0 && !candidates.values().contains(m.member)) {
    574574                candidates.put(m.member.id,m.member);
  • trunk/src/org/openstreetmap/josm/gui/conflict/relation/RelationMemberListMergeModel.java

    r1655 r1925  
    1515/**
    1616 * The model for merging two lists of relation members
    17  * 
     17 *
    1818 *
    1919 */
     
    6363    /**
    6464     * populates the model with the relation members in relation my and their
    65      * 
     65     *
    6666     * @param my my relation. Must not be null.
    6767     * @param their their relation. Must not be null.
    68      * 
     68     *
    6969     * @throws IllegalArgumentException if my is null
    7070     * @throws IllegalArgumentException if their is null
     
    8080        getTheirEntries().clear();
    8181
    82         for (RelationMember n : my.members) {
     82        for (RelationMember n : my.getMembers()) {
    8383            getMyEntries().add(n);
    8484        }
    85         for (RelationMember n : their.members) {
     85        for (RelationMember n : their.getMembers()) {
    8686            getTheirEntries().add(n);
    8787        }
     
    108108    /**
    109109     * Builds the command to resolve conflicts in the node list of a way
    110      * 
     110     *
    111111     * @param my  my relation. Must not be null.
    112112     * @param their  their relation. Must not be null
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r1898 r1925  
    190190            }
    191191            public void visit(Relation e) {
    192                 for (RelationMember em : e.members) {
     192                for (RelationMember em : e.getMembers()) {
    193193                    em.member.visit(this);
    194194                }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r1911 r1925  
    591591                            Relation rel = new Relation(cur);
    592592                            Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected();
    593                             for (RelationMember rm : cur.members) {
     593                            for (RelationMember rm : cur.getMembers()) {
    594594                                for (OsmPrimitive osm : sel) {
    595595                                    if (rm.member == osm)
     
    802802            for (Relation r : Main.main.getCurrentDataSet().relations) {
    803803                if (!r.deleted && !r.incomplete) {
    804                     for (RelationMember m : r.members) {
     804                    for (RelationMember m : r.getMembers()) {
    805805                        if (newSelection.contains(m.member)) {
    806806                            Collection<RelationMember> value = roles.get(r);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r1916 r1925  
    270270            Collection<RelationMember> members = new HashSet<RelationMember>();
    271271            Collection<OsmPrimitive> selection = Main.map.mapView.getEditLayer().data.getSelected();
    272             for (RelationMember member: r.members) {
     272            for (RelationMember member: r.getMembers()) {
    273273                if (selection.contains(member.member)) {
    274274                    members.add(member);
     
    368368    /**
    369369     * Creates a new relation with a copy of the current editor state
    370      * 
     370     *
    371371     */
    372372    class DuplicateAction extends AbstractAction implements ListSelectionListener {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java

    r1889 r1925  
    5151 * ChildRelationBrowser is a UI component which provides a tree-like view on the hierarchical
    5252 * structure of relations
    53  * 
     53 *
    5454 *
    5555 */
     
    6767    /**
    6868     * Replies the {@see OsmDataLayer} this editor is related to
    69      * 
     69     *
    7070     * @return the osm data layer
    7171     */
     
    8888    /**
    8989     * builds the panel with the command buttons
    90      * 
     90     *
    9191     * @return the button panel
    9292     */
     
    114114    /**
    115115     * constructor
    116      * 
     116     *
    117117     * @param layer the {@see OsmDataLayer} this browser is related to. Must not be null.
    118118     * @exception IllegalArgumentException thrown, if layer is null
     
    128128    /**
    129129     * constructor
    130      * 
     130     *
    131131     * @param layer the {@see OsmDataLayer} this browser is related to. Must not be null.
    132132     * @param root the root relation
     
    140140    /**
    141141     * populates the browser with a relation
    142      * 
     142     *
    143143     * @param r the relation
    144144     */
     
    149149    /**
    150150     * populates the browser with a list of relation members
    151      * 
     151     *
    152152     * @param members the list of relation members
    153153     */
     
    159159    /**
    160160     * replies the parent dialog this browser is embedded in
    161      * 
     161     *
    162162     * @return the parent dialog; null, if there is no {@see Dialog} as parent dialog
    163163     */
     
    172172    /**
    173173     * Action for editing the currently selected relation
    174      * 
    175      * 
     174     *
     175     *
    176176     */
    177177    class EditAction extends AbstractAction implements TreeSelectionListener {
     
    278278    /**
    279279     * The asynchronous task for downloading relation members.
    280      * 
    281      * 
     280     *
     281     *
    282282     */
    283283    class DownloadAllChildrenTask extends PleaseWaitRunnable {
     
    338338         * warns the user if a relation couldn't be loaded because it was deleted on
    339339         * the server (the server replied a HTTP code 410)
    340          * 
     340         *
    341341         * @param r the relation
    342342         */
     
    360360        /**
    361361         * Remembers the child relations to download
    362          * 
     362         *
    363363         * @param parent the parent relation
    364364         */
    365365        protected void rememberChildRelationsToDownload(Relation parent) {
    366366            downloadedRelationIds.add(parent.id);
    367             for (RelationMember member: parent.members) {
     367            for (RelationMember member: parent.getMembers()) {
    368368                if (member.member instanceof Relation) {
    369369                    Relation child = (Relation)member.member;
     
    378378         * Merges the primitives in <code>ds</code> to the dataset of the
    379379         * edit layer
    380          * 
     380         *
    381381         * @param ds the data set
    382382         */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r1922 r1925  
    2727import java.util.Iterator;
    2828import java.util.List;
    29 import java.util.Set;
    3029import java.util.logging.Logger;
    3130
    3231import javax.swing.AbstractAction;
    3332import javax.swing.BorderFactory;
    34 import javax.swing.DefaultListSelectionModel;
    3533import javax.swing.JButton;
    3634import javax.swing.JComponent;
     
    4240import javax.swing.JTabbedPane;
    4341import javax.swing.JTable;
    44 import javax.swing.JTextField;
    4542import javax.swing.KeyStroke;
    4643import javax.swing.SwingUtilities;
     
    8784/**
    8885 * This dialog is for editing relations.
    89  * 
     86 *
    9087 */
    9188public class GenericRelationEditor extends RelationEditor {
     
    114111     * Creates a new relation editor for the given relation. The relation will be saved if the user
    115112     * selects "ok" in the editor.
    116      * 
     113     *
    117114     * If no relation is given, will create an editor for a new relation.
    118      * 
     115     *
    119116     * @param layer the {@see OsmDataLayer} the new or edited relation belongs to
    120117     * @param relation relation to edit, or null to create a new one.
     
    206203    /**
    207204     * builds the panel with the OK and the Cancel button
    208      * 
     205     *
    209206     * @return the panel with the OK and the Cancel button
    210207     */
     
    221218    /**
    222219     * build the panel with the buttons on the left
    223      * 
     220     *
    224221     * @return
    225222     */
     
    260257    /**
    261258     * builds the panel with the tag editor
    262      * 
     259     *
    263260     * @return the panel with the tag editor
    264261     */
     
    325322    /**
    326323     * builds the panel for the relation member editor
    327      * 
     324     *
    328325     * @return the panel for the relation member editor
    329326     */
     
    439436    /**
    440437     * builds the panel with the table displaying the currently selected primitives
    441      * 
     438     *
    442439     * @return
    443440     */
     
    454451    /**
    455452     * builds the {@see JSplitPane} which divides the editor in an upper and a lower half
    456      * 
     453     *
    457454     * @return the split panel
    458455     */
     
    475472    /**
    476473     * build the panel with the buttons on the left
    477      * 
     474     *
    478475     * @return
    479476     */
     
    530527    /**
    531528     * build the panel with the buttons for adding or removing the current selection
    532      * 
     529     *
    533530     * @return
    534531     */
     
    659656     * checks whether the current relation has members referring to itself. If so,
    660657     * warns the users and provides an option for removing these members.
    661      * 
     658     *
    662659     */
    663660    protected void cleanSelfReferences() {
     
    10471044         * Apply the updates for an existing relation which has not been changed
    10481045         * outside of the relation editor.
    1049          * 
     1046         *
    10501047         */
    10511048        protected void applyExistingConflictingRelation() {
     
    10601057         * Apply the updates for an existing relation which has been changed
    10611058         * outside of the relation editor.
    1062          * 
     1059         *
    10631060         */
    10641061        protected void applyExistingNonConflictingRelation() {
     
    13671364    /**
    13681365     * Creates a new relation with a copy of the current editor state
    1369      * 
     1366     *
    13701367     */
    13711368    class DuplicateRelationAction extends AbstractAction {
     
    13891386    /**
    13901387     * Action for editing the currently selected relation
    1391      * 
    1392      * 
     1388     *
     1389     *
    13931390     */
    13941391    class EditAction extends AbstractAction implements ListSelectionListener {
     
    14081405            Collection<RelationMember> members = new HashSet<RelationMember>();
    14091406            Collection<OsmPrimitive> selection = getLayer().data.getSelected();
    1410             for (RelationMember member: r.members) {
     1407            for (RelationMember member: r.getMembers()) {
    14111408                if (selection.contains(member.member)) {
    14121409                    members.add(member);
     
    14851482    /**
    14861483     * The asynchronous task for downloading relation members.
    1487      * 
     1484     *
    14881485     */
    14891486    class DownloadTask extends PleaseWaitRunnable {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r1922 r1925  
    6969    public void populate(Relation relation) {
    7070        members.clear();
    71         if (relation != null && relation.members != null) {
     71        if (relation != null) {
    7272            // make sure we work with clones of the relation members
    7373            // in the model.
    74             members.addAll(new Relation(relation).members);
     74            members.addAll(new Relation(relation).getMembers());
    7575        }
    7676        fireTableDataChanged();
     
    328328    /**
    329329     * Replies the number of members which refer to a particular primitive
    330      * 
     330     *
    331331     * @param primitive the primitive
    332332     * @return the number of members which refer to a particular primitive
     
    344344    /**
    345345     * updates the role of the members given by the indices in <code>idx</code>
    346      * 
     346     *
    347347     * @param idx the array of indices
    348348     * @param role the new role
     
    362362    /**
    363363     * Get the currently selected relation members
    364      * 
     364     *
    365365     * @return a collection with the currently selected relation members
    366366     */
     
    375375    /**
    376376     * Replies the set of selected referers. Never null, but may be empty.
    377      * 
     377     *
    378378     * @return the set of selected referers
    379379     */
     
    389389     * Replies true, if the selected {@see OsmPrimitive}s in the layer belonging
    390390     * to this model are in sync with the selected referers in this model.
    391      * 
     391     *
    392392     * @return
    393393     */
     
    400400    /**
    401401     * Selects the members in the collection selectedMembers
    402      * 
     402     *
    403403     * @param selectedMembers the collection of selected members
    404404     */
     
    441441     * to an editable relation, i.e. a relation which is not
    442442     * incomplete.
    443      * 
     443     *
    444444     * @param index the index
    445445     * @return true, if the index-th relation members referrs
     
    460460     * Replies true if there is at least one relation member in this model
    461461     * which refers to at least on the primitives in <code>primitives</code>.
    462      * 
     462     *
    463463     * @param primitives the collection of primitives
    464464     * @return true if there is at least one relation member in this model
     
    485485     * Selects all mebers which refer to {@see OsmPrimitive}s in the collections
    486486     * <code>primitmives</code>. Does nothing is primitives is null.
    487      * 
     487     *
    488488     * @param primitives the collection of primitives
    489489     */
     
    507507     * Replies true if the layer this model belongs to is equal to the active
    508508     * layer
    509      * 
     509     *
    510510     * @return true if the layer this model belongs to is equal to the active
    511511     * layer
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java

    r1856 r1925  
    4747    protected boolean isReferringRelation(Relation parent) {
    4848        if (parent == null) return false;
    49         for (RelationMember m: parent.members) {
     49        for (RelationMember m: parent.getMembers()) {
    5050            if (m.member instanceof Relation) {
    5151                Relation child = (Relation)m.member;
     
    7070    /**
    7171     * Populates the browser with the list of referring relations in the {@see DataSet} ds.
    72      * 
     72     *
    7373     * @param ds the data set
    7474     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeModel.java

    r1848 r1925  
    1717 * This is a {@see TreeModel} which provides the hierarchical structure of {@see Relation}s
    1818 * to a  {@see JTree}.
    19  * 
     19 *
    2020 * The model is initialized with a root relation or with a list of {@see RelationMember}s, see
    2121 * {@see #populate(Relation)} and {@see #populate(List)} respectively.
    22  * 
     22 *
    2323 *
    2424 */
     
    5151    /**
    5252     * constructor
    53      * 
     53     *
    5454     * @param members a list of members
    5555     */
     
    6565     * Replies the number of children of type relation for a particular
    6666     * relation <code>parent</code>
    67      * 
     67     *
    6868     * @param parent the parent relation
    6969     * @return the number of children of type relation
     
    7171    protected int getNumRelationChildren(Relation parent) {
    7272        if (parent == null) return 0;
    73         if (parent.members == null) return 0;
    7473        int count = 0;
    75         for(RelationMember member : parent.members) {
     74        for(RelationMember member : parent.getMembers()) {
    7675            if (member.member instanceof Relation) {
    7776                count++;
     
    8483     * Replies the i-th child of type relation for a particular relation
    8584     * <code>parent</code>.
    86      * 
     85     *
    8786     * @param parent the parent relation
    8887     * @param idx the index
     
    9392        if (parent == null) return null;
    9493        int count=0;
    95         for (RelationMember member : parent.members) {
     94        for (RelationMember member : parent.getMembers()) {
    9695            if (!(member.member instanceof Relation)) {
    9796                continue;
     
    107106     * Replies the index of a particular <code>child</code> with respect to its
    108107     * <code>parent</code>.
    109      * 
     108     *
    110109     * @param parent  the parent relation
    111110     * @param child the child relation
     
    113112     * <code>parent</code>; -1 if either parent or child are null or if <code>child</code>
    114113     * isn't a child of <code>parent</code>.
    115      * 
     114     *
    116115     */
    117116    protected int getIndexForRelationChild(Relation parent, Relation child) {
    118117        if (parent == null || child == null) return -1;
    119118        int idx = 0;
    120         for (RelationMember member : parent.members) {
     119        for (RelationMember member : parent.getMembers()) {
    121120            if (!(member.member instanceof Relation)) {
    122121                continue;
     
    130129    /**
    131130     * Populates the model with a root relation
    132      * 
     131     *
    133132     * @param root the root relation
    134133     * @see #populate(List)
    135      * 
     134     *
    136135     */
    137136    public void populate(Relation root) {
     
    145144    /**
    146145     * Populates the model with a list of relation members
    147      * 
     146     *
    148147     * @param members the relation members
    149148     */
     
    170169     * Notifies tree model listeners about an update of the
    171170     * trees nodes.
    172      * 
     171     *
    173172     * @param path the tree path to the node
    174173     */
     
    183182    /**
    184183     * Invoke to notify all listeners about an update of a particular node
    185      * 
     184     *
    186185     * @param pathToNode the tree path to the node
    187186     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ac/AutoCompletionCache.java

    r1916 r1925  
    1818 * AutoCompletionCache temporarily holds a cache of keys with a list of
    1919 * possible auto completion values for each key.
    20  * 
     20 *
    2121 * The cache can initialize itself from the current JOSM data set such that
    2222 * <ol>
     
    2525 *     this key</li>
    2626 * </ol>
    27  * 
     27 *
    2828 * Building up auto completion lists should not
    2929 * slow down tabbing from input field to input field. Looping through the complete
     
    8787    /**
    8888     * make sure, <code>key</code> is in the cache
    89      * 
     89     *
    9090     * @param key  the key
    9191     */
     
    100100    /**
    101101     * make sure, value is one of the auto completion values allowed for key
    102      * 
     102     *
    103103     * @param key the key
    104104     * @param value the value
     
    115115     * make sure, the keys and values of all tags held by primitive are
    116116     * in the auto completion cache
    117      * 
     117     *
    118118     * @param primitive an OSM primitive
    119119     */
     
    127127    /**
    128128     * Caches all member roles of the relation <code>relation</code>
    129      * 
     129     *
    130130     * @param relation the relation
    131131     */
    132132    protected void cacheRelationMemberRoles(Relation relation){
    133         for (RelationMember m: relation.members) {
     133        for (RelationMember m: relation.getMembers()) {
    134134            if (m.role == null || m.role.trim().equals("")) {
    135135                continue;
     
    144144     * initializes the cache from the primitives in the dataset of
    145145     * {@see #layer}
    146      * 
     146     *
    147147     */
    148148    public void initFromJOSMDataset() {
     
    165165    /**
    166166     * replies the keys held by the cache
    167      * 
     167     *
    168168     * @return the list of keys held by the cache
    169169     */
     
    175175     * replies the auto completion values allowed for a specific key. Replies
    176176     * an empty list if key is null or if key is not in {@link #getKeys()}.
    177      * 
     177     *
    178178     * @param key
    179179     * @return the list of auto completion values
     
    187187    /**
    188188     * Replies the list of member roles
    189      * 
     189     *
    190190     * @return the list of member roles
    191191     */
     
    197197     * Populates the an {@see AutoCompletionList} with the currently cached
    198198     * member roles.
    199      * 
     199     *
    200200     * @param list the list to populate
    201201     */
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r1898 r1925  
    203203        if (relation.id == 0) return this;
    204204        remember(relation.id, OsmPrimitiveType.RELATION);
    205         for (RelationMember member : relation.members) {
     205        for (RelationMember member : relation.getMembers()) {
    206206            appendGeneric(member.member);
    207207        }
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r1898 r1925  
    131131        } else {
    132132            out.println(">");
    133             for (RelationMember em : e.members) {
     133            for (RelationMember em : e.getMembers()) {
    134134                out.print("    <member type='");
    135135                out.print(OsmPrimitiveType.from(em.member).getAPIName());
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r1910 r1925  
    381381        //
    382382        Set<Long> expectedWayIds = new HashSet<Long>();
    383         for (RelationMember m : lookupRelation(ds, 6).members) {
    384             if (m.member instanceof Way) {
    385                 expectedWayIds.add(m.member.id);
    386             }
    387         }
    388         for (RelationMember m : lookupRelation(ds, 7).members) {
    389             if (m.member instanceof Way) {
    390                 expectedWayIds.add(m.member.id);
    391             }
    392         }
    393         for (RelationMember m : lookupRelation(ds, 8).members) {
    394             if (m.member instanceof Way) {
    395                 expectedWayIds.add(m.member.id);
    396             }
    397         }
    398         for (RelationMember m : lookupRelation(ds, 9).members) {
     383        for (RelationMember m : lookupRelation(ds, 6).getMembers()) {
     384            if (m.member instanceof Way) {
     385                expectedWayIds.add(m.member.id);
     386            }
     387        }
     388        for (RelationMember m : lookupRelation(ds, 7).getMembers()) {
     389            if (m.member instanceof Way) {
     390                expectedWayIds.add(m.member.id);
     391            }
     392        }
     393        for (RelationMember m : lookupRelation(ds, 8).getMembers()) {
     394            if (m.member instanceof Way) {
     395                expectedWayIds.add(m.member.id);
     396            }
     397        }
     398        for (RelationMember m : lookupRelation(ds, 9).getMembers()) {
    399399            if (m.member instanceof Way) {
    400400                expectedWayIds.add(m.member.id);
     
    425425        HashSet<Long> ret = new HashSet<Long>();
    426426        if (r == null) return ret;
    427         for (RelationMember m: r.members) {
     427        for (RelationMember m: r.getMembers()) {
    428428            if (m.member instanceof Node) {
    429429                ret.add(m.member.id);
     
    477477        //
    478478        Set<Long> expectedWayIds = new HashSet<Long>();
    479         for (RelationMember m : lookupRelation(ds, 6).members) {
    480             if (m.member instanceof Way) {
    481                 expectedWayIds.add(m.member.id);
    482             }
    483         }
    484         for (RelationMember m : lookupRelation(ds, 7).members) {
    485             if (m.member instanceof Way) {
    486                 expectedWayIds.add(m.member.id);
    487             }
    488         }
    489         for (RelationMember m : lookupRelation(ds, 8).members) {
    490             if (m.member instanceof Way) {
    491                 expectedWayIds.add(m.member.id);
    492             }
    493         }
    494         for (RelationMember m : lookupRelation(ds, 9).members) {
     479        for (RelationMember m : lookupRelation(ds, 6).getMembers()) {
     480            if (m.member instanceof Way) {
     481                expectedWayIds.add(m.member.id);
     482            }
     483        }
     484        for (RelationMember m : lookupRelation(ds, 7).getMembers()) {
     485            if (m.member instanceof Way) {
     486                expectedWayIds.add(m.member.id);
     487            }
     488        }
     489        for (RelationMember m : lookupRelation(ds, 8).getMembers()) {
     490            if (m.member instanceof Way) {
     491                expectedWayIds.add(m.member.id);
     492            }
     493        }
     494        for (RelationMember m : lookupRelation(ds, 9).getMembers()) {
    495495            if (m.member instanceof Way) {
    496496                expectedWayIds.add(m.member.id);
Note: See TracChangeset for help on using the changeset viewer.