public class DangerCloseCalculator
extends java.lang.Object
implements java.lang.Runnable, android.content.SharedPreferences.OnSharedPreferenceChangeListener
Modifier and Type | Class and Description |
---|---|
static interface |
DangerCloseCalculator.ClosestItemListener
Listener to be notified of closest item for a given point/hostile
|
static interface |
DangerCloseCalculator.CustomFilter |
static class |
DangerCloseCalculator.DangerCloseAlert
Store information about an item that is "danger close" to a given hostile
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
static java.util.List<DangerCloseCalculator.DangerCloseAlert> |
find(PointMapItem target,
double range)
Obtain a list of all friendlies in the area that are within the specified range of the target
Also track the closest friendly
|
java.util.List<DangerCloseCalculator.DangerCloseAlert> |
getAlerts()
Get list of Danger Close alerts
|
static DangerCloseCalculator |
getInstance() |
void |
onSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences,
java.lang.String key) |
void |
registerListener(DangerCloseCalculator.ClosestItemListener icl,
MapItem hostile)
Register listener for updates on closest items to 'hostile'
E.g.
|
void |
run()
Thread, runs periodically to monitor list of hostiles for danger close
Alerts the corresponding listener, and notifies WarningComponent
|
void |
setCustomFilter(DangerCloseCalculator.CustomFilter filter)
Sets a custom filter for the DangerClose calculator.
|
void |
start()
Kickoff monitoring thread
|
void |
unregisterListener(DangerCloseCalculator.ClosestItemListener icl) |
public static final java.lang.String TAG
public void onSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences, java.lang.String key)
onSharedPreferenceChanged
in interface android.content.SharedPreferences.OnSharedPreferenceChangeListener
public void start()
public static DangerCloseCalculator getInstance()
public void cancel()
public void registerListener(DangerCloseCalculator.ClosestItemListener icl, MapItem hostile)
icl
- closest item listener for callbackhostile
- the hostile that is used for the closest item.public void unregisterListener(DangerCloseCalculator.ClosestItemListener icl)
public void setCustomFilter(DangerCloseCalculator.CustomFilter filter)
filter
- the filter to be used.public java.util.List<DangerCloseCalculator.DangerCloseAlert> getAlerts()
public void run()
run
in interface java.lang.Runnable
public static java.util.List<DangerCloseCalculator.DangerCloseAlert> find(PointMapItem target, double range)
target
- the point o begin measuring from.range
- the range of items within a specific point