public abstract class FeatureDetectorAdapter extends java.lang.Object implements FeatureDetector
| Modifier and Type | Class and Description |
|---|---|
private class |
FeatureDetectorAdapter.MonitorThread
Thread to monitor the range finder.
|
| Modifier and Type | Field and Description |
|---|---|
private int |
delay |
private boolean |
enabled |
private java.util.ArrayList<FeatureListener> |
listeners |
| Constructor and Description |
|---|
FeatureDetectorAdapter(int delay) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(FeatureListener l)
Adds a listener to the FeatureDetector.
|
void |
enableDetection(boolean enable)
Enable or disable detection of objects.
|
int |
getDelay()
The minimum delay between notification of readings from the feature detector.
|
boolean |
isEnabled()
Indicates if automatic scanning mode and listener notification is currently enabled.
|
protected void |
notifyListeners(Feature feature) |
abstract Feature |
scan()
Performs a single scan for an object and returns the results.
|
void |
setDelay(int delay)
Sets the minimum delay between readings from the feature detector.
|
private java.util.ArrayList<FeatureListener> listeners
private boolean enabled
private int delay
public void addListener(FeatureListener l)
FeatureDetectoraddListener in interface FeatureDetectorl - The FeatureListener that is notified every time a feature is detected.public void enableDetection(boolean enable)
FeatureDetectorenableDetection in interface FeatureDetectorenable - true enables detection and notifications, false disables this class until it is enabled again.public boolean isEnabled()
FeatureDetectorisEnabled in interface FeatureDetectorpublic int getDelay()
FeatureDetectorgetDelay in interface FeatureDetectorpublic void setDelay(int delay)
FeatureDetectorsetDelay in interface FeatureDetectordelay - The FeatureDetector will return one new set of readings every delay milliseconds.protected void notifyListeners(Feature feature)
public abstract Feature scan()
FeatureDetectorPerforms a single scan for an object and returns the results. If an object is not detected, this method returns null.
Warning: Make sure to check for a null object before trying to read data from the returned Feature object, otherwise your code will throw a null pointer exception.
scan in interface FeatureDetector