ubiware.core
Class AgentWrapper

java.lang.Object
  extended by ubiware.core.AgentWrapper
Direct Known Subclasses:
RabRunnable

public class AgentWrapper
extends java.lang.Object

NEVER use this class from inside the UbiwareAgent thread (This means, not from in the thread which goes trough RAB's) This will cause a deadlock! Use in a newly created thread. example:

 
 class RabRunnableExampleBehavior extends ReusableAtomicBehavior {
 
        
        protected void doAction() {
                //........
                new Thread(new RabRunnable(this.myAgent) {
                        
                        public void run() {
                                //access to the agents beliefs
                                this.AddBeliefsN3Blocking(":bill :hasSon :John");
                                //in the next line, we're sure that the beliefs have been added, since this was the blocking variety!
 
                        }
                }).start();
                //..........
 
        }
 
        protected void initializeRAB(BehaviorStartParameters parameters) throws IllegalParameterConfigurationException {...}
 
 }
 
15.3.2010

Author:
Michael Cochez for UBIWARE project

Constructor Summary
AgentWrapper(UbiwareAgent myAgent)
           
 
Method Summary
 void addBeliefsN3(ubiware.util.saplbuilder.SaplDocument doc)
          Add beliefs to the agent, after this call returns, it is guaranteed that the beliefs will be added in the future.
 boolean addBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument doc)
          Add beliefs to the agent, after this call returns, the beliefs are added to the agents beliefs.
 void addCommand(UbiwareAgentCommand<?> command)
          Adds a command to the agent which will be executed in the future.
 BindingsSet hasBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument n3string)
          Check whether the agent has a certain belief and get values bound to variables.
 void removeBeliefsN3(ubiware.util.saplbuilder.SaplDocument n3String)
          Removes beliefs from the agent, after this call returns, it is guaranteed that the beliefs will be removed in the future.
 void removeBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument n3string)
          Remove beliefs from the agent, after this call returns, the beliefs are removed from the agents beliefs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentWrapper

public AgentWrapper(UbiwareAgent myAgent)
Method Detail

addCommand

public void addCommand(UbiwareAgentCommand<?> command)
Adds a command to the agent which will be executed in the future.

Parameters:
command - The command for the Ubiware agent
See Also:
UbiwareAgent.addCommand(UbiwareAgentCommand)

addBeliefsN3

public void addBeliefsN3(ubiware.util.saplbuilder.SaplDocument doc)
Add beliefs to the agent, after this call returns, it is guaranteed that the beliefs will be added in the future. The user cannot expect the add to happen immediately.

Parameters:
n3string - UbiwareAgent.addBeliefsN3(String)

addBeliefsN3Blocking

public boolean addBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument doc)
Add beliefs to the agent, after this call returns, the beliefs are added to the agents beliefs.

Parameters:
n3string - UbiwareAgent.addBeliefsN3(String)
Returns:
UbiwareAgent.addBeliefsN3(String)

removeBeliefsN3

public void removeBeliefsN3(ubiware.util.saplbuilder.SaplDocument n3String)
Removes beliefs from the agent, after this call returns, it is guaranteed that the beliefs will be removed in the future. The user cannot expect the removal to happen immediately.

Parameters:
n3String - UbiwareAgent.removeBeliefsN3(String)

removeBeliefsN3Blocking

public void removeBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument n3string)
Remove beliefs from the agent, after this call returns, the beliefs are removed from the agents beliefs.

Parameters:
n3string - UbiwareAgent.removeBeliefsN3(String)

hasBeliefsN3Blocking

public BindingsSet hasBeliefsN3Blocking(ubiware.util.saplbuilder.SaplDocument n3string)
Check whether the agent has a certain belief and get values bound to variables.

Parameters:
n3string - UbiwareAgent.hasBeliefsN3(String)
Returns:
n3string UbiwareAgent.hasBeliefsN3(String)