Prism.core
Class EDFScheduler

java.lang.Object
  extended by Prism.core.EDFScheduler
All Implemented Interfaces:
AbstractScheduler

public class EDFScheduler
extends java.lang.Object
implements AbstractScheduler

A Priority based message store which allows a dynamic set of queue to be handled. Messages are scheduled based on their priority. Higher priority messages are added to the head of the queue, while lower priority messages are added to the end of the queue.

Version:
2.0
Author:
USC Soft. Arch. Group. Contact: Sam Malek malek@usc.edu

Constructor Summary
EDFScheduler()
          Create the event store with DEFAULT_SIZE elements
EDFScheduler(int pSize)
          Create the event store
 
Method Summary
 void add(Event evt)
          Adds a new event to the queue.
 Event getEvent()
          Get a message from the head of the queue and remove it from the message store, although the message object itself is not deleted.
 int getWaitingLength()
          Get the number of queued events waiting to be dispatched
 void setEventCapacity(int n)
          Set the capacity of messages that can be stored before being dispatched
 java.lang.String toString()
          Get a string representation of the message queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EDFScheduler

public EDFScheduler()
Create the event store with DEFAULT_SIZE elements


EDFScheduler

public EDFScheduler(int pSize)
Create the event store

Method Detail

add

public void add(Event evt)
Adds a new event to the queue. Location of new event is determined according to its priority.

Specified by:
add in interface AbstractScheduler
Parameters:
evt - Event to be added

getEvent

public Event getEvent()
Get a message from the head of the queue and remove it from the message store, although the message object itself is not deleted.

Specified by:
getEvent in interface AbstractScheduler
Returns:
Message The message object at the head of the FIFO

getWaitingLength

public int getWaitingLength()
Get the number of queued events waiting to be dispatched

Specified by:
getWaitingLength in interface AbstractScheduler
Returns:
int Number of queue remaining

toString

public java.lang.String toString()
Get a string representation of the message queue. This is used primarily for debugging

Overrides:
toString in class java.lang.Object
Returns:
String The stringified representation of the queue.

setEventCapacity

public void setEventCapacity(int n)
Set the capacity of messages that can be stored before being dispatched

Specified by:
setEventCapacity in interface AbstractScheduler
Parameters:
n - int the required capacity of the message store