public class BDIInterpreter
extends jadex.kernelbase.StatelessAbstractInterpreter
| Modifier and Type | Field and Description |
|---|---|
static Map |
interpreters
The interpreters, one per agent (ragent -> interpreter).
|
static jadex.rules.rulesystem.IRulebase |
RULEBASE
The (global) rulebase.
|
| Constructor and Description |
|---|
BDIInterpreter(IComponentDescription desc,
IComponentAdapterFactory factory,
jadex.rules.state.IOAVState state,
OAVAgentModel model,
String config,
Map<String,Object> arguments,
IExternalAccess parent,
RequiredServiceBinding[] bindings,
Map kernelprops,
boolean copy,
boolean realtime,
IIntermediateResultListener<Tuple2<String,Object>> resultlistener,
Future<Void> inited)
Create an agent interpreter for the given agent.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addArgument(String name,
Object value)
Add a default value for an argument (if not already present).
|
IFuture |
addComponentListener(IComponentListener listener)
Add component listener.
|
void |
addDefaultResult(String name,
Object value)
Add a default value for a result (if not already present).
|
void |
addExtension(String name,
IExtensionInstance ext)
Add an extension instance.
|
void |
addProperty(String name,
Object val)
Add a property value.
|
void |
cleanup()
Called when the agent is removed from the platform.
|
IFuture |
componentCreated(IComponentDescription desc,
IModelInfo model)
Called when a component has been created as a subcomponent of this component.
|
IFuture |
componentDestroyed(IComponentDescription desc)
Called when a subcomponent of this component has been destroyed.
|
IServiceContainer |
createServiceContainer()
Create the service container.
|
static Object |
createServiceImplementation(IBDIInternalAccess agent,
Class<?> type,
String[] methodnames,
String[] goalnames)
Create a wrapper service implementation based on
|
void |
endAtomic()
End an atomic transaction.
|
void |
endMonitorConsequences()
Checks if consequences have been produced and
interrupts the executing plan accordingly.
|
boolean |
executeStep()
Main method to perform agent execution.
|
String |
findServicePrefix(Object scope)
The prefix is the name of the capability starting from the agent.
|
boolean |
findSubcapability(Object rcapa,
Object targetcapa,
List path)
Find the path to a subcapability.
|
Object |
getAgent()
Get the agent instance reference.
|
IComponentAdapter |
getAgentAdapter()
Get the adapter agent.
|
Map |
getArguments()
Get the arguments.
|
RequiredServiceBinding[] |
getBindings()
Get the bindings.
|
ClassLoader |
getClassLoader()
Get the class loader of the agent.
|
IClockService |
getClockService()
Get the cached clock service.
|
IComponentManagementService |
getCMS()
Get the cached component management service.
|
IComponentAdapter |
getComponentAdapter()
Get the component adapter.
|
IComponentListener[] |
getComponentListeners()
Get the component listeners.
|
String |
getConfiguration()
Get the configuration.
|
Object |
getCurrentPlan()
Get the currently executed plan.
|
EventReificator |
getEventReificator()
Get the event reificator for generating change events.
|
IExtensionInstance |
getExtension(String name)
Get a space of the application.
|
IExtensionInstance[] |
getExtensions()
Get a space of the application.
|
IExternalAccess |
getExternalAccess()
Get the external access for this agent.
|
IValueFetcher |
getFetcher()
Get the value fetcher.
|
Object |
getFlyweightCache(Class type,
Object key)
Get an element from the cache.
|
IInternalAccess |
getInternalAccess()
Get the internal access.
|
Collection |
getInternalComponentListeners()
Get the component listeners.
|
static BDIInterpreter |
getInterpreter(jadex.rules.state.IOAVState state)
Get the interpreter for an agent object.
|
Map |
getKernelProperties()
Get the kernel properties.
|
Logger |
getLogger(Object rcapa)
Get the logger.
|
IMessageService |
getMessageService()
Get the cached message service.
|
IModelInfo |
getModel()
Get the model info.
|
IModelInfo |
getModel(Object rcapa)
Get the model info of a capability
|
IExternalAccess |
getParent()
Get the parent of the agent.
|
IPlanExecutor |
getPlanExecutor(Object rplan)
Get a plan executor by name.
|
Map |
getProperties()
Get the properties.
|
Map |
getProperties(Object rcapa)
Get the properties for a subcapability.
|
Map<String,Object> |
getResults()
Get the results of the component (considering it as a functionality).
|
jadex.rules.rulesystem.RuleSystem |
getRuleSystem()
Get the rule system.
|
IServiceContainer |
getServiceContainer()
Create the service container.
|
String |
getServicePrefix()
Get the service prefix.
|
jadex.rules.state.IOAVState |
getState()
Get the agent state.
|
IFuture |
init(IModelInfo model,
String config)
Extended init procedure including subcapabilities.
|
IFuture |
initArguments(IModelInfo model,
String config,
Map arguments)
Init the arguments and results.
|
IFuture |
initServices(IModelInfo model,
String config)
Overridden to init BDI internals before services.
|
void |
invokeSynchronized(Runnable code)
Invoke some code with agent behaviour synchronized on the agent.
|
boolean |
isAtBreakpoint(String[] breakpoints)
Test if the component's execution is currently at one of the
given breakpoints.
|
boolean |
isAtomic()
Check if atomic state is enabled.
|
boolean |
isCopy()
Get the copy.
|
boolean |
isExternalThread()
Check if the external thread is accessing.
|
boolean |
isPlanThread()
Check if the agent thread is accessing.
|
boolean |
isRealtime()
Get the realtime.
|
void |
messageArrived(IMessageAdapter message)
Inform the agent that a message has arrived.
|
void |
putFlyweightCache(Class type,
Object key,
Object flyweight)
Put an element into the cache.
|
IFuture |
removeComponentListener(IComponentListener listener)
Remove component listener.
|
IFuture |
scheduleImmediate(IComponentStep step,
Object scope)
Execute some code on the component's thread.
|
<T> IFuture<T> |
scheduleStep(IComponentStep<T> step)
Schedule a step of the component.
|
<T> IFuture<T> |
scheduleStep(Object step,
Object scope)
Schedule a step of the agent.
|
void |
setPlanThread(Thread planthread)
Set the current plan thread.
|
void |
setResultValue(String name,
Object value)
Set a result value.
|
void |
startAtomic()
Start an atomic transaction.
|
void |
startBehavior()
Start the component behavior.
|
IFuture<Void> |
startEndSteps()
Request agent to kill itself.
|
void |
startMonitorConsequences()
Start monitoring the consequences.
|
IFuture |
startServiceContainer()
Start the services.
|
void |
streamArrived(IConnection con)
Inform the agent that a message has arrived.
|
addService, cleanupComponent, createComponent, createResultListener, createResultListener, getArguments, getChildren, getChildrenAccesses, getChildrenIdentifiers, getComponentDescription, getComponentFilename, getComponentIdentifier, getLocalType, getLogger, getName, getName, getNumber, getProperty, getRawService, getRawService, getRawServices, getServiceProvider, init, initComponents, initExtension, initExtensions, initFutureProperties, isComponentThread, killComponent, notifyListeners, startInitialSteps, terminateExtensions, terminateServiceContainer, toString, waitForDelaypublic static Map interpreters
public static final jadex.rules.rulesystem.IRulebase RULEBASE
public BDIInterpreter(IComponentDescription desc, IComponentAdapterFactory factory, jadex.rules.state.IOAVState state, OAVAgentModel model, String config, Map<String,Object> arguments, IExternalAccess parent, RequiredServiceBinding[] bindings, Map kernelprops, boolean copy, boolean realtime, IIntermediateResultListener<Tuple2<String,Object>> resultlistener, Future<Void> inited)
state - The state.magent - The reference to the agent model in the state.config - The name of the configuration (or null for default configuration)arguments - The arguments for the agent as name/value pairs.public void startBehavior()
startBehavior in interface IComponentInstancestartBehavior in class jadex.kernelbase.StatelessAbstractInterpreterpublic IFuture init(IModelInfo model, String config)
public IFuture initServices(IModelInfo model, String config)
initServices in class jadex.kernelbase.StatelessAbstractInterpreterpublic IFuture startServiceContainer()
startServiceContainer in class jadex.kernelbase.StatelessAbstractInterpreterpublic boolean executeStep()
executeStep in interface IComponentInstanceexecuteStep in class jadex.kernelbase.StatelessAbstractInterpreterpublic void messageArrived(IMessageAdapter message)
messageArrived in interface IComponentInstancemessageArrived in class jadex.kernelbase.StatelessAbstractInterpretermessage - The message that arrived.public void streamArrived(IConnection con)
streamArrived in interface IComponentInstancestreamArrived in class jadex.kernelbase.StatelessAbstractInterpretermessage - The message that arrived.public IFuture<Void> startEndSteps()
startEndSteps in class jadex.kernelbase.StatelessAbstractInterpreterpublic IExternalAccess getExternalAccess()
getExternalAccess in interface IComponentInstancegetExternalAccess in class jadex.kernelbase.StatelessAbstractInterpreterlistener - When cleanup of the agent is finished, the listener must be notified.public ClassLoader getClassLoader()
getClassLoader in interface IComponentInstancegetClassLoader in class jadex.kernelbase.StatelessAbstractInterpreterpublic void cleanup()
public IFuture componentCreated(IComponentDescription desc, IModelInfo model)
componentCreated in interface IComponentInstancecomponentCreated in class jadex.kernelbase.StatelessAbstractInterpretercomp - The newly created component.public IFuture componentDestroyed(IComponentDescription desc)
componentDestroyed in interface IComponentInstancecomponentDestroyed in class jadex.kernelbase.StatelessAbstractInterpretercomp - The destroyed component.public boolean isAtBreakpoint(String[] breakpoints)
isAtBreakpoint in interface IComponentInstanceisAtBreakpoint in class jadex.kernelbase.StatelessAbstractInterpreterbreakpoints - An array of breakpoints.public boolean findSubcapability(Object rcapa, Object targetcapa, List path)
rcapa - The start capability.targetcapa - The target capability.path - The result path as list of capas.public Object getAgent()
public jadex.rules.rulesystem.RuleSystem getRuleSystem()
public IPlanExecutor getPlanExecutor(Object rplan)
rplan - The rplan.public IComponentAdapter getAgentAdapter()
public jadex.rules.state.IOAVState getState()
public IClockService getClockService()
public IComponentManagementService getCMS()
public IMessageService getMessageService()
public void invokeSynchronized(Runnable code)
code - The code to execute.
The method will block the externally calling thread until the
action has been executed on the agent thread.
If the agent does not accept external actions (because of termination)
the method will directly fail with a runtime exception.
Note: 1.4 compliant code.
Problem: Deadlocks cannot be detected and no exception is thrown.public <T> IFuture<T> scheduleStep(IComponentStep<T> step)
scheduleStep in class jadex.kernelbase.StatelessAbstractInterpreterstep - Code to be executed as a step of the component.public <T> IFuture<T> scheduleStep(Object step, Object scope)
step - Code to be executed as a step of the agent.public IFuture scheduleImmediate(IComponentStep step, Object scope)
action - Code to be executed on the component's thread.public void setPlanThread(Thread planthread)
planthread - The planthread.public boolean isPlanThread()
public boolean isExternalThread()
isExternalThread in interface IComponentInstanceisExternalThread in class jadex.kernelbase.StatelessAbstractInterpreterpublic Object getCurrentPlan()
public EventReificator getEventReificator()
public void startMonitorConsequences()
public void endMonitorConsequences()
public void startAtomic()
endAtomic()public void endAtomic()
startAtomic()public boolean isAtomic()
public Map getKernelProperties()
public void putFlyweightCache(Class type, Object key, Object flyweight)
public Object getFlyweightCache(Class type, Object key)
public IExternalAccess getParent()
public IServiceContainer getServiceContainer()
getServiceContainer in interface IComponentInstancegetServiceContainer in class jadex.kernelbase.StatelessAbstractInterpreterpublic static BDIInterpreter getInterpreter(jadex.rules.state.IOAVState state)
public IComponentAdapter getComponentAdapter()
getComponentAdapter in class jadex.kernelbase.StatelessAbstractInterpreterpublic IModelInfo getModel()
getModel in class jadex.kernelbase.StatelessAbstractInterpreterpublic String getConfiguration()
getConfiguration in class jadex.kernelbase.StatelessAbstractInterpreterpublic IModelInfo getModel(Object rcapa)
rcapa - The capability.public IValueFetcher getFetcher()
getFetcher in class jadex.kernelbase.StatelessAbstractInterpreterpublic IFuture initArguments(IModelInfo model, String config, Map arguments)
initArguments in class jadex.kernelbase.StatelessAbstractInterpreterpublic boolean addArgument(String name, Object value)
addArgument in class jadex.kernelbase.StatelessAbstractInterpretername - The argument name.value - The argument value.public void addDefaultResult(String name, Object value)
addDefaultResult in class jadex.kernelbase.StatelessAbstractInterpretername - The result name.value - The result value.public IInternalAccess getInternalAccess()
getInternalAccess in class jadex.kernelbase.StatelessAbstractInterpreterpublic IComponentListener[] getComponentListeners()
getComponentListeners in class jadex.kernelbase.StatelessAbstractInterpreterpublic IFuture removeComponentListener(IComponentListener listener)
removeComponentListener in class jadex.kernelbase.StatelessAbstractInterpreterpublic IFuture addComponentListener(IComponentListener listener)
addComponentListener in class jadex.kernelbase.StatelessAbstractInterpreterpublic void addExtension(String name, IExtensionInstance ext)
addExtension in class jadex.kernelbase.StatelessAbstractInterpreterextension - The extension instance.public IExtensionInstance getExtension(String name)
getExtension in class jadex.kernelbase.StatelessAbstractInterpretername - The name of the space.public IExtensionInstance[] getExtensions()
getExtensions in class jadex.kernelbase.StatelessAbstractInterpretername - The name of the space.public Map getProperties()
getProperties in class jadex.kernelbase.StatelessAbstractInterpreterpublic Map getProperties(Object rcapa)
public void addProperty(String name, Object val)
addProperty in class jadex.kernelbase.StatelessAbstractInterpretername - The name.val - The value.public Map getArguments()
getArguments in class jadex.kernelbase.StatelessAbstractInterpreterpublic Collection getInternalComponentListeners()
getInternalComponentListeners in class jadex.kernelbase.StatelessAbstractInterpreterpublic String getServicePrefix()
getServicePrefix in class jadex.kernelbase.StatelessAbstractInterpreterpublic RequiredServiceBinding[] getBindings()
getBindings in class jadex.kernelbase.StatelessAbstractInterpreterpublic String findServicePrefix(Object scope)
public boolean isCopy()
isCopy in class jadex.kernelbase.StatelessAbstractInterpreterpublic IServiceContainer createServiceContainer()
createServiceContainer in class jadex.kernelbase.StatelessAbstractInterpreterpublic Map<String,Object> getResults()
getResults in interface IComponentInstancegetResults in class jadex.kernelbase.StatelessAbstractInterpreterpublic void setResultValue(String name, Object value)
name - The result name.value - The result value.public boolean isRealtime()
isRealtime in class jadex.kernelbase.StatelessAbstractInterpreterpublic static Object createServiceImplementation(IBDIInternalAccess agent, Class<?> type, String[] methodnames, String[] goalnames)
Copyright © 2012. All Rights Reserved.