Skip to content

Commit

Permalink
make byOSHEntity filters a bit sharper
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Jun 1, 2021
1 parent 2027b72 commit c8af432
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ public interface Filter extends FilterExpression {
* @return a filter object which filters using the given predicate
*/
static Filter byOSHEntity(OSHEntityFilter oshCallback) {
return by(oshCallback, ignored -> true);
return new NegatableFilter(new FilterInternal() {
@Override
public boolean applyOSM(OSMEntity entity) {
return true;
}

@Override
public boolean applyOSH(OSHEntity entity) {
return oshCallback.test(entity);
}

@Override
boolean applyOSHNegated(OSHEntity entity) {
return !oshCallback.test(entity);
}
});
}

/**
Expand Down

0 comments on commit c8af432

Please sign in to comment.