ubiware.core.behaviors
Class DebugBehavior

java.lang.Object
  extended by ubiware.core.ReusableAtomicBehavior
      extended by ubiware.core.behaviors.DebugBehavior
All Implemented Interfaces:
java.lang.Runnable, ParametrizedAsset

public class DebugBehavior
extends ReusableAtomicBehavior
implements java.lang.Runnable

A RAB to start debugging behaviour for an UbiwareAgent.

In addition to invoking the GUI and passing the instances required, this RAB also operates as a scheduler in order to deliver events from the Swing-thread(s) to the agent thread in a synchronized and safe manner.

It is guaranteed that events/tasks delivered to this RAB will be forwarded to the agent (when the time comes) in the order that they were delivered to this RAB.

Author:
Nikos Mouchtaris

Field Summary
 UbiwareAgent.DebugController debugController
          Will be set by UbiwareAgent.
 
Fields inherited from class ubiware.core.ReusableAtomicBehavior
finished, myAgent
 
Constructor Summary
DebugBehavior()
          Creates a new instance of this RAB.
 
Method Summary
 void doAction()
           Invokes VisualizerPrototype in the Swing event despatch thread.
protected  void initializeRAB(BehaviorStartParameters parameters)
          Checks the parameters given to this RAB and extracts information for the execution of this RAB.
 void invokeLater(java.lang.Runnable r)
          Adds the given Runnable in the queue for execution.
 boolean isInitialStop()
          Returns whether this behaviour will stop the agent as soon as it is started and able to.
 void run()
          Creates and makes visible the GUI.
 
Methods inherited from class ubiware.core.ReusableAtomicBehavior
addBeliefs, addBeliefsN3, addBeliefsN3, addBeliefsN3, addCommand, addOnBlackboard, block, block, done, equals, eraseBeliefs, getFromBlackboard, getStatements, getStatements, hasBeenExecuted, hasBeliefs, hasBeliefs, hasBeliefsN3, hasBeliefsN3, hasBeliefsN3, hasBeliefsN3, hashCode, hasSucceededTillNow, moveBeliefs, onRABEnd, print, printError, produceN3, produceN3, produceN3Document, produceN3Document, removeBeliefs, removeBeliefsN3, removeBeliefsN3, removeFromBlackboard, restart, sendMessage, sendMessage, setFailed, setStartParameters, wakeAgent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugController

public UbiwareAgent.DebugController debugController
Will be set by UbiwareAgent.

Constructor Detail

DebugBehavior

public DebugBehavior()
Creates a new instance of this RAB.

The RAB parameters that this RAB accepts and understands are:

Method Detail

run

public void run()
Creates and makes visible the GUI.

Specified by:
run in interface java.lang.Runnable

doAction

public void doAction()

Invokes VisualizerPrototype in the Swing event despatch thread.

Specified by:
doAction in class ReusableAtomicBehavior

initializeRAB

protected void initializeRAB(BehaviorStartParameters parameters)
                      throws IllegalParameterConfigurationException
Checks the parameters given to this RAB and extracts information for the execution of this RAB.

Specified by:
initializeRAB in class ReusableAtomicBehavior
Parameters:
parameters - The parameters specified by the user of this RAB.
Throws:
IllegalParameterConfigurationException - If one of the parameters isn't correctly given.

invokeLater

public void invokeLater(java.lang.Runnable r)
Adds the given Runnable in the queue for execution. It will be executed the next time this RAB will be invoked.

Parameters:
r - a task to be executed next time this RAB is executed (probably on the Agent's thread)

isInitialStop

public boolean isInitialStop()
Returns whether this behaviour will stop the agent as soon as it is started and able to.

Returns:
whether this behaviour will stop the agent as soon as it is started and able to.