net.agmodel.weatherData
Class ScalarImpl

java.lang.Object
  extended bynet.agmodel.physical.GeneralSequenceImpl
      extended bynet.agmodel.weatherData.GeneralMetSequenceImpl
          extended bynet.agmodel.weatherData.ScalarImpl
All Implemented Interfaces:
Cloneable, CompoundSequence, MetSequence, Sequence, Serializable
Direct Known Subclasses:
AirTempSingleImpl, LeafWetnessSingleImpl, WaterTempSingleImpl

public abstract class ScalarImpl
extends GeneralMetSequenceImpl
implements Cloneable

Manages a sequence of scalar values.

Author:
Matthew Laurenson
See Also:
Serialized Form

Constructor Summary
ScalarImpl(MetElement element, Interval dateRange, SummaryHistory composition, double measurementHeight, String label)
          Creates a scalar sequence.
ScalarImpl(MetElement element, Interval dateRange, SummaryHistory composition, String label)
          Creates a scalar sequence.
 
Method Summary
 Object clone()
           
 JigsawQuantity getAverage(Interval interval)
          Returns the average temperature over the interval.
 String getContentsAsString(Date time, String delimiter)
          Returns the measurement associated with a particular time as a string.
 float[] getCoverage(int index)
          Indicates which array elements returned by getData(int) are missing.
 double[] getData(int index)
          Creates a one-dimensional array containing one subcomponent of the data.
 JigsawQuantity getInstant(Date time)
          Returns the instantaneous value at a particular point in time.
 JigsawQuantity getMaximum(Interval interval)
          Returns the maximum value over the interval.
 double getMeasurementHeight()
           
 JigsawQuantity getMinimum(Interval interval)
          Returns the minimum value over the interval.
 int getNumberOfSubComponents()
          Get the number of sub-components in the sequence.
 String getSubHeading(int index)
          Returns the subheading by looking up the corresponding key in WeatherDataResources
 void putInstantValue(Date time, float value)
          Records the instantaneous value at a particular time
 void putValueOverInterval(Interval interval, float value)
          Records the average value over some subinterval.
 void setSubHeading(int index, String aHeading)
          Does nothing
 
Methods inherited from class net.agmodel.weatherData.GeneralMetSequenceImpl
getColumnHeading, getName, getSequenceElement, getSequenceHeading, getUnitsHeading, setColumnHeading, setName, setSequenceHeading, setUnitsHeading
 
Methods inherited from class net.agmodel.physical.GeneralSequenceImpl
cancelTemporalInterpolation, dumpSequence, getAllCoverage, getAllData, getCurrentResolution, getDateRange, getMaximumTemporalInterpolation, getResolution, getSubHeading, getSummaryHistory, getSummaryKind, getTemporalInterpolation, getUnitsHeading, setTemporalInterpolation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.agmodel.weatherData.MetSequence
summarize
 
Methods inherited from interface net.agmodel.physical.CompoundSequence
cancelTemporalInterpolation, getAllCoverage, getAllData, getMaximumTemporalInterpolation, getTemporalInterpolation, setTemporalInterpolation
 
Methods inherited from interface net.agmodel.physical.Sequence
dumpSequence, getCurrentResolution, getDateRange, getResolution, getSubHeading, getSummaryKind, getUnitsHeading
 

Constructor Detail

ScalarImpl

public ScalarImpl(MetElement element,
                  Interval dateRange,
                  SummaryHistory composition,
                  double measurementHeight,
                  String label)
Creates a scalar sequence.

Parameters:
dateRange - the interval for which values are stored
composition - a record of how raw data has been summarised to make the sequence.
measurementHeight - the height in metres;

ScalarImpl

public ScalarImpl(MetElement element,
                  Interval dateRange,
                  SummaryHistory composition,
                  String label)
Creates a scalar sequence. This constructor uses the default height for temperature measurements.

Parameters:
dateRange - the interval for which values are stored
composition - a record of how raw data has been summarised to make the sequence.
Method Detail

putInstantValue

public void putInstantValue(Date time,
                            float value)
Records the instantaneous value at a particular time

Parameters:
time - the point in time
value - the value at that time
Throws:
IllegalArgumentException - if the time is outside the interval that the period is intended to store

putValueOverInterval

public void putValueOverInterval(Interval interval,
                                 float value)
Records the average value over some subinterval.

Parameters:
interval - the period of time over which the measurement was taken.
value - the average value over that interval
Throws:
IllegalArgumentException - if the subinterval is outside the interval that the sequence was constructed to store

getMinimum

public JigsawQuantity getMinimum(Interval interval)
Returns the minimum value over the interval. Temperatures at either end of the interval are included in the comparison if more than 50% of their duration lies within the interval of interest.

Returns:
the minimum value

getMaximum

public JigsawQuantity getMaximum(Interval interval)
Returns the maximum value over the interval. Sequence values at either end of the interval are included in the comparison if more than 50% of their duration lies within the interval of interest.

Returns:
the maximum value

getInstant

public JigsawQuantity getInstant(Date time)
Returns the instantaneous value at a particular point in time. If interpolation is requested, the value may be spatially and/or temporally interpolated from other data.

Returns:
the instantaneous value

getAverage

public JigsawQuantity getAverage(Interval interval)
Returns the average temperature over the interval. Temperatures at either end of the interval are included by weighting their values according to the proportion of their duration that lies in the period of interest.

Returns:
the average value

getContentsAsString

public String getContentsAsString(Date time,
                                  String delimiter)
Description copied from interface: Sequence
Returns the measurement associated with a particular time as a string. Used by dumpSequence.

Specified by:
getContentsAsString in interface Sequence
Specified by:
getContentsAsString in class GeneralSequenceImpl

getMeasurementHeight

public double getMeasurementHeight()

getNumberOfSubComponents

public int getNumberOfSubComponents()
Description copied from interface: Sequence
Get the number of sub-components in the sequence. This indicates how many "columns" the sequence output will occupy.

Specified by:
getNumberOfSubComponents in interface Sequence
Specified by:
getNumberOfSubComponents in class GeneralMetSequenceImpl

getSubHeading

public String getSubHeading(int index)
Returns the subheading by looking up the corresponding key in WeatherDataResources

Specified by:
getSubHeading in interface CompoundSequence
Specified by:
getSubHeading in class GeneralMetSequenceImpl

setSubHeading

public void setSubHeading(int index,
                          String aHeading)
Does nothing

Specified by:
setSubHeading in interface CompoundSequence
Specified by:
setSubHeading in class GeneralMetSequenceImpl

getData

public double[] getData(int index)
Description copied from interface: CompoundSequence
Creates a one-dimensional array containing one subcomponent of the data. Use CompoundSequence.getCoverage(int) to test for missing values (at present these are returned as Double.NaN but don't rely on this).
Note that the first element of the array corresponds to getStart() and is therefore empty in most cases.

Specified by:
getData in interface CompoundSequence
Specified by:
getData in class GeneralSequenceImpl

getCoverage

public float[] getCoverage(int index)
Description copied from interface: CompoundSequence
Indicates which array elements returned by CompoundSequence.getData(int) are missing. Coverage values are in the range JigsawQuantity.DEVOID to JigsawQuantity.COMPLETE.
Note that the first element of the array corresponds to getStart() and is therefore empty in most cases.

Specified by:
getCoverage in interface CompoundSequence
Specified by:
getCoverage in class GeneralSequenceImpl

clone

public Object clone()
Specified by:
clone in interface Sequence
Overrides:
clone in class GeneralSequenceImpl


Copyright (C) NARC 2001 All Rights Reserved.