Prism.core
Class FIFOScheduler

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

public class FIFOScheduler
extends java.lang.Object
implements AbstractScheduler

A simple FIFO based message store which allows a dynamic set of queue to be handled in the architecture. Messages are always added to the end of the queue whereas they are removed at the head of the queue. There is no knowledge of priorities.

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

Constructor Summary
FIFOScheduler()
          Create the event store with DEFAULT_SIZE elements
FIFOScheduler(int FIFOSize)
          Create the event store
 
Method Summary
 void add(Event evt)
          Add an event to the beginning of 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

FIFOScheduler

public FIFOScheduler()
Create the event store with DEFAULT_SIZE elements

See Also:
C3.conn.FIFODispatch#DEFAULT_SIZE

FIFOScheduler

public FIFOScheduler(int FIFOSize)
Create the event store

Method Detail

add

public void add(Event evt)
Add an event to the beginning of the queue. The method is synchronized so that simultaneous additions and removals are not possible. This is a potential major bottleneck.

Specified by:
add in interface AbstractScheduler
Parameters:
m - 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