changeset 1001:cc7c6b821ae6

added methods for setting instants
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 30 May 2018 14:44:08 -0400
parents 7fffdf819f5c
children 6c5ce3ec497e 01db14e947e4
files python/moving.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/python/moving.py	Sun May 27 23:24:51 2018 -0400
+++ b/python/moving.py	Wed May 30 14:44:08 2018 -0400
@@ -171,6 +171,18 @@
     def getLastInstant(self):
         return self.timeInterval.last
 
+    def setFirstInstant(self, t):
+        if t <= self.timeInterval.last:
+            self.timeInterval.first = t
+        else:
+            print('new first instant is after last, not changing')
+
+    def setLastInstant(self, t):
+        if t >= self.timeInterval.first:
+            self.timeInterval.last = t
+        else:
+            print('new last instant is before first, not changing')
+
     def getTimeInterval(self):
         return self.timeInterval