Exemplo 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());
 }
Exemplo 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);
 }
Exemplo n.º 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_)));
 }
Exemplo n.º 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
 }
Exemplo n.º 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
 }
Exemplo n.º 6
0
 bool operator <= (const period& pe) const {return this->total() <= pe.total();}
Exemplo n.º 7
0
 bool operator >  (const period& pe) const {return this->total() >  pe.total();}
Exemplo n.º 8
0
 /// Allow periods to be compared for equality
 bool operator==(const period &p) const {
     return this->period<void>::operator==(p) && value() == p.value();
 }
Exemplo n.º 9
0
 /// Allow periods to be compared for equality
 bool operator==(const period<void> &p) const {
     return start() == p.start() && end() == p.end();
 }