Package jadex.bdiv3.model
Class MBelief
- java.lang.Object
-
- jadex.bdiv3.model.MElement
-
- jadex.bdiv3.model.MBelief
-
public class MBelief extends MElement
Belief model.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Class<?>
AUTOCLOSABLE
The autoclosable class, if present.protected java.util.Set<java.lang.String>
beliefevents
The events this belief depends on.protected ClassInfo
clazz
The type (if explicitly specified).protected MParameter.EvaluationMode
evaluationmode
The direction.protected java.util.List<jadex.rules.eca.EventType>
events
The aggregated/inited events.protected boolean
exported
The exported / argument flag.protected UnparsedExpression
fact
The default fact.protected java.util.List<UnparsedExpression>
facts
The default facts (multi).protected FieldInfo
ftarget
The field target.protected java.lang.String
impl
The collection implementation class.protected MethodInfo
mgetter
The method targets.protected MethodInfo
msetter
protected java.lang.Boolean
multi
Flag if is multi.protected java.util.Collection<jadex.rules.eca.EventType>
rawevents
The raw events.protected java.lang.String
ref
The reference.protected boolean
result
The result flag.protected UnparsedExpression
updaterate
The update rate.-
Fields inherited from class jadex.bdiv3.model.MElement
CAPABILITY_SEPARATOR, description, name
-
-
Constructor Summary
Constructors Constructor Description MBelief()
Bean Constructor.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(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(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(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.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(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
adaptEvaluationMode()
Adapt the evaluation mode according to thevoid
addDefaultFacts(UnparsedExpression fact)
The value to set.void
addEvent(jadex.rules.eca.EventType event)
Add an event.void
cleanup(IInternalAccess component)
Cleanup the value on agent shutdown, i.e., call close() on closeable fact objects.java.util.Set<java.lang.String>
getBeliefEvents()
Get the events.ClassInfo
getClazz()
Get the clazz.UnparsedExpression
getDefaultFact()
Get the value.java.util.List<UnparsedExpression>
getDefaultFacts()
Get the value.MParameter.EvaluationMode
getEvaluationMode()
Get the evaluationmode.java.util.List<jadex.rules.eca.EventType>
getEvents()
Get the events.FieldInfo
getField()
Get the field (for field-backed beliefs).MethodInfo
getGetter()
Get the getter method (for method-backed beliefs).java.lang.String
getImplClassName()
Get the impl.java.util.Collection<jadex.rules.eca.EventType>
getRawEvents()
Get the rawevents.java.lang.String
getRef()
Get the reference.MethodInfo
getSetter()
Get the setter method (for method-backed beliefs).java.lang.Class<?>
getType(java.lang.ClassLoader cl)
Get the class of the belief.UnparsedExpression
getUpdateRate()
Get the updaterate.long
getUpdaterateValue(IInternalAccess agent)
Get/Evaluate the updaterate value.java.lang.Object
getValue(IInternalAccess agent)
Get the value of the belief.java.lang.Object
getValue(java.lang.Object object, java.lang.ClassLoader cl)
Get the value of the belief.void
initEvents(IBDIModel model, java.lang.ClassLoader cl)
Init the event, when loaded from xml.boolean
isArrayBelief()
Test if belief is of array type.boolean
isDynamic()
Get the dynamic.boolean
isExported()
Get the exported flag.boolean
isFieldBelief()
Test if this belief refers to a field.boolean
isMulti(java.lang.ClassLoader cl)
Get the multi.boolean
isResult()
Get the result flag.void
setBeliefEvents(java.util.Set<java.lang.String> events)
Set the events.void
setClazz(ClassInfo clazz)
The clazz to set.void
setDefaultFact(UnparsedExpression fact)
The value to set.void
setDefaultFacts(java.util.List<UnparsedExpression> facts)
Set the value.void
setEvaluationMode(MParameter.EvaluationMode evaluationmode)
The evaluationmode to set.void
setEvents(java.util.List<jadex.rules.eca.EventType> events)
The events to set.void
setExported(boolean exported)
Set the exported flag.void
setGetter(MethodInfo mgetter)
Set the mgetter.void
setImplClassName(java.lang.String impl)
Set the impl.void
setMulti(boolean multi)
The multi to set.void
setRawEvents(java.util.Set<jadex.rules.eca.EventType> rawevents)
Set the rawevents.void
setRef(java.lang.String reference)
Set the reference.void
setResult(boolean result)
Set the result flag.void
setSetter(MethodInfo msetter)
Set the msetter.void
setUpdateRate(UnparsedExpression updaterate)
The updaterate to set.boolean
setValue(IInternalAccess agent, java.lang.Object value)
Set the value of the belief.boolean
setValue(java.lang.Object object, java.lang.Object value, java.lang.ClassLoader cl)
Set the value of the belief.-
Methods inherited from class jadex.bdiv3.model.MElement
equals, getCapabilityName, getDescription, getElementName, getName, hashCode, internalName, setDescription, setFlatName, setName, toString
-
-
-
-
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.
-
msetter
protected MethodInfo msetter
-
impl
protected java.lang.String impl
The collection implementation class.
-
updaterate
protected UnparsedExpression updaterate
The update rate.
-
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.
-
fact
protected UnparsedExpression fact
The default fact.
-
facts
protected java.util.List<UnparsedExpression> facts
The default facts (multi).
-
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.
-
evaluationmode
protected MParameter.EvaluationMode evaluationmode
The direction.
-
-
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.
-
-