org.placelab.client.tracker
Class Tracker

java.lang.Object
  extended byorg.placelab.client.tracker.Tracker
All Implemented Interfaces:
SpotterListener
Direct Known Subclasses:
BeaconTracker, CentroidTrackerExample, CompoundTracker, HamsterTracker, PositionTracker, SmoothingTracker, StationaryPositionTracker

public abstract class Tracker
extends java.lang.Object
implements SpotterListener

A Tracker takes Measurement objects and then uses them to produce an Estimate. A Measurement is the result of the sensory operation, and the Tracker is the brain that turns the sensation into a location estimate.


Constructor Summary
Tracker()
           
 
Method Summary
abstract  boolean acceptableMeasurement(Measurement m)
          Returns true if the tracker can make use of this reading to meaningfully update the estimate.
 void addEstimateListener(EstimateListener listener)
          Register an EstimateListener to be notified when this tracker is updated.
protected  void fireEstimateUpdate(Measurement m)
          When subclasses have a new estimate they can use this to notify their EstimateListener objects.
abstract  Estimate getEstimate()
           
 long getLastUpdatedTime()
           
 void gotMeasurement(Spotter sender, Measurement m)
           
 int numberOfMeasurements()
           
 void removeEstimateListener(EstimateListener listener)
           
 void reset()
          This method resets the tracker to its initial state.
protected abstract  void resetImpl()
          Subclasses should implement this to reset themselves to their initial state.
 void spotterExceptionThrown(Spotter s, SpotterException ex)
           
 void updateEstimate(Measurement m)
          Called to give the tracker a new measurement.
protected abstract  void updateEstimateImpl(Measurement m)
          Subclasses should implement this to do the actual work of updating their Estimate with the given Measurement.
abstract  void updateWithoutMeasurement(long timeSinceMeasurementMillis)
          This method notifies a tracker that time has elapsed without a new mesurement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tracker

public Tracker()
Method Detail

updateEstimateImpl

protected abstract void updateEstimateImpl(Measurement m)
Subclasses should implement this to do the actual work of updating their Estimate with the given Measurement.

Parameters:
m - use this to update your Estimate

getEstimate

public abstract Estimate getEstimate()
Returns:
The Tracker's latest Estimate

acceptableMeasurement

public abstract boolean acceptableMeasurement(Measurement m)
Returns true if the tracker can make use of this reading to meaningfully update the estimate.


updateWithoutMeasurement

public abstract void updateWithoutMeasurement(long timeSinceMeasurementMillis)
This method notifies a tracker that time has elapsed without a new mesurement. This gives the tracker a chance to update its estimate to account for predicted motion.


resetImpl

protected abstract void resetImpl()
Subclasses should implement this to reset themselves to their initial state.


reset

public void reset()
This method resets the tracker to its initial state.


getLastUpdatedTime

public long getLastUpdatedTime()
Returns:
the time that the Tracker was last asked to update, either with or without a Measurement

addEstimateListener

public void addEstimateListener(EstimateListener listener)
Register an EstimateListener to be notified when this tracker is updated. Trackers may have multiple EstimateListeners registered and all of them will be notified when the Tracker has a new Estimate.

Parameters:
listener - an object to be notified when the Tracker has a new Estimate

removeEstimateListener

public void removeEstimateListener(EstimateListener listener)

updateEstimate

public void updateEstimate(Measurement m)
Called to give the tracker a new measurement.

Parameters:
m - A measurement from a Spotter.
See Also:
acceptableMeasurement(Measurement)

fireEstimateUpdate

protected void fireEstimateUpdate(Measurement m)
When subclasses have a new estimate they can use this to notify their EstimateListener objects.

Parameters:
m - the most recent Measurement influencing the update or null if updateWithoutMeasurement was called
See Also:
updateWithoutMeasurement(long)

numberOfMeasurements

public int numberOfMeasurements()
Returns:
the number of Measurement objects passed to updateEstimate since the creation, or reset, of the Tracker.
See Also:
updateEstimate(Measurement), reset()

gotMeasurement

public void gotMeasurement(Spotter sender,
                           Measurement m)
Specified by:
gotMeasurement in interface SpotterListener

spotterExceptionThrown

public void spotterExceptionThrown(Spotter s,
                                   SpotterException ex)
Specified by:
spotterExceptionThrown in interface SpotterListener