Skip to content

Commit ad4fdff

Browse files
committed
use predicate for filters and put them in the UnitFilter 'namespace'
1 parent b9eafa5 commit ad4fdff

File tree

4 files changed

+358
-357
lines changed

4 files changed

+358
-357
lines changed

src/main/java/bwapi/Filter.java

Lines changed: 0 additions & 334 deletions
This file was deleted.

src/main/java/bwapi/Game.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public List<Unit> getUnitsInRectangle(final int left, final int top, final int r
472472

473473
public List<Unit> getUnitsInRectangle(final int left, final int top, final int right, final int bottom, final UnitFilter pred) {
474474
return getAllUnits().stream().filter(u ->
475-
left <= u.getRight() && top <= u.getBottom() && right >= u.getLeft() && bottom >= u.getTop() && pred.filter(u))
475+
left <= u.getRight() && top <= u.getBottom() && right >= u.getLeft() && bottom >= u.getTop() && pred.test(u))
476476
.collect(Collectors.toList());
477477
}
478478

@@ -498,7 +498,7 @@ public List<Unit> getUnitsInRadius(final Position center, final int radius) {
498498

499499
public List<Unit> getUnitsInRadius(final Position center, final int radius, final UnitFilter pred) {
500500
return getAllUnits().stream()
501-
.filter(u -> center.getApproxDistance(u.getPosition()) <= radius && pred.filter(u))
501+
.filter(u -> center.getApproxDistance(u.getPosition()) <= radius && pred.test(u))
502502
.collect(Collectors.toList());
503503
}
504504

0 commit comments

Comments
 (0)