SimKit
Class LP

java.lang.Object
  |
  +--SimKit.LP

public abstract class LP
extends java.lang.Object

This is the Logical Process (LP) abstract base class. All the components of a model are defined by extending this class. To aid in debugging, each LP object is assigned an integer ID. The toString() function returns a tag with the ID number in it. The classes that extend LP should augment the toString() method to print out testing and debug information.

Extending this class ...
The functions initialize(), terminate() may be overridden. The process(Event) must be provided, as it is an abstract method. Also, the default constructor must be invoked from subclass constructors.

See Also:
Event, Simulation

Constructor Summary
LP()
          This constructor must be called by classes extending from LP.
 
Method Summary
 Event copy_and_delete()
          Should be called when for performance reasons instead of creating a new Event via new operator the same received Event object is used.
 int indexNumber()
          Report the unique index number for this LP.
 void initialize()
          Initialization routine.
abstract  void process(Event event)
          The process() function is the most important function for the LP class.
 void terminate()
          Termination routine.
 java.lang.String toString()
          Generate a textual description of the LP object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LP

public LP()
This constructor must be called by classes extending from LP.

Method Detail

initialize

public void initialize()
Initialization routine. Note that derived classes should call super.initialize() if they override this method. Users can send initial events inside this function.


terminate

public void terminate()
Termination routine. Note that derived classes should call super.initialize() if they override this method.


process

public abstract void process(Event event)
The process() function is the most important function for the LP class. Subclasses must implement this function and it is called whenever the LP receives an event to process.

Parameters:
event - The event that the LP has just received.

copy_and_delete

public Event copy_and_delete()
Should be called when for performance reasons instead of creating a new Event via new operator the same received Event object is used. All the fields except the unique Event ID will be the same with the received Event. This mechanism works, however only if the types of the two Events (the received one and the one to be sent) are the same. The user should test before if the received event is an instance of the class of the event to be sent. Another posibility is to check if Java throws an ClassCastException when copy_and_delete is used.

Returns:
a reference of Event type to the current event. The user has to explicity cast this reference to the proper type.

indexNumber

public int indexNumber()
Report the unique index number for this LP.

Returns:
The unique integer ID number for this LP object.

toString

public java.lang.String toString()
Generate a textual description of the LP object.

Overrides:
toString in class java.lang.Object
Returns:
A string with the unique LP ID. shld extend this with somethine like
 return(super.toString() + "My extra information ");
 
See Also:
indexNumber()