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

PLearn::SDBVMFieldDateDiff Class Reference

difference between two dates ("source1-source2" expressed as an integer number of days, months, or years) More...

#include <SDBVMat.h>

Inheritance diagram for PLearn::SDBVMFieldDateDiff:

Inheritance graph
[legend]
Collaboration diagram for PLearn::SDBVMFieldDateDiff:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SDBVMFieldDateDiff (SDBVMSource source1, SDBVMSource source2, char the_unit= 'D', FieldValue date1_threshold=FieldValue(), FieldValue date2_threshold=FieldValue())
 unit can be 'D' for days, 'M' for months or 'Y' for years (result is always an integer number of days, months, or years)

 SDBVMFieldDateDiff (SDBVMSource source1, PDate the_refdate, char the_unit= 'D')
 This will compute difference between date in source1 and a fixed refdate.

virtual void convertField (const SDBWithStats &sdb, const Row &row, const Vec &output) const
virtual int fieldWidth () const
 Width that the field occupies in the VMat.


Protected Attributes

PDate refdate
FieldValue date1_threshold_
FieldValue date2_threshold_
char unit
 unit can be 'D' for days, 'M' for months or 'Y' for years


Detailed Description

difference between two dates ("source1-source2" expressed as an integer number of days, months, or years)

Definition at line 555 of file SDBVMat.h.


Constructor & Destructor Documentation

PLearn::SDBVMFieldDateDiff::SDBVMFieldDateDiff SDBVMSource  source1,
SDBVMSource  source2,
char  the_unit = 'D',
FieldValue  date1_threshold = FieldValue(),
FieldValue  date2_threshold = FieldValue()
[inline]
 

unit can be 'D' for days, 'M' for months or 'Y' for years (result is always an integer number of days, months, or years)

This will compute difference between dates in source1 and source2 The sources must both be dates. Optionally, two thresholds can be specified, such that if a date is below or equal to its respective threshold, then the date is considered MISSING_VALUE. This is useful to filter out some obvious outliers.

(TO BE IMPLEMENTED: or one can be a date and the other an integer numerical type; in this latter case, the integer is understood as beeing expressed in the given unit...)

Definition at line 577 of file SDBVMat.h.

References MISSING_VALUE.

PLearn::SDBVMFieldDateDiff::SDBVMFieldDateDiff SDBVMSource  source1,
PDate  the_refdate,
char  the_unit = 'D'
[inline]
 

This will compute difference between date in source1 and a fixed refdate.

Definition at line 586 of file SDBVMat.h.

References MISSING_VALUE.


Member Function Documentation

void PLearn::SDBVMFieldDateDiff::convertField const SDBWithStats sdb,
const Row row,
const Vec output
const [virtual]
 

Given a database row, convert the appropriate parts to a (preallocated) output vector of the correct width (given by fieldWidth). Replace MISSING_VALUEs by missing_values_mapping.

Implements PLearn::SDBVMField.

Definition at line 507 of file SDBVMat.cc.

References date1_threshold_, date2_threshold_, PLearn::SDBVMSource::getValue(), PLearn::FieldValue::isDate(), PLearn::FieldValue::isIntegral(), PLearn::PDate::isMissing(), PLearn::FieldValue::isMissing(), MISSING_VALUE, PLearn::PDate::month, PLERROR, refdate, PLearn::PDate::setMissing(), PLearn::FieldValue::setMissing(), PLearn::FieldValue::toDate(), PLearn::PDate::toJulianDay(), unit, PLearn::Vec, and PLearn::PDate::year.

int PLearn::SDBVMFieldDateDiff::fieldWidth  )  const [virtual]
 

Width that the field occupies in the VMat.

Implements PLearn::SDBVMField.

Definition at line 580 of file SDBVMat.cc.


Member Data Documentation

FieldValue PLearn::SDBVMFieldDateDiff::date1_threshold_ [protected]
 

Definition at line 559 of file SDBVMat.h.

Referenced by convertField().

FieldValue PLearn::SDBVMFieldDateDiff::date2_threshold_ [protected]
 

Definition at line 560 of file SDBVMat.h.

Referenced by convertField().

PDate PLearn::SDBVMFieldDateDiff::refdate [protected]
 

Definition at line 558 of file SDBVMat.h.

Referenced by convertField().

char PLearn::SDBVMFieldDateDiff::unit [protected]
 

unit can be 'D' for days, 'M' for months or 'Y' for years

Definition at line 561 of file SDBVMat.h.

Referenced by convertField().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:22:56 2004 for PLearn by doxygen 1.3.7