Mercurial Hosting > traffic-intelligence
changeset 104:13187af8622d
finally added the representation of intervals
author | Nicolas Saunier <nico@confins.net> |
---|---|
date | Thu, 14 Jul 2011 17:15:09 -0400 |
parents | 1621b46a1523 |
children | 9844c69d8fa2 |
files | python/moving.py python/tests/moving.txt |
diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/python/moving.py Wed Jul 13 19:14:17 2011 -0400 +++ b/python/moving.py Thu Jul 14 17:15:09 2011 -0400 @@ -24,7 +24,10 @@ self.last=last def __str__(self): - return '%d %d'%(self.first, self.last) + return '[{0}, {1}]'.format(self.first, self.last) + + def __repr__(self): + return self.__str__() def empty(self): return self.first > self.last @@ -51,7 +54,7 @@ return TimeInterval(min(self.first, interval2.first), max(self.last, interval2.last)) def intersection(self, interval2): - '''Largest interval comprising self and interval2''' + '''Largest interval comprised in both self and interval2''' return TimeInterval(max(self.first, interval2.first), min(self.last, interval2.last))