24 package org.lightjason.agentspeak.configuration;
26 import org.apache.commons.lang3.StringUtils;
41 import javax.annotation.Nonnull;
42 import javax.annotation.Nullable;
43 import java.text.MessageFormat;
44 import java.util.Collection;
45 import java.util.Collections;
46 import java.util.Objects;
48 import java.util.logging.Logger;
49 import java.util.stream.Stream;
106 @Nonnull
final Set<IPlan> p_plans, @Nonnull
final Set<IRule> p_rules,
110 this( p_fuzzy, p_initalbeliefs, p_plans, p_rules, p_initialgoal, p_unifier,
IVariableBuilder.
EMPTY );
125 @Nonnull
final Set<IPlan> p_plans, @Nonnull
final Set<IRule> p_rules,
131 m_unifier = p_unifier;
132 m_variablebuilder = p_variablebuilder;
134 m_plans = Collections.unmodifiableSet( p_plans );
135 m_rules = Collections.unmodifiableSet( p_rules );
136 m_initialbeliefs = Collections.unmodifiableCollection( p_initialbeliefs );
139 LOGGER.info( MessageFormat.format(
"create agent configuration: {0}",
this ) );
147 m_initialbeliefs.forEach( i -> l_beliefbase.
add( i.shallowcopy() ) );
207 final String l_elements = StringUtils.join(
212 m_plans.isEmpty() ?
"" :
m_plans,
213 m_rules.isEmpty() ?
"" :
m_rules 214 ).filter( i -> !i.toString().trim().isEmpty() ).toArray(),
218 return MessageFormat.format(
219 "{0} ( unifier: {1} / {2} {3} )",
223 l_elements.isEmpty() ?
"" : l_elements
final Collection< ILiteral > initialbeliefs()
final IUnifier m_unifier
unifier instance
final Collection< ILiteral > m_initialbeliefs
instance of initial beliefs
static final String BELIEFBASEROOTNAME
name of the root beliefbase
Stream< ITrigger > trigger()
retruns all trigger of the beliefbase
final IFuzzyBundle< Boolean > m_fuzzy
fuzzy operator
interface of logical rule
interface of an unification algorithm
final Set< IRule > rules()
static ITrigger from( @Nonnull final EType p_event, @Nonnull final ILiteral p_literal)
creates a trigger event^
view for a beliefbase that creates any access to the underlying data structures
static final Logger LOGGER
logger
static Logger logger(final Class<?> p_class)
returns a logger instance
default agent configuration
final ITrigger m_initialgoal
initial goal trigger
CDefaultAgentConfiguration( @Nonnull final IFuzzyBundle< Boolean > p_fuzzy, @Nonnull final Collection< ILiteral > p_initialbeliefs, @Nonnull final Set< IPlan > p_plans, @Nonnull final Set< IRule > p_rules, final ILiteral p_initialgoal, @Nonnull final IUnifier p_unifier, @Nonnull final IVariableBuilder p_variablebuilder)
ctor
thread-safe storage of the data of single- and multi-elements
final IVariableBuilder variablebuilder()
final Set< IPlan > plans()
interface to define the agent configuration
final IVariableBuilder m_variablebuilder
instance of variable builder
final Set< IRule > m_rules
rules
interface for a variable builder which is called on each plan / rule execution
class for any helper calls
final IFuzzyBundle< Boolean > fuzzy()
final Set< IPlan > m_plans
instance of agent plans
final IView create( @Nonnull final String p_name)
returns a new view of the belief base
IView add( @Nonnull final ILiteral... p_literal)
adds a literal in the current structure
CDefaultAgentConfiguration( @Nonnull final IFuzzyBundle< Boolean > p_fuzzy, @Nonnull final Collection< ILiteral > p_initalbeliefs, @Nonnull final Set< IPlan > p_plans, @Nonnull final Set< IRule > p_rules, @Nullable final ILiteral p_initialgoal, @Nonnull final IUnifier p_unifier)
ctor
final ITrigger initialgoal()
beliefbase to generate any event-based data by reference counting
IVariableBuilder EMPTY
empty variable builder