Changeset 10658 in josm for trunk/src/org


Ignore:
Timestamp:
2016-07-27T02:16:37+02:00 (8 years ago)
Author:
Don-vip
Message:

see #11390, see #12890 - use Java 8 Predicates (forgot some)

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

Legend:

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

    r10601 r10658  
    2626import java.util.Objects;
    2727import java.util.Set;
     28import java.util.function.Predicate;
    2829
    2930import javax.swing.ButtonGroup;
     
    5455import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    5556import org.openstreetmap.josm.tools.GBC;
    56 import org.openstreetmap.josm.tools.Predicate;
    5757import org.openstreetmap.josm.tools.Shortcut;
    5858import org.openstreetmap.josm.tools.Utils;
     
    689689                            ++foundMatches;
    690690                        }
    691                     } else if (setting.mode == SearchMode.add && !predicate.evaluate(osm) && matcher.match(osm)) {
     691                    } else if (setting.mode == SearchMode.add && !predicate.test(osm) && matcher.match(osm)) {
    692692                        selection.add(osm);
    693693                        ++foundMatches;
    694                     } else if (setting.mode == SearchMode.remove && predicate.evaluate(osm) && matcher.match(osm)) {
     694                    } else if (setting.mode == SearchMode.remove && predicate.test(osm) && matcher.match(osm)) {
    695695                        selection.remove(osm);
    696696                        ++foundMatches;
    697                     } else if (setting.mode == SearchMode.in_selection && predicate.evaluate(osm) && !matcher.match(osm)) {
     697                    } else if (setting.mode == SearchMode.in_selection && predicate.test(osm) && !matcher.match(osm)) {
    698698                        selection.remove(osm);
    699699                        --foundMatches;
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r10378 r10658  
    55import java.util.Set;
    66import java.util.TreeSet;
     7import java.util.function.Predicate;
    78
    89import org.openstreetmap.josm.Main;
     
    1314import org.openstreetmap.josm.data.projection.Projections;
    1415import org.openstreetmap.josm.tools.CheckParameterUtil;
    15 import org.openstreetmap.josm.tools.Predicate;
    1616import org.openstreetmap.josm.tools.Utils;
    1717
     
    381381                    final boolean containsN = visited.contains(n);
    382382                    visited.add(n);
    383                     if (!containsN && (predicate == null || predicate.evaluate(n))
     383                    if (!containsN && (predicate == null || predicate.test(n))
    384384                            && n.isConnectedTo(otherNodes, hops - 1, predicate, visited)) {
    385385                        return true;
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r10656 r10658  
    888888     * @return {@code true} if the node is inside the multipolygon
    889889     */
    890     public static boolean isNodeInsideMultiPolygon(Node node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
     890    public static boolean isNodeInsideMultiPolygon(Node node, Relation multiPolygon, java.util.function.Predicate<Way> isOuterWayAMatch) {
    891891        return isPolygonInsideMultiPolygon(Collections.singletonList(node), multiPolygon, isOuterWayAMatch);
    892892    }
     
    902902     * @return {@code true} if the polygon formed by nodes is inside the multipolygon
    903903     */
    904     public static boolean isPolygonInsideMultiPolygon(List<Node> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
     904    public static boolean isPolygonInsideMultiPolygon(List<Node> nodes, Relation multiPolygon,
     905            java.util.function.Predicate<Way> isOuterWayAMatch) {
    905906        // Extract outer/inner members from multipolygon
    906907        final MultiPolygonMembers mpm = new MultiPolygonMembers(multiPolygon);
     
    936937                if (!insideInner) {
    937938                    // Final check using predicate
    938                     if (isOuterWayAMatch == null || isOuterWayAMatch.evaluate(out.ways.get(0)
     939                    if (isOuterWayAMatch == null || isOuterWayAMatch.test(out.ways.get(0)
    939940                            /* TODO give a better representation of the outer ring to the predicate */)) {
    940941                        return true;
Note: See TracChangeset for help on using the changeset viewer.