|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.pucrio.inf.les.bdijade.core.BeliefBase
public class BeliefBase
This class represents a belief base of a capability. It aggregates its knowledge.
| Field Summary | |
|---|---|
private java.util.Set<BeliefListener> |
beliefListeners
|
private java.util.Map<java.lang.String,Belief<?>> |
beliefs
|
private Capability |
capability
|
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
BeliefBase()
Creates a belief base. |
|
BeliefBase(java.util.Set<Belief<?>> beliefs)
Creates a belief base associated with a capability and adds the beliefs in the provided belief set. |
|
| Method Summary | |
|---|---|
void |
addBelief(Belief<?> belief)
Adds a belief to the belief base. |
void |
addBeliefListener(BeliefListener beliefListener)
Adds a belief listener to be notified about changes in the belief base. |
void |
addOrUpdateBelief(Belief<?> belief)
Adds a belief to the belief base. |
Belief<?> |
getBelief(java.lang.String name)
Retrieves a belief from the belief base. |
java.util.Set<BeliefListener> |
getBeliefListeners()
|
java.util.Set<Belief<?>> |
getBeliefs()
|
java.util.List<java.lang.Object> |
getBeliefValues()
Return a list of all belief values from this belief base. |
Capability |
getCapability()
|
boolean |
hasBelief(java.lang.String name)
Checks if a belief is part of the belief base. |
protected void |
init()
Initialize the belief base, adding initial beliefs. |
private void |
notifyBeliefChanged(BeliefEvent beliefChanged)
Notifies the capability associate with this BeliefBase that a belief was modified. |
Belief<?> |
removeBelief(java.lang.String name)
Removes a belief from the belief base. |
void |
removeBeliefListener(BeliefListener beliefListener)
Removes a belief listener. |
void |
reviewBeliefs()
This method is an empty place holder for subclasses. |
void |
setCapability(Capability capability)
Sets the capability of this belief base. |
int |
size()
Gets the size of this belief base (the number of beliefs). |
java.lang.String |
toString()
|
boolean |
updateBelief(java.lang.String name,
java.lang.Object value)
Update the value of a belief in the belief base. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private final java.util.Set<BeliefListener> beliefListeners
private final java.util.Map<java.lang.String,Belief<?>> beliefs
private Capability capability
| Constructor Detail |
|---|
public BeliefBase()
public BeliefBase(java.util.Set<Belief<?>> beliefs)
beliefs - the initial beliefs| Method Detail |
|---|
public void addBelief(Belief<?> belief)
belief - the belief to be added.public void addBeliefListener(BeliefListener beliefListener)
beliefListener - the listener to be added.public void addOrUpdateBelief(Belief<?> belief)
belief - the belief to be added or updated.public Belief<?> getBelief(java.lang.String name)
name - the name of the belief to be retrieved.
public java.util.Set<BeliefListener> getBeliefListeners()
public java.util.Set<Belief<?>> getBeliefs()
public java.util.List<java.lang.Object> getBeliefValues()
public Capability getCapability()
public boolean hasBelief(java.lang.String name)
name - the belief to be checked
protected void init()
private void notifyBeliefChanged(BeliefEvent beliefChanged)
beliefChanged - the belief that was changedpublic Belief<?> removeBelief(java.lang.String name)
name - the name of the belief to be removed.
public void removeBeliefListener(BeliefListener beliefListener)
beliefListener - the listener to be removed.public void reviewBeliefs()
public void setCapability(Capability capability)
RuntimeException. After setting the capability,
the init() method is invoked.
capability - the capability to setpublic int size()
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
public boolean updateBelief(java.lang.String name,
java.lang.Object value)
name - the belief to be updated.value - the new value to the belief.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||