added method for peeking at first scheduled event
This commit is contained in:
parent
a8e66853bc
commit
7c2e0a4b48
1 changed files with 9 additions and 1 deletions
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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;
|
package se.sics.cooja;
|
||||||
|
@ -189,6 +189,14 @@ public class EventQueue {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TimeEvent peekFirst() {
|
||||||
|
if (hasUnsortedEvents) {
|
||||||
|
sortEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EventQueue with " + (eventCount+unsortedEvents.size()) + " events";
|
return "EventQueue with " + (eventCount+unsortedEvents.size()) + " events";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue