import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.Random;
/**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
*
* - initialize event calendar with 1000 events
*
- done =false; hold_count=0;
*
- begin titak_time measure
*
- while (not doen) do {
*
* - Delete highest priority event from calendar
*
- Synchronize clock with this event's time of occurence
*
- Define a scheduled time to be clock time plus a random variate from a
* given scheduling distributioin
*
- Encode scheduled time in new_event;
*
- Insert new_event in calendar;
*
- hold_count:=hold_count + 1
*
- if(hold_count=n) then done:=true}
*
* - End total_time measure
*
- hold_time=hold_time/n;
*
- end hold algorithm
*
*@author Yin Xiong
*@version 1.0 (09/2006)
*/
public class Phold extends LogicalProcess{
/**class member for keeping track of how many messages have been sent.*/
int count;
/**message population */
int MsgPop;
/**the number of LPs*/
int numLPs;
/**the time increment for messages sent by this LP; the message will be sent at currentTime+timeIncrement*/
int timeIncrement;
/**random number generator*/
Random random;
/**PEid and LPid of this LP, for debugging only*/
String alias;
/**Constructs a new Phold instance.*/
public Phold()
{
super();
MsgPop=6;
count=0;
timeIncrement=0;
numLPs=2;
random=new Random();
}
/**Initiates the LP and generates the initial message. It's the counterpart of "IProc"
*in GTW.
*/
public boolean appInitializeLP()
{
alias=PEid+"-"+LPid;
System.out.println(alias + " initializing...\n");
int destLP;
//translated from GTW phold.c
//send initial messages
count=0;
for(int i=LPid;i appGetSteerable()
{
return null;
}
/**Returns a List of Strings describing all application-specific monitorable
* parameters of this LP, each in the form "paramName, paramType".
* @since 1.5
* @return List listing all application-specific montiorable parameters.
*/
public List appGetMonitorable()
{
return null;
}
}//end Ping