Cloud computing simulation tool Chinese annotation futurequeue. Java

Source: Internet
Author: User
/** 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 ();}}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.