Class Pong

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

public class Pong
extends LogicalProcess

This class is the java-version of the Ping.c from GTW. It's used for testing the sim kernel.

Version:
1.7 (07/2006)
Author:
Yin Xiong
See Also:
Serialized Form

Field Summary
(package private)  int count
          class member for keeping track of how many messages have been sent.
(package private)  java.lang.String dest
          the application-specified name of the destination to which this LP will send messages to
(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
Pong()
          Constructs a new Pong 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.
 void appRunLP(java.lang.Object content, java.lang.String sender)
          Handles events for Pong.
 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 Pong
 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
 
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.


dest

java.lang.String dest
the application-specified name of the destination to which this LP will send messages to


timeIncrement

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

Constructor Detail

Pong

public Pong()
Constructs a new Pong instance.

Method Detail

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

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 Pong

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

appInitializeLP

public boolean appInitializeLP()
Initiates the LP. Pong does not need to send out initial message. Ping has alread done that. 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.

appRunLP

public void appRunLP(java.lang.Object content,
                     java.lang.String sender)
Handles events for Pong. 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

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