Changeset 13916 in josm


Ignore:
Timestamp:
2018-06-11T01:32:42+02:00 (10 months ago)
Author:
Don-vip
Message:

move getSelected*() default implementation from DataSet to OsmData

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

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

    r13915 r13916  
    607607
    608608    @Override
    609     public Collection<OsmPrimitive> getSelected() {
    610         return new SubclassFilteredCollection<>(getAllSelected(), p -> !p.isDeleted());
    611     }
    612 
    613     @Override
    614609    public Collection<OsmPrimitive> getAllSelected() {
    615610        return currentSelectedPrimitives;
    616     }
    617 
    618     @Override
    619     public Collection<Node> getSelectedNodes() {
    620         return new SubclassFilteredCollection<>(getSelected(), Node.class::isInstance);
    621     }
    622 
    623     @Override
    624     public Collection<Way> getSelectedWays() {
    625         return new SubclassFilteredCollection<>(getSelected(), Way.class::isInstance);
    626     }
    627 
    628     @Override
    629     public Collection<Relation> getSelectedRelations() {
    630         return new SubclassFilteredCollection<>(getSelected(), Relation.class::isInstance);
    631611    }
    632612
  • trunk/src/org/openstreetmap/josm/data/osm/OsmData.java

    r13915 r13916  
    1414import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    1515import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     16import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    1617
    1718/**
     
    332333     * @return unmodifiable collection of primitives
    333334     */
    334     Collection<O> getSelected();
     335    default Collection<O> getSelected() {
     336        return new SubclassFilteredCollection<>(getAllSelected(), p -> !p.isDeleted());
     337    }
    335338
    336339    /**
     
    348351     * @return selected nodes
    349352     */
    350     Collection<N> getSelectedNodes();
     353    default Collection<N> getSelectedNodes() {
     354        return new SubclassFilteredCollection<>(getSelected(), Node.class::isInstance);
     355    }
    351356
    352357    /**
     
    354359     * @return selected ways
    355360     */
    356     Collection<W> getSelectedWays();
     361    default Collection<W> getSelectedWays() {
     362        return new SubclassFilteredCollection<>(getSelected(), Way.class::isInstance);
     363    }
    357364
    358365    /**
     
    360367     * @return selected relations
    361368     */
    362     Collection<R> getSelectedRelations();
     369    default Collection<R> getSelectedRelations() {
     370        return new SubclassFilteredCollection<>(getSelected(), Relation.class::isInstance);
     371    }
    363372
    364373    /**
Note: See TracChangeset for help on using the changeset viewer.