From 7c2e0a4b48c273c817c304b1148fe0005e28591d Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 26 May 2009 13:36:36 +0000 Subject: [PATCH] added method for peeking at first scheduled event --- tools/cooja/java/se/sics/cooja/EventQueue.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/EventQueue.java b/tools/cooja/java/se/sics/cooja/EventQueue.java index ca08d1294..1fd33b39b 100644 --- a/tools/cooja/java/se/sics/cooja/EventQueue.java +++ b/tools/cooja/java/se/sics/cooja/EventQueue.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: EventQueue.java,v 1.5 2009/03/03 13:42:45 fros4943 Exp $ + * $Id: EventQueue.java,v 1.6 2009/05/26 13:36:36 fros4943 Exp $ */ package se.sics.cooja; @@ -189,6 +189,14 @@ public class EventQueue { return tmp; } + public TimeEvent peekFirst() { + if (hasUnsortedEvents) { + sortEvents(); + } + + return first; + } + public String toString() { return "EventQueue with " + (eventCount+unsortedEvents.size()) + " events"; }