public static class CollectionUtils.SortTokensByDistance
extends Object
implements Comparator<SectorEntityToken>
Comparator
that sorts SectorEntityToken
s by distance
the Vector2f
passed into the constructor.
Constructor and Description |
---|
SortTokensByDistance(Vector2f location) |
SortTokensByDistance(Vector2f location,
boolean includeRadius) |
Modifier and Type | Method and Description |
---|---|
int |
compare(SectorEntityToken o1,
SectorEntityToken o2)
Compares the distances of two
SectorEntityToken s from a
central location. |
public SortTokensByDistance(Vector2f location, boolean includeRadius)
location
- The central location to judge distance from.includeRadius
- Whether to include collision radius in the
check.
public SortTokensByDistance(Vector2f location)
location
- The central location to judge distance from.
public int compare(SectorEntityToken o1, SectorEntityToken o2)
SectorEntityToken
s from a
central location.compare
in interface Comparator<SectorEntityToken>
o1
- The first SectorEntityToken
.o2
- The second SectorEntityToken
.
o1
and o2
from location
.