next up previous contents
Next: Matrix and Matrix Sequence Up: Some Functions and Methods Previous: Time Object Handling   Contents

Time Interval Handling

In the examples below ti is an object of type TimeInterval. Since QdTimeInterval inherits from this class the methods described all work for QdTimeInterval_var pointers. For example
TimeInterval ti=new TimeInterval(Time(2000,1,2,12.0),
Time(2000,1,2,14.0));
Time t = ti.end();
becomes the QdObject method
QdTimeInterval_var ti=new QdTimeInterval(QdTime(2000,1,2,12.0),
QdTime(2000,1,2,14.0));
QdTime_var t = new QdTime(ti->end());

$\bullet$
bool contains( Time& t ), returns true if a time, t, is contained in the interval, e.g. if(ti.contains(t)){...}
$\bullet$
void display(), will print a text representation of the interval to stdout, e.g. ti.display()
$\bullet$
Time duration(), returns a signed Time object holding the duration of ti, e.g.
Time t1 = ti.duration()
$\bullet$
Time duration_abs(), returns a Time object holding the absolute duration of ti, e.g. t1 = ti.duration_abs()
$\bullet$
bool empty(), returns true when duration=0, e.g. if(ti.empty()){...}
$\bullet$
Time end(), returns a Time object holding the end time of ti, e.g. t1=ti.end()
$\bullet$
Time end_abs(), returns a Time object holding the later time of ti, e.g. t1=ti.end_abs().
$\bullet$
void force_sense(Sense option=TIME_SENSE_POSITIVE ),
forces the sense of ti to be either TIME_SENSE_POSITIVE or TIME_SENSE_NEGATIVE. The default is TIME_SENSE_POSITIVE, e.g. ti.force_sense(TIME_SENSE_POSITIVE) which is equivalent to ti.force_sense()
$\bullet$
int get_sense(), returns TIME_SENSE of ti, e.g. ti.get_sense() Possible return values are, NO_TIME_SENSE, TIME_SENSE_POSITIVE, TIME_SENSE_NEGATIVE.
$\bullet$
TimeInterval int_intersect(TimeInterval& ti), returns a TimeInterval containing the intersection of t1 and t2, e.g. ti=t1.int_intersect(t2)
$\bullet$
TimeInterval int_union(TimeInterval& ti), e.g. ti=t1.int_union(t2)
returns union of t1 and t2.
$\bullet$
void reverse(), e.g. t1.reverse() reverses sense of t1.
$\bullet$
void set( Time& st, Time& ed, Sense option=NO_TIME_SENSE),
e.g. ti.set(t1,t2) sets ti from start time t1 and end time t2.
$\bullet$
void set_duration(Time& d, SetOption option=SAME_START_TIME),
e.g. ti.set_duration(td,SAME_START_TIME) sets end time of ti to ti.start()+td.
$\bullet$
void set_duration( Time& t, Time& d, SetOption option=START_TIME),
e.g. ti.set_duration(t1,td,START_TIME) sets ti from t1 and t1+td.
$\bullet$
void set_end( Time& ed, SetOption option=SAME_START_TIME ),
e.g. ti.set_end(t1) sets end time of ti.
$\bullet$
void set_start( Time& ed, SetOption option=SAME_SEND_TIME ),
e.g. ti.set_start(t1) sets start time of ti.
$\bullet$
void shift_forward(double factor = 1.0 ), e.g. ti.shift_forward(0.5)
shifts ti forward by 0.5 * ti.duration(), that is it shifts the time interval forward by half its own duration. The default is to shift the interval forwards by its own duration.
$\bullet$
void shift_back(double factor = 1.0 ), e.g. ti.shift_back(2.0)
shifts ti backward by 2.0 * ti.duration(). The default is to shift the interval by its own duration.
$\bullet$
Time start(), e.g. t1=ti.start() returns start time.
$\bullet$
Time end(), e.g. t1=ti.end() returns end time.


next up previous contents
Next: Matrix and Matrix Sequence Up: Some Functions and Methods Previous: Time Object Handling   Contents
Anthony Allen 2005-11-07