Esempio n. 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());
 }
Esempio n. 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);
 }
Esempio n. 3
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
 }
Esempio n. 4
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
 }
Esempio n. 5
0
 /// Allow periods to be compared for equality
 bool operator==(const period<void> &p) const {
     return start() == p.start() && end() == p.end();
 }