LightJason - AgentSpeak(L++)
org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?> Class Template Referenceabstract

agent base structure More...

+ Inheritance diagram for org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>:
+ Collaboration diagram for org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>:

Public Member Functions

 IBaseAgent ( @Nonnull final IAgentConfiguration< T > p_configuration)
 ctor More...
 
final IView beliefbase ()
 
call () throws Exception
 
final long cycletime ()
 
final IFuzzyBundle< Boolean > fuzzy ()
 
final< N extends IInspector > Stream< N > inspect ( @Nonnull final N... p_inspector)
 
final Multimap< ITrigger, IPlanStatisticplans ()
 
final< N extends IAgent<?> > N raw ()
 
final Multimap< IPath, IRulerules ()
 
final Multimap< IPath, ILiteralrunningplans ()
 
final IAgent< T > sleep (final long p_cycles, final ITerm... p_term)
 
final IAgent< T > sleep (final long p_cycles, @Nonnull final Stream< ITerm > p_literal)
 
final boolean sleeping ()
 
final Map< String, Object > storage ()
 
String toString ()
 
final IFuzzyValue< Boolean > trigger ( @Nonnull final ITrigger p_trigger, @Nullable final boolean... p_immediately)
 
final IUnifier unifier ()
 
final IVariableBuilder variablebuilder ()
 
final IAgent< T > wakeup ( @Nullable final ITerm... p_term)
 
final IAgent< T > wakeup ( @Nonnull final Stream< ITerm > p_term)
 
- Public Member Functions inherited from org.lightjason.agentspeak.agent.IAgent< T >
IView beliefbase ()
 returns the beliefbase More...
 
long cycletime ()
 returns the time in nano seconds at the last cycle More...
 
IFuzzyBundle< Boolean > fuzzy ()
 return fuzzy operator More...
 
< N extends IInspector > Stream< N > inspect (@Nonnull final N... p_inspector)
 inspector method More...
 
Multimap< ITrigger, IPlanStatisticplans ()
 returns the internal map of plans More...
 
< N extends IAgent<?> N raw ()
 cast the interface agent object to a specified agent object More...
 
Multimap< IPath, IRulerules ()
 returns amultimap with literal-rule functor and rle objects More...
 
Multimap< IPath, ILiteralrunningplans ()
 returns a map of the current running plans More...
 
IAgent< T > sleep (final long p_cycles, @Nullable final ITerm... p_term)
 pushs the agent into sleeping state More...
 
IAgent< T > sleep (final long p_cycles, @Nonnull final Stream< ITerm > p_term)
 pushs the agent into sleeping state More...
 
boolean sleeping ()
 returns sleeping state More...
 
Map< String, Object > storage ()
 storage access More...
 
IFuzzyValue< Boolean > trigger (@Nonnull final ITrigger p_trigger, @Nullable final boolean... p_immediately)
 trigger an event More...
 
IUnifier unifier ()
 returns an unifier More...
 
IVariableBuilder variablebuilder ()
 returns the variable builder function More...
 
IAgent< T > wakeup (@Nullable final ITerm... p_term)
 wake-up the agent by generating wakeup-goal More...
 
IAgent< T > wakeup (@Nonnull final Stream< ITerm > p_term)
 wake-up the agent by generating wakeup-goal More...
 

Protected Attributes

final IView m_beliefbase
 beliefbase More...
 
final Multimap< ITrigger, IPlanStatisticm_plans
 map with all existing plans and successful / fail runs More...
 
final Multimap< IPath, IRulem_rules = Multimaps.synchronizedMultimap( LinkedHashMultimap.create() )
 multimap with rules More...
 
final Map< String, Object > m_storage = new ConcurrentHashMap<>()
 storage map More...
 
final Map< Integer, ITriggerm_trigger = new ConcurrentHashMap<>()
 execution trigger with content hash More...
 

Static Protected Attributes

static final Logger LOGGER = org.lightjason.agentspeak.common.CCommon.logger( IAgent.class )
 logger More...
 

Private Member Functions

boolean active (final boolean p_immediatly)
 runs the wakeup goal More...
 
IFuzzyValue< Boolean > execute ( @Nonnull final Collection< Pair< IPlanStatistic, IContext >> p_execution)
 execute list of plans More...
 
Collection< Pair< IPlanStatistic, IContext > > generateexecution ( @Nonnull final Stream< ITrigger > p_trigger)
 create execution list with plan and context More...
 
synchronized Collection< Pair< IPlanStatistic, IContext > > generateexecutionlist ()
 create the plan executionlist with clearing internal structures More...
 

Private Attributes

final AtomicLong m_cycletime = new AtomicLong()
 nano seconds at the last cycle More...
 
final IFuzzyBundle< Boolean > m_fuzzy
 fuzzy result collector More...
 
final Multimap< IPath, ILiteralm_runningplans = Multimaps.synchronizedSetMultimap( HashMultimap.create() )
 running plans (thread-safe) More...
 
final AtomicLong m_sleepingcycles = new AtomicLong( Long.MIN_VALUE )
 number of sleeping cycles More...
 
final Set< ITermm_sleepingterm = Collections.synchronizedSet( new HashSet<>() )
 set for waking-up literals More...
 
final IUnifier m_unifier
 unifier More...
 
final IVariableBuilder m_variablebuilder
 variable builder More...
 

Static Private Attributes

static final long serialVersionUID = -304366902555398136L
 serial id More...
 

Additional Inherited Members

- Public Attributes inherited from org.lightjason.agentspeak.agent.IAgent< T >
IAgent<?> EMPTY
 empty agent More...
 

Detailed Description

Template Parameters
Tagent type

Definition at line 81 of file IBaseAgent.java.

Constructor & Destructor Documentation

◆ IBaseAgent()

org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.IBaseAgent ( @Nonnull final IAgentConfiguration< T >  p_configuration)
Parameters
p_configurationagent configuration

Definition at line 153 of file IBaseAgent.java.

Member Function Documentation

◆ active()

boolean org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.active ( final boolean  p_immediatly)
private
Parameters
p_immediatlyruns the wake always
Returns
returns true if the agent is active

Definition at line 458 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.call(), and org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.wakeup().

+ Here is the caller graph for this function:

◆ beliefbase()

final IView org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.beliefbase ( )

Definition at line 170 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.consistency.TestCMetric.agent().

+ Here is the caller graph for this function:

◆ call()

T org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.call ( ) throws Exception

Definition at line 349 of file IBaseAgent.java.

◆ cycletime()

final long org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.cycletime ( )

Definition at line 265 of file IBaseAgent.java.

◆ execute()

IFuzzyValue<Boolean> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.execute ( @Nonnull final Collection< Pair< IPlanStatistic, IContext >>  p_execution)
private
Parameters
p_executionexecution collection with instantiated plans and context
Returns
fuzzy result for each executaed plan

Definition at line 427 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.call(), and org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.trigger().

+ Here is the caller graph for this function:

◆ fuzzy()

final IFuzzyBundle<Boolean> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.fuzzy ( )

Definition at line 279 of file IBaseAgent.java.

◆ generateexecution()

Collection<Pair<IPlanStatistic, IContext> > org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.generateexecution ( @Nonnull final Stream< ITrigger p_trigger)
private
Parameters
p_triggertrigger stream
Returns
collection with excutable plans, instantiated execution context and plan statistic

Definition at line 400 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.generateexecutionlist(), and org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.trigger().

+ Here is the caller graph for this function:

◆ generateexecutionlist()

synchronized Collection<Pair<IPlanStatistic, IContext> > org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.generateexecutionlist ( )
private
Note
must be synchronized for avoid indeterministic trigger list
Returns
collection with execution plan and context

Definition at line 378 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.call().

+ Here is the caller graph for this function:

◆ inspect()

final<N extends IInspector> Stream<N> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.inspect ( @Nonnull final N...  p_inspector)

Definition at line 179 of file IBaseAgent.java.

◆ plans()

Definition at line 272 of file IBaseAgent.java.

◆ raw()

final<N extends IAgent<?> > N org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.raw ( )

Definition at line 301 of file IBaseAgent.java.

◆ rules()

final Multimap<IPath, IRule> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.rules ( )

Definition at line 293 of file IBaseAgent.java.

◆ runningplans()

final Multimap<IPath, ILiteral> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.runningplans ( )

Definition at line 197 of file IBaseAgent.java.

◆ sleep() [1/2]

final IAgent<T> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.sleep ( final long  p_cycles,
final ITerm...  p_term 
)

Definition at line 210 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.sleep().

+ Here is the caller graph for this function:

◆ sleep() [2/2]

final IAgent<T> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.sleep ( final long  p_cycles,
@Nonnull final Stream< ITerm p_literal 
)

Definition at line 222 of file IBaseAgent.java.

◆ sleeping()

final boolean org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.sleeping ( )

Definition at line 203 of file IBaseAgent.java.

◆ storage()

final Map<String, Object> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.storage ( )

Definition at line 251 of file IBaseAgent.java.

◆ toString()

String org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.toString ( )

Definition at line 307 of file IBaseAgent.java.

◆ trigger()

final IFuzzyValue<Boolean> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.trigger ( @Nonnull final ITrigger  p_trigger,
@Nullable final boolean...  p_immediately 
)

Definition at line 325 of file IBaseAgent.java.

◆ unifier()

Definition at line 258 of file IBaseAgent.java.

◆ variablebuilder()

final IVariableBuilder org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.variablebuilder ( )

Definition at line 286 of file IBaseAgent.java.

◆ wakeup() [1/2]

final IAgent<T> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.wakeup ( @Nullable final ITerm...  p_term)

Definition at line 231 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.wakeup().

+ Here is the caller graph for this function:

◆ wakeup() [2/2]

final IAgent<T> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.wakeup ( @Nonnull final Stream< ITerm p_term)

Definition at line 242 of file IBaseAgent.java.

Member Data Documentation

◆ LOGGER

final Logger org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.LOGGER = org.lightjason.agentspeak.common.CCommon.logger( IAgent.class )
staticprotected

Definition at line 86 of file IBaseAgent.java.

◆ m_beliefbase

◆ m_cycletime

final AtomicLong org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_cycletime = new AtomicLong()
private

Definition at line 117 of file IBaseAgent.java.

◆ m_fuzzy

◆ m_plans

final Multimap<ITrigger, IPlanStatistic> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_plans
protected
Initial value:
= Multimaps.synchronizedMultimap(
TreeMultimap.create( IStructureHash.COMPARATOR, Comparator.<IPlanStatistic>naturalOrder() ) )

Definition at line 112 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.plans().

◆ m_rules

final Multimap<IPath, IRule> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_rules = Multimaps.synchronizedMultimap( LinkedHashMultimap.create() )
protected

◆ m_runningplans

◆ m_sleepingcycles

final AtomicLong org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_sleepingcycles = new AtomicLong( Long.MIN_VALUE )
private
Note
values >= 0 defines the sleeping time, Long.MAX_VALUE is infinity sleeping negative values defines the activity

Definition at line 124 of file IBaseAgent.java.

◆ m_sleepingterm

final Set<ITerm> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_sleepingterm = Collections.synchronizedSet( new HashSet<>() )
private

Definition at line 128 of file IBaseAgent.java.

◆ m_storage

final Map<String, Object> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_storage = new ConcurrentHashMap<>()
protected
Note
must be thread-safe

Definition at line 100 of file IBaseAgent.java.

Referenced by org.lightjason.agentspeak.agent.IBaseAgent< CMethodBindingBlacklist >.storage().

◆ m_trigger

final Map<Integer, ITrigger> org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.m_trigger = new ConcurrentHashMap<>()
protected

◆ m_unifier

◆ m_variablebuilder

◆ serialVersionUID

final long org.lightjason.agentspeak.agent.IBaseAgent< T extends IAgent<?>.serialVersionUID = -304366902555398136L
staticprivate

Definition at line 90 of file IBaseAgent.java.