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<?>AUTOCLOSABLEThe autoclosable class, if present.protected java.util.Set<java.lang.String>beliefeventsThe events this belief depends on.protected ClassInfoclazzThe type (if explicitly specified).protected MParameter.EvaluationModeevaluationmodeThe direction.protected java.util.List<jadex.rules.eca.EventType>eventsThe aggregated/inited events.protected booleanexportedThe exported / argument flag.protected UnparsedExpressionfactThe default fact.protected java.util.List<UnparsedExpression>factsThe default facts (multi).protected FieldInfoftargetThe field target.protected java.lang.StringimplThe collection implementation class.protected MethodInfomgetterThe method targets.protected MethodInfomsetterprotected java.lang.BooleanmultiFlag if is multi.protected java.util.Collection<jadex.rules.eca.EventType>raweventsThe raw events.protected java.lang.StringrefThe reference.protected booleanresultThe result flag.protected UnparsedExpressionupdaterateThe 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 voidadaptEvaluationMode()Adapt the evaluation mode according to thevoidaddDefaultFacts(UnparsedExpression fact)The value to set.voidaddEvent(jadex.rules.eca.EventType event)Add an event.voidcleanup(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.ClassInfogetClazz()Get the clazz.UnparsedExpressiongetDefaultFact()Get the value.java.util.List<UnparsedExpression>getDefaultFacts()Get the value.MParameter.EvaluationModegetEvaluationMode()Get the evaluationmode.java.util.List<jadex.rules.eca.EventType>getEvents()Get the events.FieldInfogetField()Get the field (for field-backed beliefs).MethodInfogetGetter()Get the getter method (for method-backed beliefs).java.lang.StringgetImplClassName()Get the impl.java.util.Collection<jadex.rules.eca.EventType>getRawEvents()Get the rawevents.java.lang.StringgetRef()Get the reference.MethodInfogetSetter()Get the setter method (for method-backed beliefs).java.lang.Class<?>getType(java.lang.ClassLoader cl)Get the class of the belief.UnparsedExpressiongetUpdateRate()Get the updaterate.longgetUpdaterateValue(IInternalAccess agent)Get/Evaluate the updaterate value.java.lang.ObjectgetValue(IInternalAccess agent)Get the value of the belief.java.lang.ObjectgetValue(java.lang.Object object, java.lang.ClassLoader cl)Get the value of the belief.voidinitEvents(IBDIModel model, java.lang.ClassLoader cl)Init the event, when loaded from xml.booleanisArrayBelief()Test if belief is of array type.booleanisDynamic()Get the dynamic.booleanisExported()Get the exported flag.booleanisFieldBelief()Test if this belief refers to a field.booleanisMulti(java.lang.ClassLoader cl)Get the multi.booleanisResult()Get the result flag.voidsetBeliefEvents(java.util.Set<java.lang.String> events)Set the events.voidsetClazz(ClassInfo clazz)The clazz to set.voidsetDefaultFact(UnparsedExpression fact)The value to set.voidsetDefaultFacts(java.util.List<UnparsedExpression> facts)Set the value.voidsetEvaluationMode(MParameter.EvaluationMode evaluationmode)The evaluationmode to set.voidsetEvents(java.util.List<jadex.rules.eca.EventType> events)The events to set.voidsetExported(boolean exported)Set the exported flag.voidsetGetter(MethodInfo mgetter)Set the mgetter.voidsetImplClassName(java.lang.String impl)Set the impl.voidsetMulti(boolean multi)The multi to set.voidsetRawEvents(java.util.Set<jadex.rules.eca.EventType> rawevents)Set the rawevents.voidsetRef(java.lang.String reference)Set the reference.voidsetResult(boolean result)Set the result flag.voidsetSetter(MethodInfo msetter)Set the msetter.voidsetUpdateRate(UnparsedExpression updaterate)The updaterate to set.booleansetValue(IInternalAccess agent, java.lang.Object value)Set the value of the belief.booleansetValue(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.
-
-