CloudSim源代码学习SimEntityjava文档格式.docx

上传人:b****4 文档编号:16036860 上传时间:2022-11-17 格式:DOCX 页数:23 大小:19.02KB
下载 相关 举报
CloudSim源代码学习SimEntityjava文档格式.docx_第1页
第1页 / 共23页
CloudSim源代码学习SimEntityjava文档格式.docx_第2页
第2页 / 共23页
CloudSim源代码学习SimEntityjava文档格式.docx_第3页
第3页 / 共23页
CloudSim源代码学习SimEntityjava文档格式.docx_第4页
第4页 / 共23页
CloudSim源代码学习SimEntityjava文档格式.docx_第5页
第5页 / 共23页
点击查看更多>>
下载资源
资源描述

CloudSim源代码学习SimEntityjava文档格式.docx

《CloudSim源代码学习SimEntityjava文档格式.docx》由会员分享,可在线阅读,更多相关《CloudSim源代码学习SimEntityjava文档格式.docx(23页珍藏版)》请在冰豆网上搜索。

CloudSim源代码学习SimEntityjava文档格式.docx

*

*Copyright(c)2009-2010,TheUniversityofMelbourne,Australia

*/

package;

import;

/**

*Thisclassrepresentsasimulationentity.Anentityhandleseventsandcan

*sendeventstootherentities.Whenthisclassisextended,thereareafew

*methodsthatneedtobeimplemented:

*<

ul>

li>

{@link#startEntity()}isinvokedbythe{@linkSimulation}classwhen

*thesimulationisstarted.Thismethodshouldberesponsibleforstartingthe

*entityup.

{@link#processEvent(SimEvent)}isinvokedbythe{@linkSimulation}

*classwheneverthereisaneventinthedeferredqueue,whichneedstobe

*processedbytheentity.

{@link#shutdownEntity()}isinvokedbythe{@linkSimulation}beforethe

*simulationfinishes.Ifyouwanttosavedatainlogfilesthisisthemethod

*inwhichthecorrespondingcodewouldbeplaced.

/ul>

*@authorMarcosDiasdeAssuncao

*@sinceCloudSimToolkit1.0

publicabstractclassSimEntityimplementsCloneable{

/**Thename.*/

privateStringname;

/**Theid.*/

privateintid;

/**Thebufferforselectedincomingevents.*/

privateSimEventevbuf;

/**Theentity'

scurrentstate.*/

privateintstate;

/**

*Createsanewentity.

*@paramnamethenametobeassociatedwiththisentity

publicSimEntity(Stringname){

if(name.indexOf("

"

)!

=-1){

thrownewIllegalArgumentException(

"

Entitynamescan'

tcontainspaces."

);

}

this.name=name;

id=-1;

state=RUNNABLE;

CloudSim.addEntity(this);

}

*Getthenameofthisentity.

*@returnTheentity'

sname

publicStringgetName(){

returnname;

*Gettheuniqueidnumberassignedtothisentity.

*@returnTheidnumber

publicintgetId(){

returnid;

//Theschedulefunctions

*Sendaneventtoanotherentitybyidnumber,withdata.Notethatthe

*tag<

code>

9999<

/code>

isreserved.

*@paramdestTheuniqueidnumberofthedestinationentity

*@paramdelayHowlongfromthecurrentsimulationtimetheevent

*shouldbesent

*@paramtagAnuser-definednumberrepresentingthetypeofevent.

*@paramdataThedatatobesentwiththeevent.

publicvoidschedule(intdest,doubledelay,inttag,Objectdata){

if(!

CloudSim.running()){

return;

CloudSim.send(id,dest,delay,tag,data);

*Sendaneventtoanotherentitybyidnumberandwith<

b>

no<

/b>

data.

*Notethatthetag<

publicvoidschedule(intdest,doubledelay,inttag){

schedule(dest,delay,tag,null);

*Sendaneventtoanotherentitythroughaportwithagivenname,with

*data.Notethatthetag<

*@paramdestThenameoftheporttosendtheeventthrough

publicvoidschedule(Stringdest,doubledelay,inttag,Objectdata){

schedule(CloudSim.getEntityId(dest),delay,tag,data);

data.Notethatthetag<

*@paramdelayHowlongfromthecurrentsimulationtimetheeventshouldbe

*sent

publicvoidschedule(Stringdest,doubledelay,inttag){

publicvoidscheduleNow(intdest,inttag,Objectdata){

schedule(dest,0,tag,data);

publicvoidscheduleNow(intdest,inttag){

schedule(dest,0,tag,null);

*Sendaneventto

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 医药卫生 > 临床医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1