com.cogent
Class SimPIM

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.cogent.SimElement
              |
              +--com.cogent.SimProcessingElement
                    |
                    +--com.cogent.SimPIM
All Implemented Interfaces:
java.lang.Runnable

public class SimPIM
extends SimProcessingElement

The PIM.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SimPIM(int argId)
          Constructor, starts the thread running
 
Method Summary
 int processEvent(SimEvent argEvent)
          Receives events from the dispatcher.
 void run()
          While the PIM is alive, sleep until the dispatcher sends an event.
 void Sim_Exit(long argTime)
          Indicates the PIM is done processing
 SimPacket Sim_receive()
          This method returns the next event from the queue.
 void Sim_send(SimEvent argEvent)
          This method sends an event to the dispatcher.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimPIM

public SimPIM(int argId)
Constructor, starts the thread running

Method Detail

processEvent

public int processEvent(SimEvent argEvent)
Receives events from the dispatcher. Still needs to be made asynchronous.

Specified by:
processEvent in class SimProcessingElement
Parameters:
argEvent - a SimEvent dequeued from the dispatcher

run

public void run()
While the PIM is alive, sleep until the dispatcher sends an event.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

Sim_send

public void Sim_send(SimEvent argEvent)
This method sends an event to the dispatcher. May be refactored to only take a SimPacket and construct the event itself.

Parameters:
argEvent - The event to post

Sim_receive

public SimPacket Sim_receive()
This method returns the next event from the queue. Current policy is FIFO. Will be made to support custom policies in the next revision.

Returns:
The next packet from the queue.

Sim_Exit

public void Sim_Exit(long argTime)
Indicates the PIM is done processing

Parameters:
argTime - The time to post the finished event