com.agentfactory.cldc
Class MIDletRunnable

java.lang.Object
  extended by com.agentfactory.cldc.scheduler.AgentRunnable
      extended by com.agentfactory.cldc.MIDletRunnable
All Implemented Interfaces:
java.lang.Runnable, javax.microedition.lcdui.CommandListener

public class MIDletRunnable
extends AgentRunnable
implements javax.microedition.lcdui.CommandListener

This class provides the debugging interface functionality for MIDP environments and enables the developer to view an agent's mental state at run time. It provides functionaity to enable the developer to stop an agent, start an agent, and step a cycle of the agent's control process.

Author:
Conor Muldoon

Constructor Summary
MIDletRunnable(Agent a, javax.microedition.midlet.MIDlet midlet, TerImplication[] commitmentRule, RoleLibrary rl, javax.microedition.lcdui.List pList)
          Creates an instance of MIDletRunnable.
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          This method handles input coming from the user.
 void display()
          Displays three options to the user.
 void run()
          If the agent is active, updates the agent's beliefs and then steps one cycle of the control algorithm.
 void start()
          Starts the agent.
 void stop()
          Stops the agent.
 
Methods inherited from class com.agentfactory.cldc.scheduler.AgentRunnable
addFOSBelief, writeToStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIDletRunnable

public MIDletRunnable(Agent a,
                      javax.microedition.midlet.MIDlet midlet,
                      TerImplication[] commitmentRule,
                      RoleLibrary rl,
                      javax.microedition.lcdui.List pList)
Creates an instance of MIDletRunnable.

Parameters:
a - the agent the MIDletRunnable displays/controls.
midlet - the MIDlet for the application.
commitmentRule - the agent's commitment rules.
rl - the agent's role library.
pList - a list of agents on the platform.
Method Detail

start

public void start()
Description copied from class: AgentRunnable
Starts the agent.

Specified by:
start in class AgentRunnable

stop

public void stop()
Description copied from class: AgentRunnable
Stops the agent.

Specified by:
stop in class AgentRunnable

display

public void display()
Displays three options to the user. View the agent's beliefs, commitments, or commitment rules.

Specified by:
display in class AgentRunnable

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
This method handles input coming from the user. The user has the option to view an agent's mental state, stop the agent, start the agent, pause the agent, step 1 cycle of the agent's control process, or exit the application. In the MIDletRunnable class, the user is provided with back and next buttons to enable them to navigate between screens. The actions of the back and next buttons is also handled by this method.

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
See Also:
CommandListener.commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)

run

public void run()
If the agent is active, updates the agent's beliefs and then steps one cycle of the control algorithm.

Specified by:
run in interface java.lang.Runnable