bdi4jade.belief

## Class AbstractBeliefSet<K,V>

- java.lang.Object
- - bdi4jade.core.MetadataElementImpl
  - - bdi4jade.belief.AbstractBelief<K,java.util.Set<V>>
    - - bdi4jade.belief.AbstractBeliefSet<K,V>

- Type Parameters:
    `K` - the type of the belief name or key.
    `V` - the type of the belief set values.
  All Implemented Interfaces:
    Belief<K,java.util.Set<V>>, BeliefSet<K,V>, MetadataElement, jade.content.Concept, jade.content.ContentElement, jade.content.Term, java.io.Serializable, java.lang.Cloneable
  Direct Known Subclasses:
    TransientBeliefSet

      public abstract class AbstractBeliefSet<K,V>
      extends AbstractBelief<K,java.util.Set<V>>
      implements BeliefSet<K,V>

  This is an abstract class that implements the `BeliefSet` interface, and extends the `AbstractBeliefSet` class, parameterizing it with a parameterized `Set`. It implements some of the interface methods, leaving some implementations to the subclasses, mainly the choice of how the belief set values are stored.
  Author:
    Ingrid Nunes
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class bdi4jade.core.MetadataElementImpl

      `metadata`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBeliefSet()` The default constructor.
    `AbstractBeliefSet(K name)` Initializes a belief set with its name.
    `AbstractBeliefSet(K name, java.util.Set<V> values)` Initializes a belief set with its name and an initial set of values.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `addSetValue(V value)` Adds a value of this belief set.
    `void` | `addValue(V value)` Adds a value to the belief set and notifies belief bases of the addition of this value.
    `protected abstract boolean` | `removeSetValue(V value)` Removes a value of this belief set.
    `boolean` | `removeValue(V value)` Removes a value of the belief set and notifies belief bases of the removal of this value.

    - ### Methods inherited from class bdi4jade.belief.AbstractBelief

      `addBeliefBase, clone, equals, getBeliefBases, getName, hashCode, notifyBeliefBases, removeBeliefBase, setName, setValue, toString, updateValue`

    - ### Methods inherited from class bdi4jade.core.MetadataElementImpl

      `getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface bdi4jade.belief.BeliefSet

      `hasValue, iterator`

    - ### Methods inherited from interface bdi4jade.belief.Belief

      `addBeliefBase, clone, getBeliefBases, getName, getValue, removeBeliefBase, setValue`

    - ### Methods inherited from interface bdi4jade.core.MetadataElement

      `getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata`

- - ### Constructor Detail

    - #### AbstractBeliefSet

          public AbstractBeliefSet()

      The default constructor. It should be only used if persistence frameworks are used.

    - #### AbstractBeliefSet

          public AbstractBeliefSet(K name)

      Initializes a belief set with its name.
      Parameters:
        `name` - the name of this belief set.

    - #### AbstractBeliefSet

          public AbstractBeliefSet(K name,
                                   java.util.Set<V> values)

      Initializes a belief set with its name and an initial set of values.
      Parameters:
        `name` - the name of the belief set.
        `values` - the initial values of this belief set.

  - ### Method Detail

    - #### addSetValue

          protected abstract void addSetValue(V value)

      Adds a value of this belief set. It is invoked by the `addValue(Object)` method.
      Parameters:
        `value` - the value to be added.

    - #### addValue

          public final void addValue(V value)

      Adds a value to the belief set and notifies belief bases of the addition of this value.
      Specified by:
        `addValue` in interface `BeliefSet<K,V>`
      Parameters:
        `value` - the value to be added.
      See Also:
        `BeliefSet.addValue(Object)`

    - #### removeSetValue

          protected abstract boolean removeSetValue(V value)

      Removes a value of this belief set. It is invoked by the `removeValue(Object)` method.
      Parameters:
        `value` - the value to be added.
      Returns:
        true if the value was removed, false otherwise.

    - #### removeValue

          public final boolean removeValue(V value)

      Removes a value of the belief set and notifies belief bases of the removal of this value.
      Specified by:
        `removeValue` in interface `BeliefSet<K,V>`
      Parameters:
        `value` - the value to be removed.
      Returns:
        true if the value was removed, false otherwise.
      See Also:
        `BeliefSet.removeValue(Object)`