net.agmodel.physical
Class DataSetImpl

java.lang.Object
  extended bynet.agmodel.physical.DataSetImpl
All Implemented Interfaces:
DataSet, Serializable, ServerResult
Direct Known Subclasses:
StationDataSetImpl

public class DataSetImpl
extends Object
implements DataSet, Serializable

A serializable implementation of DataSet which uses a HashMap to store Sequences.

Version:
1.0
Author:
Matthew Laurenson
See Also:
Serialized Form

Constructor Summary
DataSetImpl(Interval interval, Duration resolution)
           
 
Method Summary
 void addSequence(Object key, Sequence sequenceToAdd)
           
 String dumpDuration(DateFormat df, String delimiter, String rowTerminator, String timeHeader, String noData)
          Returns a string representation of the entire data set
 Interval getInterval()
          Gets the interval covered by the data set
 int getNumberOfRows()
          Gets the number of rows of data based on the data set's duration and resolution
 int getNumberOfSequences()
          Gets the number of data sequences
 Duration getResolution()
          Gets the resolution of the station data set
 Sequence getSequence(Object key)
          Gets the data, if it exists, for a particular weather element.
 String toString()
          Returns a basic string representation of data set (without the actual data).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSetImpl

public DataSetImpl(Interval interval,
                   Duration resolution)
Method Detail

addSequence

public void addSequence(Object key,
                        Sequence sequenceToAdd)

getSequence

public Sequence getSequence(Object key)
Gets the data, if it exists, for a particular weather element.

Specified by:
getSequence in interface DataSet
Parameters:
key - an identifier for the required sequence.
Returns:
a concrete implementation of Sequence, or null if not data exists for that element.

toString

public String toString()
Returns a basic string representation of data set (without the actual data). See dumpDuration(java.text.DateFormat, java.lang.String, java.lang.String, java.lang.String, java.lang.String) for data output.

Returns:
a string containing the station details

getInterval

public Interval getInterval()
Description copied from interface: DataSet
Gets the interval covered by the data set

Specified by:
getInterval in interface DataSet
Returns:
the interval

getResolution

public Duration getResolution()
Gets the resolution of the station data set

Specified by:
getResolution in interface DataSet
Returns:
the resolution (eg hourly or daily)

getNumberOfRows

public int getNumberOfRows()
Gets the number of rows of data based on the data set's duration and resolution

Specified by:
getNumberOfRows in interface DataSet
Returns:
the number of rows

getNumberOfSequences

public int getNumberOfSequences()
Gets the number of data sequences

Specified by:
getNumberOfSequences in interface DataSet
Returns:
the number of sequences

dumpDuration

public String dumpDuration(DateFormat df,
                           String delimiter,
                           String rowTerminator,
                           String timeHeader,
                           String noData)
Description copied from interface: DataSet
Returns a string representation of the entire data set

Specified by:
dumpDuration in interface DataSet
Parameters:
df - a DateFormat to use for the dates and times
delimiter - the delimiter to put between the data items
rowTerminator - the string to use at the end of each row
timeHeader - a string to head the date/time column
noData - a string to show when there is no data
Returns:
a table of data, with colunn headings, and the first column being a date/time.


Copyright (C) NARC 2001 All Rights Reserved.