/** Title: cloudsim toolkit * Description: cloudsim (cloud simulation) Toolkit for modeling and simulation of clouds * Licence: GPL-http://www.gnu.org/copyleft/gpl.html ** copyright (c) 2009-2010, the University of Melbourne, Australia */package Org. cloudid. cloudsim. core; import Java. util. collection; import Java. util. iterator; import Java. util. sortedset; import Java. util. treeset;/*** stores the eve that will be executed in the future NT, the data structure is summarized using the treeset * method: * add to the queue first * clear the elements in the queue * This class implements the future event queue used by {@ link simulation }. * The event queue uses a {@ link treeset} In order to store the events. ** @ authormarcos Dias de assuncao * @ sincecloudsim toolkit 1.0 ** @ see simulation * @ see Java. util. treeset */public class futurequeue {/** the sorted set. */private final sortedset <simevent> sortedset = New treeset <simevent> ();/** the serial. */private long serial = 0;/*** Add a new event to the queue. adding a new event to the queue * preserves the temporal order of the events in the queue. ** @ Param newevent the event to be put in the queue. */Public void addevent (simevent newevent ){//? What does serial mean by newevent. setserial (Serial ++); // Automatically sorts sortedset. add (newevent);}/*** Add a new event to the head of the queue. ** @ Param newevent the event to be put in the queue. */Public void addeventfirst (simevent newevent) {// This is the only difference with addevent. serial may be the meaning of priority newevent. setserial (0); sortedset. add (newevent);}/*** returns an iterator to the queue. ** @ return the iterator */Public iterator <simevent> iterator () {return sortedset. iterator ();}/*** returns the size of this event queue. ** @ return the size */Public int size () {return sortedset. size ();}/*** removes the event from the queue. ** @ Param event the event ** @ return true, if successful */Public Boolean remove (simevent event) {return sortedset. remove (event);}/*** removes all the events from the queue. ** @ Param events the events ** @ return true, if successful */Public Boolean removeall (collection <simevent> events) {return sortedset. removeall (events);}/*** clears the queue. */Public void clear () {sortedset. clear ();}}