GridSim 5.0 beta

gridsim.net
Interface PacketScheduler

All Known Implementing Classes:
ARED, FIFO, FIFOScheduler, FnbSCFQScheduler, RateControlledScheduler, RED, SCFQScheduler

public interface PacketScheduler

This class provides a template for schedulers that will be used at routers. Every egress port of a router needs to instantiate a PacketScheduler object which it uses to determine the order in which packets should be sent out.

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

Method Summary
 Packet deque()
          Removes a single packet and returns it.
 boolean enque(Packet np)
          This method enques a packet in this scheduler.
 double getBaudRate()
          Returns the baud rate of the egress port that is using this scheduler.
 int getRouterID()
          Returns the router ID that hosts this scheduler.
 int getSchedID()
          Returns the ID of this scheduler.
 String getSchedName()
          Returns the name of this scheduler, if one was specified during setup.
 boolean isEmpty()
          Determines whether the scheduler is currently keeping any packets in its queue(s).
 boolean setBaudRate(double rate)
          Sets the baud rate that this scheduler will be sending packets at.
 boolean setRouterID(int routerID)
          Sets the router ID that hosts this scheduler.
 int size()
          Determines the number of packets that are currently enqueued in this scheduler.
 

Method Detail

getBaudRate

double getBaudRate()
Returns the baud rate of the egress port that is using this scheduler. If the baud rate is zero, it means you haven't set it up.

Returns:
the baud rate in bits/s
See Also:
setBaudRate(double)
Pre Condition:
$none
Post Condition:
$result >= 0

setBaudRate

boolean setBaudRate(double rate)
Sets the baud rate that this scheduler will be sending packets at.

Parameters:
rate - the baud rate of this scheduler (in bits/s)
Pre Condition:
rate > 0
Post Condition:
$none

enque

boolean enque(Packet np)
This method enques a packet in this scheduler. If the implementing class has buffer management policies too, then it should return true if the packet was successfully enqued. If the packet was dropped, or could not be accomodated due to any other reason, it should return false.

Parameters:
np - A Packet to be enqued by this scheduler.
Returns:
true if enqued, false otherwise
Pre Condition:
np != null
Post Condition:
$none

deque

Packet deque()
Removes a single packet and returns it. This packet should be sent out by the router from the port using this scheduler.

Returns:
the packet to be sent out
Pre Condition:
$none
Post Condition:
$none

isEmpty

boolean isEmpty()
Determines whether the scheduler is currently keeping any packets in its queue(s).

Returns:
true if no packets are enqueued, false otherwise
Pre Condition:
$none
Post Condition:
$none

size

int size()
Determines the number of packets that are currently enqueued in this scheduler.

Returns:
the number of packets enqueud by this scheduler.
Pre Condition:
$none
Post Condition:
$none

getSchedName

String getSchedName()
Returns the name of this scheduler, if one was specified during setup. Otherwise "PacketScheduler" is returned. This could be used for debugging purposes.

Returns:
the name of this scheduler
Pre Condition:
$none
Post Condition:
$none

getSchedID

int getSchedID()
Returns the ID of this scheduler.

Returns:
the ID of this scheduler or -1 if no ID is found
Pre Condition:
$none
Post Condition:
$none

getRouterID

int getRouterID()
Returns the router ID that hosts this scheduler.

Returns:
the router ID or -1 if no ID is found
Pre Condition:
$none
Post Condition:
$none

setRouterID

boolean setRouterID(int routerID)
Sets the router ID that hosts this scheduler.

Parameters:
routerID - the router ID that hosts this scheduler
Returns:
true if successful or false otherwise
Pre Condition:
$none
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009