📄 gridsimcore.java
字号:
if (entityID < 0) { System.out.println(super.get_name() + ".send(): Error - " + "invalid entity id " + entityID); return; } super.sim_schedule(entityID, delay, gridSimTag); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param entityID the id number of the destination entity * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @param data A reference to data to be sent with the event * @deprecated As of GridSim 2.1, replaced by {@link #send(int, double, * int, Object)} * @pre entityID > 0 * @pre delay >= 0.0 * @pre data != null * @post $none */ protected void Send(int entityID, double delay, int gridSimTag, Object data) { send(entityID, delay, gridSimTag, data); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param entityID the id number of the destination entity * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @param data A reference to data to be sent with the event * @pre entityID > 0 * @pre delay >= 0.0 * @pre data != null * @post $none */ protected void send(int entityID, double delay, int gridSimTag, Object data) { if (entityID < 0) { return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 if (delay < 0.0) { delay = 0.0; } if (entityID < 0) { System.out.println(super.get_name() + ".send(): Error - " + "invalid entity id " + entityID); return; } super.sim_schedule(entityID, delay, gridSimTag, data); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param destPort A reference to the port to send the event out of * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @deprecated As of GridSim 2.1, replaced by {@link #send(Sim_port, double, * int)} * @pre destPort != null * @pre delay >= 0.0 * @post $none */ protected void Send(Sim_port destPort, double delay, int gridSimTag) { send(destPort, delay, gridSimTag); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param destPort A reference to the port to send the event out of * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @pre destPort != null * @pre delay >= 0.0 * @post $none */ protected void send(Sim_port destPort, double delay, int gridSimTag) { if (destPort == null) { System.out.println(super.get_name() + ".send(): Error - " + "destination port is null or empty."); return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 if (delay < 0.0) { delay = 0.0; } super.sim_schedule(destPort, delay, gridSimTag); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param destPort A reference to the port to send the event out of * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @param data an object of type IO_data * @deprecated As of GridSim 2.1, replaced by {@link #send(Sim_port, double, * int, Object)} * @pre destPort != null * @pre delay >= 0.0 * @pre data != null * @post $none * @see gridsim.IO_data */ protected void Send(Sim_port destPort, double delay, int gridSimTag, Object data) { send(destPort, delay, gridSimTag, data); } /** * Sends an event/message to another entity by <tt>delaying</tt> * the simulation time * from the current time, with a tag representing the event type. * <p> * It is <tt>recommended</tt> to use <tt>send()</tt> method with * an output port if the network bandwidth plays an important role in * this simulation. However, the entity must have the network entities, i.e. * <tt>Input</tt> and <tt>Output</tt> port (specified during the creation * of the entity by giving a baud rate or bandwidth speed). * Below is an example on how to do: * <p> * <code> * ... // other code <br> * // object is the entity or message you want to send <br> * // size is the object size in bytes (rough estimation) <br> * // destination id is the entity ID you want to send the object to <br> * IO_data data = new IO_data(object, size, destinationID); <br> * <br> <br> * // If this entity extends from GridSim class, then you should use it <br> * // otherwise need to create a new <tt>Sim_port</tt> object <br> * Sim_port port = super.output; <br> <br> * // delay is the simulation time delay <br> * // tag is the event type (user-defined or choose one from * <tt>GridSimTags</tt> class)<br> * send(port, delay, tag, data);<br> * ... // remaining other code <br> * </code> * * @param destPort A reference to the port to send the event out of * @param delay how long from the current simulation time the event * should be sent. * If delay is a negative number, then it will be * changed to 0.0 * @param gridSimTag an user-defined number representing the type of * an event/message * @param data an object of type IO_data * @pre destPort != null * @pre delay >= 0.0 * @pre data != null * @post $none * @see gridsim.IO_data */ protected void send(Sim_port destPort, double delay, int gridSimTag, Object data) { if (destPort == null) { System.out.println(super.get_name() + ".send(): Error - " + "destination port is null or empty."); return; } // if delay is -ve, then it doesn't make sense. So resets to 0.0 if (delay < 0.0) { delay = 0.0; } super.sim_schedule(destPort, delay, gridSimTag, data); }} // end class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -