Class BeliefSet<T extends Formula,​S extends Signature>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean EQUALS_USES_SIGNATURE
      Flag that determines whether Object.equals(Object) checks only for equality of the beliefs in the belief sets or whether it also checks for equality of the signatures attached to the belief sets.
      private java.util.Set<T> formulas
      The set of formulas of this belief base.
      protected S signature
      The signature of this belief base.
    • Constructor Summary

      Constructors 
      Constructor Description
      BeliefSet()
      Creates a new (empty) belief set.
      BeliefSet​(java.util.Collection<? extends T> c)
      Creates a new belief set with the given collection of formulae.
      BeliefSet​(S sig)
      Creates a new belief set with the given type of signature.
    • Method Summary

      Modifier and Type Method Description
      boolean add​(T f)  
      boolean addAll​(java.util.Collection<? extends T> c)  
      void clear()  
      boolean contains​(java.lang.Object o)  
      boolean containsAll​(java.util.Collection<?> c)  
      boolean equals​(java.lang.Object obj)  
      S getSignature()
      Returns a copy of the signature that is attached to his belief base (it is always equal to or larger than BeliefBase.getMinimalSignature()).
      int hashCode()  
      protected java.util.Set<T> instantiateSet()
      Instantiates the set which is used as data holder for the belief set.
      protected abstract S instantiateSignature()
      Instantiates the signature which is attached to the belief base.
      private S instantiateSignature​(S sig)
      Instantiates the signature which is attached to the belief base as an instance of the class of the given signature.
      boolean isEmpty()  
      java.util.Iterator<T> iterator()  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      boolean retainAll​(java.util.Collection<?> c)  
      void setSignature​(S sig)
      Sets the signature that is attached to his belief base to a copy of the given signature.
      int size()  
      java.lang.Object[] toArray()  
      <R> R[] toArray​(R[] a)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Field Detail

      • EQUALS_USES_SIGNATURE

        public static final boolean EQUALS_USES_SIGNATURE
        Flag that determines whether Object.equals(Object) checks only for equality of the beliefs in the belief sets or whether it also checks for equality of the signatures attached to the belief sets.
        See Also:
        Constant Field Values
      • formulas

        private java.util.Set<T extends Formula> formulas
        The set of formulas of this belief base.
    • Constructor Detail

      • BeliefSet

        public BeliefSet()
        Creates a new (empty) belief set.
      • BeliefSet

        public BeliefSet​(java.util.Collection<? extends T> c)
        Creates a new belief set with the given collection of formulae.
        Parameters:
        c - a collection of formulae.
      • BeliefSet

        public BeliefSet​(S sig)
        Creates a new belief set with the given type of signature.
        Parameters:
        sig - a signature
    • Method Detail

      • instantiateSet

        protected java.util.Set<T> instantiateSet()
        Instantiates the set which is used as data holder for the belief set. Subclasses might override this method if the do not want to use HashSet as container implementation
        Returns:
        an new set
      • instantiateSignature

        protected abstract S instantiateSignature()
        Instantiates the signature which is attached to the belief base.
        Returns:
        the signature of this belief base
      • instantiateSignature

        private S instantiateSignature​(S sig)
        Instantiates the signature which is attached to the belief base as an instance of the class of the given signature.
        Parameters:
        sig - some signature
        Returns:
        the signature which is attached to the belief base as an instance of the class of the given signature.
      • getSignature

        public S getSignature()
        Returns a copy of the signature that is attached to his belief base (it is always equal to or larger than BeliefBase.getMinimalSignature()).
        Returns:
        the signature of this knowledge base.
      • setSignature

        public void setSignature​(S sig)
                          throws java.lang.IllegalArgumentException
        Sets the signature that is attached to his belief base to a copy of the given signature.
        Parameters:
        sig - a signature
        Throws:
        java.lang.IllegalArgumentException - if the given signature is smaller in size than the belief base's formulas' signature.
      • add

        public boolean add​(T f)
        Specified by:
        add in interface java.util.Collection<T extends Formula>
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> c)
        Specified by:
        addAll in interface java.util.Collection<T extends Formula>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<T extends Formula>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<T extends Formula>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<T extends Formula>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<T extends Formula>
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Collection<T extends Formula>
        Overrides:
        equals in class java.lang.Object
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<T extends Formula>
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.util.Collection<T extends Formula>
        Specified by:
        iterator in interface java.lang.Iterable<T extends Formula>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<T extends Formula>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<T extends Formula>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<T extends Formula>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<T extends Formula>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<T extends Formula>
      • toArray

        public <R> R[] toArray​(R[] a)
        Specified by:
        toArray in interface java.util.Collection<T extends Formula>
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface BeliefBase
        Overrides:
        toString in class java.lang.Object