GridSim 5.0 beta

gridsim.net.fnb
Class FnbInput

Object
  extended by Thread
      extended by Sim_entity
          extended by FnbInput
All Implemented Interfaces:
NetIO, Cloneable, Runnable

public class FnbInput
extends Sim_entity
implements NetIO

Thiss class defines a port through which a simulation entity receives data from the simulated network. Note that this class is based on Input class.

It maintains an event queue to serialize the data-in-flow and delivers to its parent entity. It accepts messages that comes from GridSim entities FnbOutput entity and passes the same to the GridSim entity. It simulates Network communication delay depending on Baud rate and data length. Simultaneous inputs can be modeled using multiple instances of this class.

Since:
GridSim Toolkit 4.2
Author:
Agustin Caminero, Universidad de Castilla La Mancha (Spain).
See Also:
Input

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FnbInput(String name, double baudRate)
          Allocates a new Input object
 
Method Summary
 void addLink(Link link)
          Sets the Input entities link.
 void body()
          A method that gets one process event at one time until the end of a simulation, then delivers an event to the entity (its parent)
 double getBaudRate()
          Gets the baud rate
 source_pktNum lookForSrcPktNum(int src, int glID)
          Look for a especific source_pktNum object in the source_PktNum_array
 double realIO(double value)
          Gets the I/O real number based on a given value
 void removeFromSrcPktNum(int src)
          Look for a especific source_pktNum object in the source_PktNum_array
 boolean setBackgroundTraffic(TrafficGenerator gen)
          This is an empty method and only applicable to Output class.
 boolean setBackgroundTraffic(TrafficGenerator gen, Collection userName)
          This is an empty method and only applicable to Output class.
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FnbInput

public FnbInput(String name,
                double baudRate)
         throws NullPointerException
Allocates a new Input object

Parameters:
name - the name of this object
baudRate - the communication speed
Throws:
NullPointerException - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
Pre Condition:
name != null, baudRate >= 0.0
Post Condition:
$none
Method Detail

addLink

public void addLink(Link link)
Sets the Input entities link. This should be used only if the network extensions are being used.

Specified by:
addLink in interface NetIO
Parameters:
link - the link to which this Input entity should send data
Pre Condition:
link != null
Post Condition:
$none

getBaudRate

public double getBaudRate()
Gets the baud rate

Specified by:
getBaudRate in interface NetIO
Returns:
the baud rate
Pre Condition:
$none
Post Condition:
$result >= 0.0

realIO

public double realIO(double value)
Gets the I/O real number based on a given value

Parameters:
value - the specified value
Returns:
real number
Pre Condition:
value >= 0.0
Post Condition:
$result >= 0.0

setBackgroundTraffic

public boolean setBackgroundTraffic(TrafficGenerator gen,
                                    Collection userName)
This is an empty method and only applicable to Output class.

Specified by:
setBackgroundTraffic in interface NetIO
Parameters:
gen - a background traffic generator
userName - a collection of user entity name (in String object).
Returns:
false since this method is not used by this class.
See Also:
Output
Pre Condition:
gen != null, userName != null
Post Condition:
$none

setBackgroundTraffic

public boolean setBackgroundTraffic(TrafficGenerator gen)
This is an empty method and only applicable to Output class.

Specified by:
setBackgroundTraffic in interface NetIO
Parameters:
gen - a background traffic generator
Returns:
false since this method is not used by this class.
See Also:
Output
Pre Condition:
gen != null
Post Condition:
$none

body

public void body()
A method that gets one process event at one time until the end of a simulation, then delivers an event to the entity (its parent)

Overrides:
body in class Sim_entity
Pre Condition:
$none
Post Condition:
$none

lookForSrcPktNum

public source_pktNum lookForSrcPktNum(int src,
                                      int glID)
Look for a especific source_pktNum object in the source_PktNum_array

Parameters:
src - the source of the packet
glID - the id of the girdlet this packet belongs to.
Returns:
a source_pktNum object whose source is src, null otherwise

removeFromSrcPktNum

public void removeFromSrcPktNum(int src)
Look for a especific source_pktNum object in the source_PktNum_array

Parameters:
src - the source of the packet

GridSim 5.0 beta

The University of Melbourne, Australia, 2009