Ignore:
Timestamp:
2009-11-02T21:04:32+01:00 (14 years ago)
Author:
jttt
Message:

Replace Dataset.nodes with getNodes(), etc

File:
1 edited

Legend:

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

    r2381 r2388  
    9898     */
    9999    protected <P extends OsmPrimitive> void mergePrimitive(P other,
    100             Collection<P> myPrimitives, Collection<P> otherPrimitives,
    101             HashMap<Long, P> primitivesWithDefinedIds) {
     100            DataSet myDataset, Collection<P> myPrimitives, HashMap<Long, P> primitivesWithDefinedIds) {
    102101
    103102        if (!other.isNew() ) {
     
    105104            // defined id
    106105            //
    107             if (mergeById(myPrimitives, primitivesWithDefinedIds, other))
     106            if (mergeById(primitivesWithDefinedIds, other))
    108107                return;
    109108        } else {
     
    136135        // my dataset. Just add other to my dataset.
    137136        //
    138         myPrimitives.add(other);
     137        myDataset.addPrimitive(other);
    139138    }
    140139
    141140    public void visit(Node other) {
    142         mergePrimitive(other, myDataSet.nodes, theirDataSet.nodes, nodeshash);
     141        mergePrimitive(other, myDataSet, myDataSet.getNodes(), nodeshash);
    143142    }
    144143
    145144    public void visit(Way other) {
    146145        fixWay(other);
    147         mergePrimitive(other, myDataSet.ways, theirDataSet.ways, wayshash);
     146        mergePrimitive(other, myDataSet, myDataSet.getWays(), wayshash);
    148147    }
    149148
    150149    public void visit(Relation other) {
    151150        fixRelation(other);
    152         mergePrimitive(other, myDataSet.relations, theirDataSet.relations, relshash);
     151        mergePrimitive(other, myDataSet, myDataSet.getRelations(), relshash);
    153152    }
    154153
     
    230229     * Tries to merge a primitive <code>other</code> into an existing primitive with the same id.
    231230     *
    232      * @param myPrimitives the complete set of my primitives (potential merge targets)
    233231     * @param myPrimitivesWithDefinedIds the map of primitives (potential merge targets) with an id <> 0, for faster lookup
    234232     *    by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a
     
    237235     * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise
    238236     */
    239     private <P extends OsmPrimitive> boolean mergeById(
    240             Collection<P> myPrimitives, HashMap<Long, P> myPrimitivesWithDefinedIds, P other) {
     237    private <P extends OsmPrimitive> boolean mergeById(HashMap<Long, P> myPrimitivesWithDefinedIds, P other) {
    241238
    242239        // merge other into an existing primitive with the same id, if possible
Note: See TracChangeset for help on using the changeset viewer.