stella
Class DataEvent

java.lang.Object
  extended by java.util.EventObject
      extended by util.rmi.RmiEvent
          extended by stella.DataEvent
All Implemented Interfaces:
Serializable, PostingEvent
Direct Known Subclasses:
RawDataEvent

public class DataEvent
extends RmiEvent
implements PostingEvent

This class defines a generic data event. A single data point will at least consist of the time of the measurement and the measured datum. In this class, the primary data type is not defined, therefore we asume that it can be described by an object type. A validity identifier is also present and can be set. Further subclasses can add additional data, like an error estimate or simply a duration of the measurement, outer observing conditions and so forth.

See Also:
Serialized Form

Field Summary
protected static DateFormat FORMAT
          The Time formatter.
private  Object measurement
          The mesured value.
private  Date timeofmeasure
          The date when the data event occured.
private  boolean valid
          Whether the data is valid.
 
Fields inherited from class util.rmi.RmiEvent
localHost, sourceName
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
  DataEvent(DataEvent copy)
          Constructs a fully qualified DataEvent.
protected DataEvent(Object src)
          Protected constructor for data events where only the source is specified.
 
Method Summary
 Object getMeasurement()
          Gets the measurement.
 Date getTimeOfMeasure()
          Returns the date when the measurement was taken.
 boolean isValid()
          Returns true if the data is valid.
 void setMeasurement(Object what)
          Sets the measurement.
 void setTimeOfMeasure(Date time)
          Sets the date of the measurement and its duration.
 void setValid(boolean good)
          Sets the validity of the data.
 String toString()
          Returns a String representation of this data event.
 
Methods inherited from class util.rmi.RmiEvent
getHost, getSourceName, setSourceName
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMAT

protected static final DateFormat FORMAT
The Time formatter.


timeofmeasure

private Date timeofmeasure
The date when the data event occured.


measurement

private Object measurement
The mesured value.


valid

private boolean valid
Whether the data is valid.

Constructor Detail

DataEvent

protected DataEvent(Object src)
Protected constructor for data events where only the source is specified. The time of measurement, the data and the validity must be set separately.


DataEvent

public DataEvent(DataEvent copy)
Constructs a fully qualified DataEvent. Subclasses should provide a similar constructor to allow chaining of data event construction.

Method Detail

setTimeOfMeasure

public void setTimeOfMeasure(Date time)
Sets the date of the measurement and its duration. The date is normally the average of the individual dates of all constituting measurements while the duration is the time of the last measurment minus the time of the first one.
This method should be called on each data event generated, otherwise the construction time is used.


getTimeOfMeasure

public final Date getTimeOfMeasure()
Returns the date when the measurement was taken. This date is normally the average of the individual dates of all constituting measurements.


setMeasurement

public void setMeasurement(Object what)
Sets the measurement.


getMeasurement

public Object getMeasurement()
Gets the measurement.


setValid

public void setValid(boolean good)
Sets the validity of the data.


isValid

public boolean isValid()
Returns true if the data is valid.


toString

public String toString()
Returns a String representation of this data event. It contains all possibly available data, even if set invalid.

Overrides:
toString in class RmiEvent