Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

FixLenTimeSeries Class Reference

#include <FixLenTimeSeries.h>

List of all members.


Detailed Description

The FixLenTimeSeries class implements a Fixed Length TimeSeries.

Author:
Ying Xing (yx@cs.brown.edu)
Version:
2.0 05/10/2004


Public Types

enum  Error { OUT_OF_RANGE, EMPTY_TIME_SERIES }
 The exception type used for this class. More...

Public Member Functions

 FixLenTimeSeries ()
 Default constructor.
 FixLenTimeSeries (int32 numberOfSamples) throw ( Error )
 Constructs a new FixLenTimeSeries with given number of samples.
 FixLenTimeSeries (const FixLenTimeSeries &flts)
 Copy constructor.
FixLenTimeSeriesoperator= (const FixLenTimeSeries &flts)
 Assignment constructor.
 ~FixLenTimeSeries ()
 Destructs a FixLenTimeSeries.
int32 getNumberOfSamples () const
 Returns the number of samples.
double getSample (int32 i=0) const throw ( Error )
 Returns the ith sample.
double & getSample (int32 i=0) throw ( Error )
 Returns the handle of the ith sample.
double getAverage (double p_old=0, double p_new=0) const throw ( Error )
 Returns the average value form positon p_old to p_new.
void addSample (double sample)
 Adds a sample to this FixLenTimeSeries.

Static Public Member Functions

FixLenTimeSeries resampleFixLenTimeSeries (const FixLenTimeSeries &s, int32 n, double k, double ip) throw ( FixLenTimeSeries::Error )
 Create a copy of an given FixLenTimeSeries based on the given parameter.

Friends

ostream & operator<< (ostream &os, const FixLenTimeSeries &flts)
 output the FixLenTimeSeries


Member Enumeration Documentation

enum FixLenTimeSeries::Error
 

The exception type used for this class.

Enumeration values:
OUT_OF_RANGE 
EMPTY_TIME_SERIES 


Constructor & Destructor Documentation

FixLenTimeSeries::FixLenTimeSeries  ) 
 

Default constructor.

FixLenTimeSeries::FixLenTimeSeries int32  numberOfSamples  )  throw ( Error )
 

Constructs a new FixLenTimeSeries with given number of samples.

All samples are initialized to 0.

Parameters:
numberOfSamples the lengh of the time series.

FixLenTimeSeries::FixLenTimeSeries const FixLenTimeSeries flts  ) 
 

Copy constructor.

Parameters:
flts the FixLenTimeSeries to copy from

FixLenTimeSeries::~FixLenTimeSeries  ) 
 

Destructs a FixLenTimeSeries.


Member Function Documentation

void FixLenTimeSeries::addSample double  sample  ) 
 

Adds a sample to this FixLenTimeSeries.

Parameters:
sample the sample to be added

double FixLenTimeSeries::getAverage double  p_old = 0,
double  p_new = 0
const throw ( Error )
 

Returns the average value form positon p_old to p_new.

If p_old = 0 and p_new = 0, then the average value of all samples are returned. Note that p_old and p_new are real numbers. p_old is usually larger than p_new

Parameters:
p_old the index of the first sample in the range
p_new the index of the last sample in the range

int32 FixLenTimeSeries::getNumberOfSamples  )  const
 

Returns the number of samples.

double & FixLenTimeSeries::getSample int32  i = 0  )  throw ( Error )
 

Returns the handle of the ith sample.

By default, the latest sample is returned.

Parameters:
i the index of the sample
Exceptions:
Error OUT_OF_RANGE error is thrown if index i is not correct.

double FixLenTimeSeries::getSample int32  i = 0  )  const throw ( Error )
 

Returns the ith sample.

The samples are indexed by 0 to the number of samples minus one. The 0th sample is the latest sample. By default, the latest sample is returned.

Parameters:
i the index of the sample
Exceptions:
Error OUT_OF_RANGE error is thrown if index i is not correct.

FixLenTimeSeries & FixLenTimeSeries::operator= const FixLenTimeSeries flts  ) 
 

Assignment constructor.

Parameters:
flts the FixLenTimeSeries to copy from

FixLenTimeSeries FixLenTimeSeries::resampleFixLenTimeSeries const FixLenTimeSeries s,
int32  n,
double  k,
double  ip
throw ( FixLenTimeSeries::Error ) [static]
 

Create a copy of an given FixLenTimeSeries based on the given parameter.

Parameters:
s Time series to copy.
n The number of samples in the new time series.
k Each sample in the new FixLenTimeSeries is the average value of the k samples in the old FixLenTimeSeries.
ip Where to start the resample (from the position of the latest sample).


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const FixLenTimeSeries flts
[friend]
 

output the FixLenTimeSeries

Parameters:
os the output stream
flts the FixLenTimeSeries to be outputed


The documentation for this class was generated from the following files:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8