Changed executeNext; added comment about timeout
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 22 May 2019 10:08:20 +0000 (12:08 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Wed, 22 May 2019 18:29:08 +0000 (20:29 +0200)
era.mi/src/era/mi/logic/timeline/Timeline.java

index 8107db9..48b0f95 100644 (file)
@@ -38,9 +38,9 @@ public class Timeline
 
        public void executeNext()
        {
-               InnerEvent first = events.poll();
-               currentTime = first.getTiming();
-               first.run();
+               InnerEvent first = events.peek();
+               if (first != null)
+                       executeUpTo(first.getTiming(), -1);
        }
 
        public void executeAll()
@@ -53,7 +53,7 @@ public class Timeline
         * Executes all events up to a given simulation timestamp. The simulation process can be constrained by a real world timestamp.
         * 
         * @param timestamp  the simulation timestamp up to which the events will be processed
-        * @param stopMillis the System.currentTimeMillis() when simulation definitely needs to stop.
+        * @param stopMillis the System.currentTimeMillis() when simulation definitely needs to stop. A value of -1 means no timeout.
         * @return if it was possible to fulfil the goal in the given real world time.
         * @author Christian Femers
         */