public class BDIXAgentFeature extends AbstractComponentFeature implements IBDIXAgentFeature
Modifier and Type | Class and Description |
---|---|
static class |
BDIXAgentFeature.ChangeInfoEntryMapper
Map a change info as Map:Entry.
|
static class |
BDIXAgentFeature.GoalsExistCondition
Condition that tests if goal instances of an mgoal exist.
|
static class |
BDIXAgentFeature.LifecycleStateCondition
Condition for checking the lifecycle state of a goal.
|
static class |
BDIXAgentFeature.PlansExistCondition
Condition that tests if goal instances of an mplan exist.
|
Modifier and Type | Field and Description |
---|---|
protected IBDIModel |
bdimodel
The bdi model.
|
protected RCapability |
capa
The bdi state.
|
static IComponentFeatureFactory |
FACTORY |
protected RuleSystem |
rulesystem
The rule system.
|
Constructor and Description |
---|
BDIXAgentFeature(IInternalAccess component,
ComponentCreationInfo cinfo)
Factory method constructor for instance level.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.Object |
adaptToCapability(java.lang.Object obj,
java.lang.String capa,
IBDIModel bdimodel)
Adapt element for use in inner capabilities.
|
static void |
addBeliefEvents(IInternalAccess ia,
java.util.List<EventType> events,
java.lang.String belname)
Create belief events from a belief name.
|
void |
addBeliefListener(java.lang.String name,
IBeliefListener listener)
Add a belief listener.
|
static void |
addInitArgs(java.lang.Object obj,
java.lang.Class<?> clazz,
java.lang.Class<?>[] argtypes,
java.lang.Object[] args)
Add an entry to the init calls.
|
static void |
createChangeEvent(java.lang.Object val,
java.lang.Object oldval,
java.lang.Object info,
IInternalAccess agent,
java.lang.String belname)
Caution: this method is used from byte engineered code, change signature with caution
Create a belief changed event.
|
static EventType |
createEventType(RawEvent rawev) |
protected void |
doCleanup()
Cleanup the beliefs in kill and shutdown.
|
IModelInfo |
getAgentModel()
Get the agent model.
|
java.lang.String |
getAgentName()
Get the agent name.
|
static IBDIXAgentFeature |
getBDIAgentFeature(IInternalAccess agent)
Get the feature from the agent.
|
IBDIModel |
getBDIModel()
Get the bdimodel.
|
IBeliefbase |
getBeliefbase()
Get the belief base.
|
protected static java.lang.String |
getBeliefName(java.lang.Object obj,
java.lang.String fieldname) |
RCapability |
getCapability()
Get the state.
|
java.lang.ClassLoader |
getClassLoader()
Get the classloader.
|
IComponentDescription |
getComponentDescription()
Get the component description.
|
IComponentIdentifier |
getComponentIdentifier()
Get the agent identifier.
|
java.lang.String |
getConfigurationName()
Get the configuration name.
|
java.util.List<IMonitoringEvent> |
getCurrentStateEvents()
Get the current state as events.
|
java.util.Map<EventType,IResultCommand<IFuture<java.lang.Void>,PropertyChangeEvent>> |
getEventAdders()
Get the event type.
|
IEventbase |
getEventbase()
Get the event base.
|
IExpressionbase |
getExpressionbase()
Get the expression base.
|
IExternalAccess |
getExternalAccess()
Get the scope.
|
IGoalbase |
getGoalbase()
Get the goal base.
|
static java.util.List<EventType> |
getGoalEvents(MGoal mgoal)
Create goal events for a goal name.
|
static java.lang.Object[] |
getInjectionValues(java.lang.Class<?>[] ptypes,
java.lang.annotation.Annotation[][] anns,
MElement melement,
ChangeEvent event,
RPlan rplan,
RProcessableElement rpe,
java.util.Collection<java.lang.Object> vs,
IInternalAccess component)
Get parameter values for injection into method and constructor calls.
|
static java.lang.Object[] |
getInjectionValues(java.lang.Class<?>[] ptypes,
java.lang.annotation.Annotation[][] anns,
MElement melement,
ChangeEvent event,
RPlan rplan,
RProcessableElement rpe,
IInternalAccess component)
Get parameter values for injection into method and constructor calls.
|
java.util.logging.Logger |
getLogger()
Get the logger.
|
IModelInfo |
getModel()
Get the capability model.
|
IPlanbase |
getPlanbase()
Get the plan base.
|
RuleSystem |
getRuleSystem()
Get the rulesystem.
|
long |
getTime()
Get the current time.
|
IValueFetcher |
getValueFetcher()
Get the value fetcher.
|
boolean |
hasUserBody()
Check if the feature potentially executed user code in body.
|
IFuture<java.lang.Void> |
init()
Initialize the feature.
|
protected boolean |
isComponentThread() |
void |
kill()
Called on init failure.
|
IFuture<java.util.Map<java.lang.String,java.lang.Object>> |
killAgent()
Kill the agent.
|
static void |
publishToolBeliefEvent(IInternalAccess ia,
MBelief mbel) |
static java.util.List<EventType> |
readAnnotationEvents(IInternalAccess ia,
java.lang.annotation.Annotation[][] annos)
Read the annotation events from method annotations.
|
void |
removeBeliefListener(java.lang.String name,
IBeliefListener listener)
Remove a belief listener.
|
IFuture<java.lang.Void> |
shutdown()
Called on shutdown after successful init.
|
ISubscriptionIntermediateFuture<IMonitoringEvent> |
subscribeToEvents(IFilter<IMonitoringEvent> filter,
boolean initial,
IMonitoringService.PublishEventLevel elm)
Subscribe to monitoring events.
|
protected void |
testBodyAborted(RPlan rplan)
Check if plan is already aborted.
|
protected void |
wrapCollections(MCapability mcapa,
java.lang.Object agent) |
public static final IComponentFeatureFactory FACTORY
protected IBDIModel bdimodel
protected RuleSystem rulesystem
protected RCapability capa
public BDIXAgentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
public IFuture<java.lang.Void> init()
public boolean hasUserBody()
public IFuture<java.lang.Void> shutdown()
public void kill()
protected void doCleanup()
public static void addInitArgs(java.lang.Object obj, java.lang.Class<?> clazz, java.lang.Class<?>[] argtypes, java.lang.Object[] args)
obj
- object instance that owns the field __initargsclazz
- Class definition of the obj objectargtypes
- Signature of the init methodargs
- Actual argument values for the init methodpublic static void createChangeEvent(java.lang.Object val, java.lang.Object oldval, java.lang.Object info, IInternalAccess agent, java.lang.String belname)
val
- The new value.agent
- The agent.belname
- The belief name.public static void publishToolBeliefEvent(IInternalAccess ia, MBelief mbel)
protected static java.lang.String getBeliefName(java.lang.Object obj, java.lang.String fieldname)
protected boolean isComponentThread()
protected static java.lang.Object adaptToCapability(java.lang.Object obj, java.lang.String capa, IBDIModel bdimodel)
obj
- The object to adapt (e.g. a change event)capa
- The capability name or null for agent.protected void wrapCollections(MCapability mcapa, java.lang.Object agent)
public void addBeliefListener(java.lang.String name, IBeliefListener listener)
name
- The belief name.listener
- The belief listener.public void removeBeliefListener(java.lang.String name, IBeliefListener listener)
name
- The belief name.listener
- The belief listener.protected void testBodyAborted(RPlan rplan)
public static java.lang.Object[] getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, RPlan rplan, RProcessableElement rpe, IInternalAccess component)
public static java.lang.Object[] getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, RPlan rplan, RProcessableElement rpe, java.util.Collection<java.lang.Object> vs, IInternalAccess component)
public RuleSystem getRuleSystem()
public IBDIModel getBDIModel()
public RCapability getCapability()
public static void addBeliefEvents(IInternalAccess ia, java.util.List<EventType> events, java.lang.String belname)
public static java.util.List<EventType> getGoalEvents(MGoal mgoal)
public static java.util.List<EventType> readAnnotationEvents(IInternalAccess ia, java.lang.annotation.Annotation[][] annos)
public java.util.List<IMonitoringEvent> getCurrentStateEvents()
public static EventType createEventType(RawEvent rawev)
public static IBDIXAgentFeature getBDIAgentFeature(IInternalAccess agent)
public IValueFetcher getValueFetcher()
public java.util.Map<EventType,IResultCommand<IFuture<java.lang.Void>,PropertyChangeEvent>> getEventAdders()
public IExternalAccess getExternalAccess()
getExternalAccess
in interface ICapability
public IBeliefbase getBeliefbase()
getBeliefbase
in interface ICapability
public IEventbase getEventbase()
getEventbase
in interface ICapability
public IGoalbase getGoalbase()
getGoalbase
in interface ICapability
public IPlanbase getPlanbase()
getPlanbase
in interface ICapability
public IExpressionbase getExpressionbase()
getExpressionbase
in interface ICapability
public java.util.logging.Logger getLogger()
getLogger
in interface ICapability
public IModelInfo getAgentModel()
getAgentModel
in interface ICapability
public IModelInfo getModel()
getModel
in interface ICapability
public java.lang.String getAgentName()
getAgentName
in interface ICapability
public java.lang.String getConfigurationName()
getConfigurationName
in interface ICapability
public IComponentIdentifier getComponentIdentifier()
getComponentIdentifier
in interface ICapability
public IComponentDescription getComponentDescription()
getComponentDescription
in interface ICapability
public long getTime()
System.currentTimeMillis()
, i.e.,
the value of milliseconds passed since 0:00 'o clock, January 1st, 1970, UTC.
For custom simulation clocks, arbitrary representations can be used.getTime
in interface ICapability
public java.lang.ClassLoader getClassLoader()
getClassLoader
in interface ICapability
public IFuture<java.util.Map<java.lang.String,java.lang.Object>> killAgent()
killAgent
in interface ICapability
public ISubscriptionIntermediateFuture<IMonitoringEvent> subscribeToEvents(IFilter<IMonitoringEvent> filter, boolean initial, IMonitoringService.PublishEventLevel elm)
subscribeToEvents
in interface ICapability
filter
- An optional filter.