Class Phold

java.lang.Object
  extended by LogicalProcess
      extended by Phold
All Implemented Interfaces:
java.io.Serializable

public class Phold
extends LogicalProcess

This class is the java-version of the Phold.c from GTW. It is used for testing the sim kernel. The original Vaucher Duval hold mode was introduced solely to approximate a simulation application interaction with its event calendar.

An application is assumed to operate with a fixed number of initial events in the calendar. In operation, it deletes the earliest event from the calendar, synchronizes the simulation clock with this event scheduled time of occurrence, processes the event, and then inserts a newly scheduled event into the calendar.

begin

Version:
1.0 (09/2006)
Author:
Yin Xiong
See Also:
Serialized Form

Field Summary
(package private)  java.lang.String alias
          PEid and LPid of this LP, for debugging only
(package private)  int count
          class member for keeping track of how many messages have been sent.
(package private)  int MsgPop
          message population
(package private)  int numLPs
          the number of LPs
(package private)  java.util.Random random
          random number generator
(package private)  int timeIncrement
          the time increment for messages sent by this LP; the message will be sent at currentTime+timeIncrement
 
Fields inherited from class LogicalProcess
ALL_LPS, APPid, configData, currentTime, lastTime, LPid, myname, PEid, scheduler
 
Constructor Summary
Phold()
          Constructs a new Phold instance.
 
Method Summary
 void appFinalizeLP()
          Terminates LP and displays simulation statistics.
 java.util.List<java.lang.String> appGetMonitorable()
          Returns a List of Strings describing all application-specific monitorable parameters of this LP, each in the form "paramName, paramType".
 java.lang.String appGetState(java.lang.String name)
          Method to get the value of a given application-level monitorable variable.
 java.util.List<java.lang.String> appGetSteerable()
          Returns a List of Strings describing all application-specific steerable parameters of this LP, each in the form "paramName, paramType".
 boolean appInitializeLP()
          Initiates the LP and generates the initial message.
 void appRunLP(java.lang.Object content, java.lang.String sender)
          Handles events for Phold.
 LogicalProcess appSavingLPState()
          Implements abstract method to save LP state
 void appSetConfigData(java.lang.String cdata)
          Sets application-specific configuration data.
 void appSetLPState(LogicalProcess lp)
          Implements abstract method to set the state of this LP to the state of a specified Phold
 java.lang.String appSetState(java.lang.String name, java.lang.String val)
          Method to set the value of a given application-level monitorable variable.
 java.lang.String appToString()
          Implements abstract method for dispaly purpose only
(package private)  double nextExponential(double u, double lambda)
          Returns a random number from exponential distributioin
(package private)  void tSleep(int tim)
           
 
Methods inherited from class LogicalProcess
finalizeLP, getAPPid, getCurrentTime, getLID, getMonitorable, getName, getPID, getState, getSteerable, initializeLP, rollback, runLP, savingLPState, sendSimMessage, sendSimMessage, setAppID, setConfigData, setEndOfSimFlag, setLID, setLPState, setName, setPID, setScheduler, setState, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

count

int count
class member for keeping track of how many messages have been sent.


MsgPop

int MsgPop
message population


numLPs

int numLPs
the number of LPs


timeIncrement

int timeIncrement
the time increment for messages sent by this LP; the message will be sent at currentTime+timeIncrement


random

java.util.Random random
random number generator


alias

java.lang.String alias
PEid and LPid of this LP, for debugging only

Constructor Detail

Phold

public Phold()
Constructs a new Phold instance.

Method Detail

appInitializeLP

public boolean appInitializeLP()
Initiates the LP and generates the initial message. It's the counterpart of "IProc" in GTW.

Specified by:
appInitializeLP in class LogicalProcess
Returns:
false if initialization failed for some reason, true if successful.

tSleep

void tSleep(int tim)

appRunLP

public void appRunLP(java.lang.Object content,
                     java.lang.String sender)
Handles events for Phold. It is the counterpart of "Proc" in GTW.

Specified by:
appRunLP in class LogicalProcess
Parameters:
content - an Object representing the content of the message to be sent
sender - String the application-assigned name of the sender of this message

appFinalizeLP

public void appFinalizeLP()
Terminates LP and displays simulation statistics. It is optionally called at the end of the simulation. It is the counterpart of "FProc" in GTW.

Specified by:
appFinalizeLP in class LogicalProcess

nextExponential

double nextExponential(double u,
                       double lambda)
Returns a random number from exponential distributioin

Parameters:
u - double the random number from a uniform distribution
lambda - double the arrival rate

appSavingLPState

public LogicalProcess appSavingLPState()
Implements abstract method to save LP state

Specified by:
appSavingLPState in class LogicalProcess

appSetLPState

public void appSetLPState(LogicalProcess lp)
Implements abstract method to set the state of this LP to the state of a specified Phold

Specified by:
appSetLPState in class LogicalProcess
Parameters:
lp - LogicalProcess containing the state information; the application program decides what state information need to be stored

appSetConfigData

public void appSetConfigData(java.lang.String cdata)
Sets application-specific configuration data.

Specified by:
appSetConfigData in class LogicalProcess
Parameters:
cdata - String representing configuration data.

appToString

public java.lang.String appToString()
Implements abstract method for dispaly purpose only

Specified by:
appToString in class LogicalProcess

appGetState

public java.lang.String appGetState(java.lang.String name)
Method to get the value of a given application-level monitorable variable.

Specified by:
appGetState in class LogicalProcess
Parameters:
name - The name of the variable to monitor
Returns:
The value of the variable in question
Since:
1.5

appSetState

public java.lang.String appSetState(java.lang.String name,
                                    java.lang.String val)
Method to set the value of a given application-level monitorable variable.

Specified by:
appSetState in class LogicalProcess
Parameters:
name - The name of the variable to steer
val - The value to assign to the variable
Returns:
Null if the steering was successful, else a String describing the error that occurred.
Since:
1.5

appGetSteerable

public java.util.List<java.lang.String> appGetSteerable()
Returns a List of Strings describing all application-specific steerable parameters of this LP, each in the form "paramName, paramType".

Specified by:
appGetSteerable in class LogicalProcess
Returns:
List listing all application-specific steerable parameters.
Since:
1.5

appGetMonitorable

public java.util.List<java.lang.String> appGetMonitorable()
Returns a List of Strings describing all application-specific monitorable parameters of this LP, each in the form "paramName, paramType".

Specified by:
appGetMonitorable in class LogicalProcess
Returns:
List listing all application-specific montiorable parameters.
Since:
1.5