📄 abstractgis.java
字号:
* @pre ev != null * @post $none */ protected abstract void processGISResourceARList(Sim_event ev); /** * Process an incoming delivery from other GIS entities about their * resource list. <br> * NOTE: ev.get_data() should contain <tt>List</tt> containing resource IDs * (in <tt>Integer</tt> object). * * @param ev a Sim_event object (or an incoming event or request) * @pre ev != null * @post $none */ protected abstract void processGISResourceResult(Sim_event ev); /** * Process an incoming delivery from other GIS entities about their * resource list supporting Advanced Reservation. <br> * NOTE: ev.get_data() should contain <tt>List</tt> containing resource IDs * (in <tt>Integer</tt> object). * * @param ev a Sim_event object (or an incoming event or request) * @pre ev != null * @post $none */ protected abstract void processGISResourceARResult(Sim_event ev); /** * Process a registration request from a resource entity * supporting Advanced Reservation to this regional * GIS entity. <br> * NOTE: <tt>ev.get_data()</tt> should contain an <tt>Integer</tt> object * representing the resource ID. * * @param ev a Sim_event object (or a registration request) * @pre ev != null * @post $none */ protected abstract void processRegisterResourceAR(Sim_event ev); /** * Process a registration request from a resource entity to this regional * GIS entity. <br> * NOTE: <tt>ev.get_data()</tt> should contain an <tt>Integer</tt> object * representing the resource ID. * * @param ev a Sim_event object (or a registration request) * @pre ev != null * @post $none */ protected abstract void processRegisterResource(Sim_event ev); /** * Process an incoming request about getting a list of regional GIS IDs * (including this entity ID), that are registered to the * {@link gridsim.GridInformationService} or system GIS. * * @param ev a Sim_event object (or an incoming event or request) * @pre ev != null * @post $none */ protected abstract void processInquiryRegionalGIS(Sim_event ev); /** * Process an incoming request that uses a user-defined tag. This method * is useful for creating a new regional GIS entity. * * @param ev a Sim_event object (or an incoming event or request) * @pre ev != null * @post $none */ protected abstract void processOtherEvent(Sim_event ev); /** * Registers other information to {@link gridsim.GridInformationService} or * system GIS. * @pre $none * @post $none */ protected abstract void registerOtherEntity(); /** * Informs the registered entities regarding to the end of a simulation. * @pre $none * @post $none */ protected abstract void processEndSimulation(); /** * Process incoming events one by one * @param ev a Sim_event object * @pre ev != null * @post $none */ private void processEvent(Sim_event ev) { switch ( ev.get_tag() ) { // register resource case GridSimTags.REGISTER_RESOURCE: case AbstractGIS.REGISTER_RESOURCE: notifySystemGIS(ev, GridSimTags.REGISTER_RESOURCE); processRegisterResource(ev); break; // register AR resource case GridSimTags.REGISTER_RESOURCE_AR: case AbstractGIS.REGISTER_RESOURCE_AR: notifySystemGIS(ev, GridSimTags.REGISTER_RESOURCE_AR); processRegisterResourceAR(ev); break; // get resource list of this entity case GridSimTags.RESOURCE_LIST: case AbstractGIS.INQUIRY_LOCAL_RESOURCE_LIST: processResourceList(ev); break; // get AR resource list of this entity case GridSimTags.RESOURCE_AR_LIST: case AbstractGIS.INQUIRY_LOCAL_RESOURCE_AR_LIST: processResourceARList(ev); break; // get resource list of other regional GIS case AbstractGIS.INQUIRY_GLOBAL_RESOURCE_LIST: processGlobalResourceList(ev); break; // get AR resource list of other regional GIS case AbstractGIS.INQUIRY_GLOBAL_RESOURCE_AR_LIST: processGlobalResourceARList(ev); break; // get a list of regional GIS case AbstractGIS.INQUIRY_REGIONAL_GIS: processInquiryRegionalGIS(ev); break; // get resource list from this GIS which is needed by other GIS case AbstractGIS.GIS_INQUIRY_RESOURCE_LIST: processGISResourceList(ev); break; // get AR resource list from this GIS which is needed by other GIS case AbstractGIS.GIS_INQUIRY_RESOURCE_AR_LIST: processGISResourceARList(ev); break; // get resource list from other GIS case AbstractGIS.GIS_INQUIRY_RESOURCE_RESULT: processGISResourceResult(ev); break; // get AR resource list from other GIS case AbstractGIS.GIS_INQUIRY_RESOURCE_AR_RESULT: processGISResourceARResult(ev); break; // Ping packet case GridSimTags.INFOPKT_SUBMIT: processPingRequest(ev); break; // handle other events default: processOtherEvent(ev); break; } } /** * Notify {@link gridsim.GridInformationService} or system GIS about a * specific request as defined in the tag name.<br> * NOTE: <tt>ev.get_data()</tt> should contain an <tt>Integer</tt> object * * @param ev a Sim_event object (or requests to be sent to system GIS) * @param tag a tag name or type of request * @return <tt>true</tt> if a request has been sent, <tt>false</tt> * otherwise * @pre ev != null * @post $none */ protected boolean notifySystemGIS(Sim_event ev, int tag) { boolean result = false; Object obj = ev.get_data(); if (obj instanceof Integer) { result = true; super.send(super.output, GridSimTags.SCHEDULE_NOW, tag, new IO_data(obj, Link.DEFAULT_MTU, systemGIS_) ); } return result; } /** * Processes a ping request. * @param ev a Sim_event object * @pre ev != null * @post $none */ private void processPingRequest(Sim_event ev) { try { InfoPacket pkt = (InfoPacket) ev.get_data(); pkt.setTag(GridSimTags.INFOPKT_RETURN); pkt.setDestID( pkt.getSrcID() ); // sends back to the sender super.send(super.output, 0.0, GridSimTags.INFOPKT_RETURN, new IO_data(pkt, pkt.getSize(), pkt.getSrcID()) ); } catch (Exception e) { // ... empty } }} // end class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -