saaps.util2
Class TimeSeries

java.lang.Object
  |
  +--saaps.util2.TimeSeries
All Implemented Interfaces:
java.io.Serializable

public class TimeSeries
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
private  java.util.Calendar cal
           
private  double[][] data
           
private  java.util.Date[] dates
           
private  java.lang.String[] fieldNames
           
private  java.lang.String[] fieldUnits
           
static int HOUR
           
private  java.lang.String longDescription
           
static int MINUTE
           
private  NormParam[] normParam
           
private  int numOfData
           
private  int numOfDataFields
           
private  int numOfFields
           
static int SECOND
           
private  java.lang.String shortDescription
           
private static long[] timeFactor
           
private  java.util.TimeZone tz
           
 
Constructor Summary
TimeSeries(java.util.Date[] d, Data m)
           
TimeSeries(java.util.Date[] d, double[] m)
          Create a TimeSeries object from a Date vector and a double vector.
TimeSeries(java.util.Date[] d, double[][] m)
           
TimeSeries(java.util.Date[] d, double[] m, java.lang.String fn, java.lang.String fu)
          Create a TimeSeries object from a Date vector and a double vector, and specify the data field names and units.
TimeSeries(long st, long et, long si, int nodf)
          Create an empty time series object.
TimeSeries(TimeSeries ts)
           
TimeSeries(java.util.Vector dbov)
          Create a TimeSeries object from a Vector of DatabaseObject:s
 
Method Summary
 void addField(double[] x)
           
 double[] average(boolean ignoreNaN)
          Get the average of a time series object.
 TimeSeries extract(long st, long et)
          Extract a time period.
 double[][] getData()
          Get the data as a Matrix object.
 double[] getData(int i)
          Get the data for one row.
 double getData(int i, int j)
          Get one data element.
 java.util.Date getDate(int i)
          Get one Date object.
 java.util.Date[] getDates()
          Get the Date objects.
 int getLength()
          Get the length of the TimeSeries object.
 java.lang.String getLongDescription()
          Get the long description of the data.
 int getNumOfDataFields()
          Get the number of data fields.
 java.lang.String getShortDescription()
          Get the short description of the data.
 void interpolate()
           
static void main(java.lang.String[] argv)
           
 void normalize()
           
 void pow(double x, int field)
           
 void pow(int field, double x)
           
 void print()
           
 void resample(int offset, int step, int w1, int w2, int timeUnit)
          Average over the data fields.
private  java.util.Calendar setCalDay(java.util.Date d)
           
 void setData(int i, double[] x)
          Set one row of data.
 void setData(int i, int j, double x)
           
 void setLongDescription(java.lang.String ld)
          Set the long description of the data.
 void setNormParam(int field, double inMin, double inMax, double outMin, double outMax)
           
 void setShortDescription(java.lang.String sd)
          Set the short description of the data.
 TimeSeries toOldTimeSeries()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dates

private java.util.Date[] dates

data

private double[][] data

normParam

private NormParam[] normParam

numOfData

private int numOfData

numOfFields

private int numOfFields

numOfDataFields

private int numOfDataFields

tz

private java.util.TimeZone tz

cal

private java.util.Calendar cal

shortDescription

private java.lang.String shortDescription

longDescription

private java.lang.String longDescription

fieldNames

private java.lang.String[] fieldNames

fieldUnits

private java.lang.String[] fieldUnits

timeFactor

private static long[] timeFactor

SECOND

public static int SECOND

MINUTE

public static int MINUTE

HOUR

public static int HOUR
Constructor Detail

TimeSeries

public TimeSeries(TimeSeries ts)

TimeSeries

public TimeSeries(java.util.Date[] d,
                  double[] m)
Create a TimeSeries object from a Date vector and a double vector.
Parameters:
d - The dates.
m - The data.

TimeSeries

public TimeSeries(java.util.Date[] d,
                  double[][] m)

TimeSeries

public TimeSeries(java.util.Date[] d,
                  Data m)

TimeSeries

public TimeSeries(java.util.Date[] d,
                  double[] m,
                  java.lang.String fn,
                  java.lang.String fu)
Create a TimeSeries object from a Date vector and a double vector, and specify the data field names and units.
Parameters:
d - The dates.
m - The data.
fn - The field name.
fu - The field unit.

TimeSeries

public TimeSeries(java.util.Vector dbov)
Create a TimeSeries object from a Vector of DatabaseObject:s
Parameters:
dbov - The DatabaseObject vector

TimeSeries

public TimeSeries(long st,
                  long et,
                  long si,
                  int nodf)
Create an empty time series object.
Method Detail

setCalDay

private java.util.Calendar setCalDay(java.util.Date d)

getLength

public int getLength()
Get the length of the TimeSeries object.

getDates

public java.util.Date[] getDates()
Get the Date objects.

getDate

public java.util.Date getDate(int i)
Get one Date object.

getData

public double[][] getData()
Get the data as a Matrix object.

getData

public double getData(int i,
                      int j)
Get one data element.

getData

public double[] getData(int i)
Get the data for one row.

getNumOfDataFields

public int getNumOfDataFields()
Get the number of data fields.

getShortDescription

public java.lang.String getShortDescription()
Get the short description of the data.
Returns:
The short description

getLongDescription

public java.lang.String getLongDescription()
Get the long description of the data.
Returns:
The long description

setShortDescription

public void setShortDescription(java.lang.String sd)
Set the short description of the data.
Parameters:
sd - The short description

setLongDescription

public void setLongDescription(java.lang.String ld)
Set the long description of the data.
Parameters:
ld - The short description

setData

public void setData(int i,
                    double[] x)
Set one row of data.

setData

public void setData(int i,
                    int j,
                    double x)

average

public double[] average(boolean ignoreNaN)
Get the average of a time series object.

extract

public TimeSeries extract(long st,
                          long et)
Extract a time period.

resample

public void resample(int offset,
                     int step,
                     int w1,
                     int w2,
                     int timeUnit)
Average over the data fields.

interpolate

public void interpolate()

normalize

public void normalize()

pow

public void pow(int field,
                double x)

pow

public void pow(double x,
                int field)

setNormParam

public void setNormParam(int field,
                         double inMin,
                         double inMax,
                         double outMin,
                         double outMax)

addField

public void addField(double[] x)

print

public void print()

toOldTimeSeries

public TimeSeries toOldTimeSeries()

main

public static void main(java.lang.String[] argv)