Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 1001:cc7c6b821ae6
added methods for setting instants
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 30 May 2018 14:44:08 -0400 |
| parents | 933670761a57 |
| children | 75af46516b2b 01db14e947e4 |
comparison
equal
deleted
inserted
replaced
| 1000:7fffdf819f5c | 1001:cc7c6b821ae6 |
|---|---|
| 168 def getFirstInstant(self): | 168 def getFirstInstant(self): |
| 169 return self.timeInterval.first | 169 return self.timeInterval.first |
| 170 | 170 |
| 171 def getLastInstant(self): | 171 def getLastInstant(self): |
| 172 return self.timeInterval.last | 172 return self.timeInterval.last |
| 173 | |
| 174 def setFirstInstant(self, t): | |
| 175 if t <= self.timeInterval.last: | |
| 176 self.timeInterval.first = t | |
| 177 else: | |
| 178 print('new first instant is after last, not changing') | |
| 179 | |
| 180 def setLastInstant(self, t): | |
| 181 if t >= self.timeInterval.first: | |
| 182 self.timeInterval.last = t | |
| 183 else: | |
| 184 print('new last instant is before first, not changing') | |
| 173 | 185 |
| 174 def getTimeInterval(self): | 186 def getTimeInterval(self): |
| 175 return self.timeInterval | 187 return self.timeInterval |
| 176 | 188 |
| 177 def existsAtInstant(self, t): | 189 def existsAtInstant(self, t): |
