bdi4jade.belief

## Class AbstractBeliefSet<T>

- java.lang.Object
- - bdi4jade.core.MetadataElementImpl
  - - bdi4jade.belief.AbstractBelief<java.util.Set<T>>
    - - bdi4jade.belief.AbstractBeliefSet<T>

- Type Parameters:
    `T` - the type of the belief set values.
  All Implemented Interfaces:
    Belief<java.util.Set<T>>, BeliefSet<T>, MetadataElement, jade.content.Concept, jade.content.Term, java.io.Serializable
  Direct Known Subclasses:
    TransientBeliefSet

      public abstract class AbstractBeliefSet<T>
      extends AbstractBelief<java.util.Set<T>>
      implements BeliefSet<T>

  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
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractBeliefSet()` The default constructor.
    `` | `AbstractBeliefSet(java.lang.String name)` Initializes a belief set with its name.
    `` | `AbstractBeliefSet(java.lang.String name, java.util.Set<T> values)` Initializes a belief set with its name and an initial set of values.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `addSetValue(T value)` Adds a value of this belief set.
    `void` | `addValue(T value)` Adds a value to the belief set and notifies belief bases of the addition of this value.
    `protected abstract boolean` | `removeSetValue(T value)` Removes a value of this belief set.
    `boolean` | `removeValue(T 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, 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

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

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

      `hasValue, iterator`

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

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

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

      `getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata`

- - ### Constructor Detail

    - #### AbstractBeliefSet

          protected AbstractBeliefSet()

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

    - #### AbstractBeliefSet

          public AbstractBeliefSet(java.lang.String name)

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

    - #### AbstractBeliefSet

          public AbstractBeliefSet(java.lang.String name,
                           java.util.Set<T> 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(T 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(T value)

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

    - #### removeSetValue

          protected abstract boolean removeSetValue(T 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(T value)

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