Changeset 5441 in josm


Ignore:
Timestamp:
2012-08-13T09:05:30+02:00 (12 years ago)
Author:
bastiK
Message:

remove duplicate class

File:
1 edited

Legend:

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

    r5360 r5441  
    4747import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    4848import org.openstreetmap.josm.tools.GBC;
     49import org.openstreetmap.josm.tools.Predicate;
    4950import org.openstreetmap.josm.tools.Property;
    5051import org.openstreetmap.josm.tools.Shortcut;
     
    474475    }
    475476
    476     public interface Function{
    477         public Boolean isSomething(OsmPrimitive o);
    478     }
    479 
    480     public static int getSelection(SearchSetting s, Collection<OsmPrimitive> sel, Function f) {
     477    public static int getSelection(SearchSetting s, Collection<OsmPrimitive> sel, Predicate<OsmPrimitive> p) {
    481478        int foundMatches = 0;
    482479        try {
     
    500497                        ++foundMatches;
    501498                    }
    502                 } else if (s.mode == SearchMode.add && !f.isSomething(osm) && matcher.match(osm)) {
     499                } else if (s.mode == SearchMode.add && !p.evaluate(osm) && matcher.match(osm)) {
    503500                    sel.add(osm);
    504501                    ++foundMatches;
    505                 } else if (s.mode == SearchMode.remove && f.isSomething(osm) && matcher.match(osm)) {
     502                } else if (s.mode == SearchMode.remove && p.evaluate(osm) && matcher.match(osm)) {
    506503                    sel.remove(osm);
    507504                    ++foundMatches;
    508                 } else if (s.mode == SearchMode.in_selection &&  f.isSomething(osm)&& !matcher.match(osm)) {
     505                } else if (s.mode == SearchMode.in_selection &&  p.evaluate(osm) && !matcher.match(osm)) {
    509506                    sel.remove(osm);
    510507                    ++foundMatches;
     
    570567
    571568    public static void search(SearchSetting s) {
    572         // FIXME: This is confusing. The GUI says nothing about loading primitives from an URL. We'd like to *search*
    573         // for URLs in the current data set.
    574         // Disabling until a better solution is in place
    575         //
    576         //        if (search.startsWith("http://") || search.startsWith("ftp://") || search.startsWith("https://")
    577         //                || search.startsWith("file:/")) {
    578         //            SelectionWebsiteLoader loader = new SelectionWebsiteLoader(search, mode);
    579         //            if (loader.url != null && loader.url.getHost() != null) {
    580         //                Main.worker.execute(loader);
    581         //                return;
    582         //            }
    583         //        }
    584569
    585570        final DataSet ds = Main.main.getCurrentDataSet();
    586571        Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>(ds.getAllSelected());
    587         int foundMatches = getSelection(s, sel, new Function(){
    588             public Boolean isSomething(OsmPrimitive o){
     572        int foundMatches = getSelection(s, sel, new Predicate<OsmPrimitive>(){
     573            @Override
     574            public boolean evaluate(OsmPrimitive o){
    589575                return ds.isSelected(o);
    590576            }
Note: See TracChangeset for help on using the changeset viewer.