Ignore:
Timestamp:
2016-08-03T15:01:43+02:00 (3 years ago)
Author:
simon04
Message:

see #11390, see #12890 - Deprecate Predicates class

File:
1 edited

Legend:

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

    r10657 r10715  
    1212import java.util.Set;
    1313import java.util.concurrent.CopyOnWriteArrayList;
    14 import java.util.function.Predicate;
    1514
    1615import org.openstreetmap.josm.data.osm.Node;
     
    4342    private final CopyOnWriteArrayList<IConflictListener> listeners;
    4443
    45     private static class FilterPredicate implements Predicate<Conflict<? extends OsmPrimitive>> {
    46 
    47         private final Class<? extends OsmPrimitive> c;
    48 
    49         FilterPredicate(Class<? extends OsmPrimitive> c) {
    50             this.c = c;
    51         }
    52 
    53         @Override
    54         public boolean test(Conflict<? extends OsmPrimitive> conflict) {
    55             return conflict != null && c.isInstance(conflict.getMy());
    56         }
    57     }
    58 
    59     private static final FilterPredicate NODE_FILTER_PREDICATE = new FilterPredicate(Node.class);
    60     private static final FilterPredicate WAY_FILTER_PREDICATE = new FilterPredicate(Way.class);
    61     private static final FilterPredicate RELATION_FILTER_PREDICATE = new FilterPredicate(Relation.class);
    62 
    6344    /**
    6445     * Constructs a new {@code ConflictCollection}.
     
    364345     */
    365346    public final Collection<Conflict<? extends OsmPrimitive>> getNodeConflicts() {
    366         return SubclassFilteredCollection.filter(conflicts, NODE_FILTER_PREDICATE);
     347        return SubclassFilteredCollection.filter(conflicts, c -> c != null && c.getMy() instanceof Node);
    367348    }
    368349
     
    373354     */
    374355    public final Collection<Conflict<? extends OsmPrimitive>> getWayConflicts() {
    375         return SubclassFilteredCollection.filter(conflicts, WAY_FILTER_PREDICATE);
     356        return SubclassFilteredCollection.filter(conflicts, c -> c != null && c.getMy() instanceof Way);
    376357    }
    377358
     
    382363     */
    383364    public final Collection<Conflict<? extends OsmPrimitive>> getRelationConflicts() {
    384         return SubclassFilteredCollection.filter(conflicts, RELATION_FILTER_PREDICATE);
     365        return SubclassFilteredCollection.filter(conflicts, c -> c != null && c.getMy() instanceof Relation);
    385366    }
    386367
Note: See TracChangeset for help on using the changeset viewer.