Class MBelief


  • public class MBelief
    extends MElement
    Belief model.
    • Field Detail

      • AUTOCLOSABLE

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

        protected FieldInfo ftarget
        The field target.
      • mgetter

        protected MethodInfo mgetter
        The method targets.
      • impl

        protected java.lang.String impl
        The collection implementation class.
      • multi

        protected java.lang.Boolean multi
        Flag if is multi.
      • beliefevents

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

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

        protected java.util.List<jadex.rules.eca.EventType> events
        The aggregated/inited events.
      • clazz

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

        protected boolean exported
        The exported / argument flag.
      • result

        protected boolean result
        The result flag.
      • ref

        protected java.lang.String ref
        The reference.
    • Constructor Detail

      • MBelief

        public MBelief()
        Bean Constructor.
      • MBelief

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

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

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

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

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

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

      • adaptEvaluationMode

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

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

        public void setImplClassName​(java.lang.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 java.lang.String getRef()
        Get the reference. For belief references.
        Returns:
        The reference.
      • setRef

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

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

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

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

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

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

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

        public void setClazz​(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​(java.lang.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 java.lang.Object getValue​(IInternalAccess agent)
        Get the value of the belief.
      • getValue

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

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

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

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

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

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

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

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

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

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

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

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

        public void setDefaultFacts​(java.util.List<UnparsedExpression> facts)
        Set the value.
      • addDefaultFacts

        public void addDefaultFacts​(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 java.util.Collection<jadex.rules.eca.EventType> getRawEvents()
        Get the rawevents.
        Returns:
        The rawevents.
      • setRawEvents

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

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

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

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

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

        public void setEvents​(java.util.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.