org.placelab.spotter
Class LogSpotter
java.lang.Object
org.placelab.spotter.AbstractSpotter
org.placelab.spotter.SyncSpotter
org.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.
| 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 |
NO_DELAY
public static final int NO_DELAY
- See Also:
- Constant Field Values
LogSpotter
public LogSpotter()
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:
- NetStumbler text format (0.3.x and 0.4.x)
- NetStumbler binary format (0.3.x and 0.4.x)
- PlacelabStumbler log format (v 0, 1, 2)
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