org.placelab.spotter
Class LogSpotter

java.lang.Object
  extended byorg.placelab.spotter.AbstractSpotter
      extended byorg.placelab.spotter.SyncSpotter
          extended byorg.placelab.spotter.LogSpotter
All Implemented Interfaces:
Spotter
Direct Known Subclasses:
NetStumblerFileParser, NetStumblerLogSpotter, OldPlacelabStumblerLogSpotter, PlacelabStumblerLogSpotter

public abstract class LogSpotter
extends SyncSpotter

LogSpotters are Spotters that replay stored Measurements from log files.


Field Summary
static int NO_DELAY
           
 
Constructor Summary
LogSpotter()
           
 
Method Summary
abstract  Measurement getMeasurementFromLog()
          Returns a single Measurement from the log, or null if there are no Measurements remaining.
protected  Measurement getMeasurementImpl()
          Collects and returns a single Measurement.
 int getRate()
           
 boolean logIsFinished()
           
static LogSpotter newSpotter(java.lang.String logName)
          Creates a new LogSpotter from the given log file, the type of log is recognized and the correct LogSpotter for the file is returned.
protected  long nextScanInterval()
           
 void setRate(int percentage)
          For doing continous scanning, set the rate at which the Measurements should be sent off to registered SpotterListener objects as a percentage of real-time.
 
Methods inherited from class org.placelab.spotter.SyncSpotter
errorInBackgroundThreadAndThreadDeath, getMeasurement, scanUsingBackgroundThread, scanUsingEventSystem, startScanning, startScanning, stopScanning
 
Methods inherited from class org.placelab.spotter.AbstractSpotter
addListener, notifyEndOfScan, notifyEndOfScan, notifyGotException, notifyGotException, notifyGotMeasurement, notifyGotMeasurement, removeListener, scanOnce, scanOnce, waitForThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.placelab.spotter.Spotter
close, open
 

Field Detail

NO_DELAY

public static final int NO_DELAY
See Also:
Constant Field Values
Constructor Detail

LogSpotter

public LogSpotter()
Method Detail

newSpotter

public static LogSpotter newSpotter(java.lang.String logName)
Creates a new LogSpotter from the given log file, the type of log is recognized and the correct LogSpotter for the file is returned. Currently, this method supports LogSpotters for the following formats:


getMeasurementImpl

protected Measurement getMeasurementImpl()
                                  throws SpotterException
Description copied from class: SyncSpotter
Collects and returns a single Measurement.

Specified by:
getMeasurementImpl in class SyncSpotter
Throws:
SpotterException

nextScanInterval

protected long nextScanInterval()
Specified by:
nextScanInterval in class SyncSpotter
Returns:
the interval that the spotter should wait before invoking the next scan

logIsFinished

public boolean logIsFinished()
Returns:
true when a log file has no more Measurements remaining false if there still remain Measurements yet to be consumed. Calling Spotter.getMeasurement() consumes a single Measurement.

setRate

public void setRate(int percentage)
For doing continous scanning, set the rate at which the Measurements should be sent off to registered SpotterListener objects as a percentage of real-time.


getRate

public int getRate()

getMeasurementFromLog

public abstract Measurement getMeasurementFromLog()
                                           throws SpotterException
Returns a single Measurement from the log, or null if there are no Measurements remaining. This method is only of interest to implementers of LogSpotters, users should instead call Spotter.getMeasurement()

Throws:
SpotterException - if an error is encountered in the log