Ignore:
Timestamp:
2016-10-07T23:43:52+02:00 (8 years ago)
Author:
simon04
Message:

Default method implementations of Data interface

Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

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

    r8512 r11095  
    2222     * @return Area object encompassing downloaded data.
    2323     */
    24     Area getDataSourceArea();
     24    default Area getDataSourceArea() {
     25        return DataSource.getDataSourceArea(getDataSources());
     26    }
    2527
    2628    /**
     
    3638     * bounds are defined.
    3739     */
    38     List<Bounds> getDataSourceBounds();
     40    default List<Bounds> getDataSourceBounds() {
     41        return DataSource.getDataSourceBounds(getDataSources());
     42    }
    3943}
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r10906 r11095  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import java.awt.geom.Area;
    54import java.io.File;
    65import java.util.Collection;
     6import java.util.Collections;
    77import java.util.Date;
    88import java.util.HashSet;
    99import java.util.Iterator;
    1010import java.util.LinkedList;
    11 import java.util.List;
    1211import java.util.Map;
    1312import java.util.NoSuchElementException;
     
    470469    @Override
    471470    public Collection<DataSource> getDataSources() {
    472         return dataSources;
    473     }
    474 
    475     @Override
    476     public Area getDataSourceArea() {
    477         return DataSource.getDataSourceArea(dataSources);
    478     }
    479 
    480     @Override
    481     public List<Bounds> getDataSourceBounds() {
    482         return DataSource.getDataSourceBounds(dataSources);
     471        return Collections.unmodifiableCollection(dataSources);
    483472    }
    484473
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r10972 r11095  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.geom.Area;
    76import java.util.ArrayList;
    87import java.util.Arrays;
     
    2423
    2524import org.openstreetmap.josm.Main;
    26 import org.openstreetmap.josm.data.Bounds;
    2725import org.openstreetmap.josm.data.Data;
    2826import org.openstreetmap.josm.data.DataSource;
     
    923921    @Override
    924922    public Collection<DataSource> getDataSources() {
    925         return dataSources;
    926     }
    927 
    928     @Override
    929     public Area getDataSourceArea() {
    930         return DataSource.getDataSourceArea(dataSources);
     923        return Collections.unmodifiableCollection(dataSources);
    931924    }
    932925
     
    13281321    }
    13291322
    1330     @Override
    1331     public List<Bounds> getDataSourceBounds() {
    1332         return DataSource.getDataSourceBounds(dataSources);
    1333     }
    1334 
    13351323    /**
    13361324     * Moves all primitives and datasources from DataSet "from" to this DataSet.
Note: See TracChangeset for help on using the changeset viewer.