Class MBelief


public class MBelief extends MElement
Belief model.
  • Field Details

    • AUTOCLOSABLE

      public static final Class<?> AUTOCLOSABLE
      The autoclosable class, if present.
    • ftarget

      protected jadex.common.FieldInfo ftarget
      The field target.
    • mgetter

      protected jadex.common.MethodInfo mgetter
      The method targets.
    • msetter

      protected jadex.common.MethodInfo msetter
    • impl

      protected String impl
      The collection implementation class.
    • updaterate

      protected jadex.common.UnparsedExpression updaterate
      The update rate.
    • multi

      protected Boolean multi
      Flag if is multi.
    • beliefevents

      protected Set<String> beliefevents
      The events this belief depends on.
    • rawevents

      protected Collection<jadex.rules.eca.EventType> rawevents
      The raw events.
    • events

      protected List<jadex.rules.eca.EventType> events
      The aggregated/inited events.
    • fact

      protected jadex.common.UnparsedExpression fact
      The default fact.
    • facts

      protected List<jadex.common.UnparsedExpression> facts
      The default facts (multi).
    • clazz

      protected jadex.common.ClassInfo clazz
      The type (if explicitly specified).
    • exported

      protected boolean exported
      The exported / argument flag.
    • result

      protected boolean result
      The result flag.
    • ref

      protected String ref
      The reference.
    • evaluationmode

      protected MParameter.EvaluationMode evaluationmode
      The direction.
  • Constructor Details

    • MBelief

      public MBelief()
      Bean Constructor.
    • MBelief

      public MBelief(jadex.common.FieldInfo target, String impl, boolean dynamic, jadex.common.UnparsedExpression updaterate, Set<String> beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
    • MBelief

      public MBelief(jadex.common.FieldInfo target, String impl, boolean dynamic, long updaterate, Set<String> beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
    • MBelief

      public MBelief(jadex.common.FieldInfo target, String impl, boolean dynamic, long updaterate, String[] beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
    • MBelief

      public MBelief(jadex.common.MethodInfo target, String impl, boolean dynamic, jadex.common.UnparsedExpression updaterate, Set<String> beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
    • MBelief

      public MBelief(jadex.common.MethodInfo target, String impl, boolean dynamic, long updaterate, Set<String> beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
    • MBelief

      public MBelief(jadex.common.MethodInfo target, String impl, boolean dynamic, long updaterate, String[] beliefevents, Collection<jadex.rules.eca.EventType> rawevents)
      Create a new belief.
  • Method Details

    • adaptEvaluationMode

      protected void adaptEvaluationMode()
      Adapt the evaluation mode according to the
    • getImplClassName

      public String getImplClassName()
      Get the impl.
      Returns:
      The impl.
    • setImplClassName

      public void setImplClassName(String impl)
      Set the impl.
      Parameters:
      impl - The impl to set.
    • isDynamic

      public boolean isDynamic()
      Get the dynamic.
      Returns:
      The dynamic.
    • isExported

      public boolean isExported()
      Get the exported flag.
      Returns:
      The exported flag.
    • setExported

      public void setExported(boolean exported)
      Set the exported flag.
      Parameters:
      exported - The exported to set.
    • isResult

      public boolean isResult()
      Get the result flag.
      Returns:
      The result flag.
    • setResult

      public void setResult(boolean result)
      Set the result flag.
      Parameters:
      result - The result to set.
    • getRef

      public String getRef()
      Get the reference. For belief references.
      Returns:
      The reference.
    • setRef

      public void setRef(String reference)
      Set the reference.
      Parameters:
      reference - The reference to set.
    • getUpdateRate

      public jadex.common.UnparsedExpression getUpdateRate()
      Get the updaterate.
      Returns:
      The updaterate
    • setUpdateRate

      public void setUpdateRate(jadex.common.UnparsedExpression updaterate)
      The updaterate to set.
      Parameters:
      updaterate - The updaterate to set
    • getUpdaterateValue

      public long getUpdaterateValue()
      Get/Evaluate the updaterate value.
      Parameters:
      agent - The agent.
      Returns:
      The update rate.
    • setGetter

      public void setGetter(jadex.common.MethodInfo mgetter)
      Set the mgetter.
      Parameters:
      mgetter - The mgetter to set.
    • setSetter

      public void setSetter(jadex.common.MethodInfo msetter)
      Set the msetter.
      Parameters:
      msetter - The msetter to set.
    • getClazz

      public jadex.common.ClassInfo getClazz()
      Get the clazz.
      Returns:
      The clazz
    • setClazz

      public void setClazz(jadex.common.ClassInfo clazz)
      The clazz to set.
      Parameters:
      clazz - The clazz to set
    • isFieldBelief

      public boolean isFieldBelief()
      Test if this belief refers to a field.
      Returns:
      True if is a field belief.
    • isMulti

      public boolean isMulti(ClassLoader cl)
      Get the multi.
      Returns:
      The multi.
    • setMulti

      public void setMulti(boolean multi)
      The multi to set.
      Parameters:
      multi - The multi to set
    • getValue

      public Object getValue()
      Get the value of the belief.
    • getValue

      public Object getValue(Object object, ClassLoader cl)
      Get the value of the belief.
    • setValue

      public boolean setValue(Object value)
      Set the value of the belief.
      Returns:
      True, if field was set.
    • setValue

      public boolean setValue(Object object, Object value, ClassLoader cl)
      Set the value of the belief.
    • cleanup

      public void cleanup()
      Cleanup the value on agent shutdown, i.e., call close() on closeable fact objects.
    • getType

      public Class<?> getType(ClassLoader cl)
      Get the class of the belief.
    • getField

      public jadex.common.FieldInfo getField()
      Get the field (for field-backed beliefs).
    • getGetter

      public jadex.common.MethodInfo getGetter()
      Get the getter method (for method-backed beliefs).
    • getSetter

      public jadex.common.MethodInfo getSetter()
      Get the setter method (for method-backed beliefs).
    • isArrayBelief

      public boolean isArrayBelief()
      Test if belief is of array type.
    • getDefaultFact

      public jadex.common.UnparsedExpression getDefaultFact()
      Get the value.
      Returns:
      The value
    • setDefaultFact

      public void setDefaultFact(jadex.common.UnparsedExpression fact)
      The value to set.
      Parameters:
      value - The value to set
    • getDefaultFacts

      public List<jadex.common.UnparsedExpression> getDefaultFacts()
      Get the value.
      Returns:
      The value
    • setDefaultFacts

      public void setDefaultFacts(List<jadex.common.UnparsedExpression> facts)
      Set the value.
    • addDefaultFacts

      public void addDefaultFacts(jadex.common.UnparsedExpression fact)
      The value to set.
      Parameters:
      value - The value to set
    • getEvaluationMode

      public MParameter.EvaluationMode getEvaluationMode()
      Get the evaluationmode.
      Returns:
      The evaluationmode
    • setEvaluationMode

      public void setEvaluationMode(MParameter.EvaluationMode evaluationmode)
      The evaluationmode to set.
      Parameters:
      evaluationmode - The evaluationmode to set
    • getRawEvents

      public Collection<jadex.rules.eca.EventType> getRawEvents()
      Get the rawevents.
      Returns:
      The rawevents.
    • setRawEvents

      public void setRawEvents(Set<jadex.rules.eca.EventType> rawevents)
      Set the rawevents.
      Parameters:
      rawevents - The rawevents to set.
    • getBeliefEvents

      public Set<String> getBeliefEvents()
      Get the events.
      Returns:
      The events.
    • setBeliefEvents

      public void setBeliefEvents(Set<String> events)
      Set the events.
      Parameters:
      events - The events to set.
    • getEvents

      public List<jadex.rules.eca.EventType> getEvents()
      Get the events.
      Returns:
      The events.
    • initEvents

      public void initEvents(IBDIModel model, ClassLoader cl)
      Init the event, when loaded from xml.
    • setEvents

      public void setEvents(List<jadex.rules.eca.EventType> events)
      The events to set.
      Parameters:
      events - The events to set
    • addEvent

      public void addEvent(jadex.rules.eca.EventType event)
      Add an event.
      Parameters:
      event - The event.