Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 280:8d44fb1756bc
removed small error
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 21 Dec 2012 17:06:34 -0500 |
| parents | 05c9b0cb8202 |
| children | f2cf16ad798f |
comparison
equal
deleted
inserted
replaced
| 279:3af4c267a7bf | 280:8d44fb1756bc |
|---|---|
| 47 'indicates if the temporal interval of self is comprised in interval2' | 47 'indicates if the temporal interval of self is comprised in interval2' |
| 48 return (self.first >= interval2.first) and (self.last <= interval2.last) | 48 return (self.first >= interval2.first) and (self.last <= interval2.last) |
| 49 | 49 |
| 50 def union(self, interval2): | 50 def union(self, interval2): |
| 51 '''Smallest interval comprising self and interval2''' | 51 '''Smallest interval comprising self and interval2''' |
| 52 return TimeInterval(min(self.first, interval2.first), max(self.last, interval2.last)) | 52 return Interval(min(self.first, interval2.first), max(self.last, interval2.last)) |
| 53 | 53 |
| 54 def intersection(self, interval2): | 54 def intersection(self, interval2): |
| 55 '''Largest interval comprised in both self and interval2''' | 55 '''Largest interval comprised in both self and interval2''' |
| 56 return TimeInterval(max(self.first, interval2.first), min(self.last, interval2.last)) | 56 return Interval(max(self.first, interval2.first), min(self.last, interval2.last)) |
| 57 | 57 |
| 58 def distance(self, interval2): | 58 def distance(self, interval2): |
| 59 if not self.intersection(interval2).empty(): | 59 if not self.intersection(interval2).empty(): |
| 60 return 0 | 60 return 0 |
| 61 elif self.first > interval2.last: | 61 elif self.first > interval2.last: |
