Exemple #1
0
 inline
 bool 
 period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const 
 {
   return (other.begin() == end() ||
           begin_ == other.end());
 }
Exemple #2
0
 inline
 period<point_rep,duration_rep>
 period<point_rep,duration_rep>::span(const period<point_rep,duration_rep>& other) const 
 {
   point_rep start((begin_ < other.begin_) ? begin() : other.begin());
   point_rep newend((last_  < other.last_)  ? other.end() : this->end());
   return period<point_rep,duration_rep>(start, newend);
 }
Exemple #3
0
 inline
 bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const 
 { 
   return ( contains(other.begin_) ||
            other.contains(begin_) ||
            ((other.begin_ < begin_) && (other.last_ >= begin_)));
 }
Exemple #4
0
 inline
 period<point_rep,duration_rep>
 period<point_rep,duration_rep>::intersection(const period<point_rep,duration_rep>& other) const 
 {
   if (begin_ > other.begin_) {
     if (last_ <= other.last_) { //case2
       return *this;  
     }
     //case 1
     return period<point_rep,duration_rep>(begin_, other.end());
   }
   else {
     if (last_ <= other.last_) { //case3
       return period<point_rep,duration_rep>(other.begin_, this->end());
     }
     //case4
     return other;
   }
   //unreachable
 }
Exemple #5
0
 inline
 period<point_rep,duration_rep>
 period<point_rep,duration_rep>::merge(const period<point_rep,duration_rep>& other) const 
 {
   if (this->intersects(other)) {      
     if (begin_ < other.begin_) {
       return period<point_rep,duration_rep>(begin_, last_ > other.last_ ? this->end() : other.end());
     }
     
     return period<point_rep,duration_rep>(other.begin_, last_ > other.last_ ? this->end() : other.end());
     
   }
   return period<point_rep,duration_rep>(begin_,begin_); // no intersect return null
 }
Exemple #6
0
 bool operator <= (const period& pe) const {return this->total() <= pe.total();}
Exemple #7
0
 bool operator >  (const period& pe) const {return this->total() >  pe.total();}
Exemple #8
0
 /// Allow periods to be compared for equality
 bool operator==(const period &p) const {
     return this->period<void>::operator==(p) && value() == p.value();
 }
Exemple #9
0
 /// Allow periods to be compared for equality
 bool operator==(const period<void> &p) const {
     return start() == p.start() && end() == p.end();
 }