@@ -470,61 +470,61 @@ public List<Unit> getUnitsInRectangle(final int left, final int top, final int r
470470 return getUnitsInRectangle (left , top , right , bottom , u -> true );
471471 }
472472
473- public List <Unit > getUnitsInRectangle (final int left , final int top , final int right , final int bottom , final UnitFilter filter ) {
473+ 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 () && filter . operation (u ))
475+ left <= u .getRight () && top <= u .getBottom () && right >= u .getLeft () && bottom >= u .getTop () && pred . test (u ))
476476 .collect (Collectors .toList ());
477477 }
478478
479479 public List <Unit > getUnitsInRectangle (final Position leftTop , final Position rightBottom ) {
480480 return getUnitsInRectangle (leftTop .x , leftTop .y , rightBottom .x , rightBottom .y , u -> true );
481481 }
482482
483- public List <Unit > getUnitsInRectangle (final Position leftTop , final Position rightBottom , final UnitFilter filter ) {
484- return getUnitsInRectangle (leftTop .x , leftTop .y , rightBottom .x , rightBottom .y , filter );
483+ public List <Unit > getUnitsInRectangle (final Position leftTop , final Position rightBottom , final UnitFilter pred ) {
484+ return getUnitsInRectangle (leftTop .x , leftTop .y , rightBottom .x , rightBottom .y , pred );
485485 }
486486
487487 public List <Unit > getUnitsInRadius (final int x , final int y , final int radius ) {
488488 return getUnitsInRadius (x , y , radius , u -> true );
489489 }
490490
491- public List <Unit > getUnitsInRadius (final int x , final int y , final int radius , final UnitFilter filter ) {
492- return getUnitsInRadius (new Position (x , y ), radius , filter );
491+ public List <Unit > getUnitsInRadius (final int x , final int y , final int radius , final UnitFilter pred ) {
492+ return getUnitsInRadius (new Position (x , y ), radius , pred );
493493 }
494494
495495 public List <Unit > getUnitsInRadius (final Position center , final int radius ) {
496496 return getUnitsInRadius (center , radius , u -> true );
497497 }
498498
499- public List <Unit > getUnitsInRadius (final Position center , final int radius , final UnitFilter filter ) {
499+ 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 && filter . operation (u ))
501+ .filter (u -> center .getApproxDistance (u .getPosition ()) <= radius && pred . test (u ))
502502 .collect (Collectors .toList ());
503503 }
504504
505505 public Unit getClosestUnitInRectangle (final Position center , final int left , final int top , final int right , final int bottom ) {
506506 return getClosestUnitInRectangle (center , left , top , right , bottom , u -> true );
507507 }
508508
509- public Unit getClosestUnitInRectangle (final Position center , final int left , final int top , final int right , final int bottom , final UnitFilter filter ) {
510- return getUnitsInRectangle (left , top , right , bottom , filter ).stream ()
509+ public Unit getClosestUnitInRectangle (final Position center , final int left , final int top , final int right , final int bottom , final UnitFilter pred ) {
510+ return getUnitsInRectangle (left , top , right , bottom , pred ).stream ()
511511 .min (Comparator .comparingInt (u -> u .getDistance (center ))).orElse (null );
512512 }
513513
514514 public Unit getClosestUnit (final Position center ) {
515515 return getClosestUnit (center , 999999 );
516516 }
517517
518- public Unit getClosestUnit (final Position center , final UnitFilter filter ) {
519- return getClosestUnit (center , 999999 , filter );
518+ public Unit getClosestUnit (final Position center , final UnitFilter pred ) {
519+ return getClosestUnit (center , 999999 , pred );
520520 }
521521
522522 public Unit getClosestUnit (final Position center , final int radius ) {
523523 return getClosestUnit (center , radius , u -> true );
524524 }
525525
526- public Unit getClosestUnit (final Position center , final int radius , final UnitFilter filter ) {
527- return getUnitsInRadius (center , radius , filter ).stream ()
526+ public Unit getClosestUnit (final Position center , final int radius , final UnitFilter pred ) {
527+ return getUnitsInRadius (center , radius , pred ).stream ()
528528 .min (Comparator .comparingInt (u -> u .getDistance (center ))).orElse (null );
529529 }
530530
0 commit comments