added more doc to Timeline; added functionality to Bit
[Mograsim.git] / era.mi / src / era / mi / logic / timeline / Timeline.java
index bdd5947..5c88dea 100644 (file)
@@ -15,7 +15,6 @@ public class Timeline
        public Timeline(int initCapacity)
        {
                events = new PriorityQueue<InnerEvent>(initCapacity, (a, b) -> {
-                       //Is this really necessary? If only ints are allowed as relative timing, the difference should always be an int
                        long difference = a.getTiming() - b.getTiming();
                        if(difference == 0)
                                return 0;
@@ -34,6 +33,12 @@ public class Timeline
                currentTime = first.getTiming();
                first.run();
        }
+       
+       public void executeAll()
+       {
+               while (hasNext())
+                       executeNext();
+       }
 
        public long getSimulationTime()
        {
@@ -86,5 +91,16 @@ public class Timeline
                        function.handle(event);
                }
                
+               @Override
+               public String toString()
+               {
+                       return event.toString();
+               }
+       }
+       
+       @Override
+       public String toString()
+       {
+               return "simulation time: " + currentTime + ", " + events.toString();
        }
 }
\ No newline at end of file