Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 96:9928c2fa72cc
added equal method to intervals
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Mon, 13 Jun 2011 16:50:40 -0400 |
| parents | 19603b5fa578 |
| children | b3a1c26e2f22 |
comparison
equal
deleted
inserted
replaced
| 95:857bcd41e9a2 | 96:9928c2fa72cc |
|---|---|
| 29 return self.first > self.last | 29 return self.first > self.last |
| 30 | 30 |
| 31 def length(self): | 31 def length(self): |
| 32 '''Returns the length of the interval''' | 32 '''Returns the length of the interval''' |
| 33 return float(max(0,self.last-self.first)) | 33 return float(max(0,self.last-self.first)) |
| 34 | |
| 35 def equal(self, i2): | |
| 36 return self.first==i2.first and self.last == i2.last | |
| 34 | 37 |
| 35 def getList(self): | 38 def getList(self): |
| 36 return [self.first, self.last] | 39 return [self.first, self.last] |
| 37 | 40 |
| 38 def contains(self, instant): | 41 def contains(self, instant): |
