uwcse.location.core
Class Measurement

java.lang.Object
  |
  +--uwcse.location.core.Measurement
Direct Known Subclasses:
AngleMeasurement, LinearDistanceMeasurement, MapMeasurement, PlanarSweepMeasurement, ProximityMeasurement, TrueStateMeasurement

public class Measurement
extends Object

The Measurement class is a generic class from which the fundamental location measurements types inherit. It provides a timestamp and sensor and object names.

Version:
$Revision: 1.4 $
Author:
Jeffrey Hightower

Nested Class Summary
static class Measurement.TimestampComparator
          This class provides a comparator ordered by the timestamps of measurements, for example, in order to sort a list of Measurment objects by their timestamps.
 
Field Summary
protected  String m_objectName
           
protected  String m_sensorName
           
protected  long m_timestamp
           
 
Constructor Summary
Measurement()
          Construct a Measurement with an empty string for the object and sensor names and a timestamp assigned by reading the system clock.
Measurement(String objectName, String sensorName)
          Construct a Measurement with the given object and sensor names with the timestamp assigned by reading the system clock.
Measurement(Measurement meas)
          Construct a Measurement as a copy of the given Measurement object.
 
Method Summary
 Object clone()
          Perform a deep copy of this measurement.
 boolean equals(Object o)
          Test for semantic equality with another measurement.
 String getObjectName()
          Get the name of the physical object that this measurment was made of.
 String getSensorName()
          Get the name of the sensor that took this Measurement.
 long getTimestamp()
          Get the timestamp in milliseconds since epoch associated with this Measurement.
 int hashCode()
          Overridden to maintain hash contract that equal objects return the same hash code.
 void setObjectName(String objectName)
          Set the name of the physical object that this measurment was made of.
 void setSensorName(String sensorName)
          Set the name of the sensor taking this Measurement.
 void setTimestamp(long timestamp)
          Set the timestamp in milliseconds since epoch associated with this Measurement.
 String toString()
          Return a string representation of this Measurement.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_timestamp

protected long m_timestamp

m_objectName

protected String m_objectName

m_sensorName

protected String m_sensorName
Constructor Detail

Measurement

public Measurement()
Construct a Measurement with an empty string for the object and sensor names and a timestamp assigned by reading the system clock.


Measurement

public Measurement(String objectName,
                   String sensorName)
Construct a Measurement with the given object and sensor names with the timestamp assigned by reading the system clock.


Measurement

public Measurement(Measurement meas)
Construct a Measurement as a copy of the given Measurement object.

Method Detail

clone

public Object clone()
Perform a deep copy of this measurement.

Overrides:
clone in class Object

equals

public boolean equals(Object o)
Test for semantic equality with another measurement.

Overrides:
equals in class Object
Returns:
true if the object name, sensor name, and timestamp of both both Measurements are the same.

hashCode

public int hashCode()
Overridden to maintain hash contract that equal objects return the same hash code.

Overrides:
hashCode in class Object

toString

public String toString()
Return a string representation of this Measurement.

Overrides:
toString in class Object

getTimestamp

public long getTimestamp()
Get the timestamp in milliseconds since epoch associated with this Measurement.


setTimestamp

public void setTimestamp(long timestamp)
Set the timestamp in milliseconds since epoch associated with this Measurement.


getObjectName

public String getObjectName()
Get the name of the physical object that this measurment was made of.


setObjectName

public void setObjectName(String objectName)
Set the name of the physical object that this measurment was made of.


getSensorName

public String getSensorName()
Get the name of the sensor that took this Measurement.


setSensorName

public void setSensorName(String sensorName)
Set the name of the sensor taking this Measurement.



This documentation is for the Location Stack v0.8. The latest distribution, the documentation, and the list of contributors to the Location Stack can always be found at http://portolano.cs.washington.edu/projects/location/

© Copyright 2004 University of Washington CSE