GridSim 5.0 beta

gridsim.net
Class SimpleLink

Object
  extended by Thread
      extended by Sim_entity
          extended by Link
              extended by SimpleLink
All Implemented Interfaces:
Cloneable, Runnable

public class SimpleLink
extends Link

This class realizes a link in its simplest form. It implements a simplex link that just takes a packet in from one end, delays it by a user specified time (i.e. propagation delay) and trasmits it to the other end.

Since:
GridSim Toolkit 3.1
Author:
Gokul Poduval & Chen-Khong Tham, National University of Singapore
Invariant:
$none

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class Link
baudRate_, DEFAULT_BAUD_RATE, DEFAULT_MTU, DEFAULT_PROP_DELAY, delay_, MILLI_SEC, MTU_
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SimpleLink(String name)
          Constructs a link with some default parameters.
SimpleLink(String name, double baudRate, double propDelay, int MTU)
          Constructs a Link which simulates a physical link between two entities.
 
Method Summary
 void attach(Sim_entity end1, Sim_entity end2)
          Connects one entity to another via this link
 void attach(String end1, String end2)
          Connects one entity to another via this link
 void body()
          Handles external events that are coming to this link.
 
Methods inherited from class Link
getBaudRate, getDelay, getMTU
 
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

SimpleLink

public SimpleLink(String name,
                  double baudRate,
                  double propDelay,
                  int MTU)
           throws ParameterException,
                  NullPointerException
Constructs a Link which simulates a physical link between two entities.

Parameters:
name - Name of this Link
baudRate - baud rate of this link (bits/s)
propDelay - Propogation delay of the Link in milli seconds
MTU - Maximum Transmission Unit of the Link in bytes. Packets which are larger than the MTU should be split up into MTU size units.
For e.g. a 1024 byte packet trying to cross a 576 byte MTU link should get split into 2 packets of 576 bytes and 448 bytes.
Throws:
NullPointerException - This happens when name is empty or null
ParameterException - This happens for the following conditions:
  • name is null
  • baudRate <= 0
  • propDelay <= 0
  • MTU <= 0
Pre Condition:
name != null, baudRate > 0, propDelay > 0, MTU > 0
Post Condition:
$none

SimpleLink

public SimpleLink(String name)
           throws ParameterException,
                  NullPointerException
Constructs a link with some default parameters. It simulates a link with a default value of baud rate, propagation delay and MTU.

Parameters:
name - Name of this Link
Throws:
NullPointerException - This happens when name is empty or null
ParameterException - This happens when the given name is empty
See Also:
Link.DEFAULT_BAUD_RATE, Link.DEFAULT_PROP_DELAY, Link.DEFAULT_MTU
Pre Condition:
name != null
Post Condition:
$none
Method Detail

attach

public void attach(Sim_entity end1,
                   Sim_entity end2)
Connects one entity to another via this link

Specified by:
attach in class Link
Parameters:
end1 - an entity
end2 - an entity
Pre Condition:
end1 != null, end2 != null
Post Condition:
$none

attach

public void attach(String end1,
                   String end2)
Connects one entity to another via this link

Specified by:
attach in class Link
Parameters:
end1 - an Entity name
end2 - an Entity name
Pre Condition:
end1 != null, end2 != null
Post Condition:
$none

body

public void body()
Handles external events that are coming to this link.

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

GridSim 5.0 beta

The University of Melbourne, Australia, 2009