Package org.tweetyproject.commons
Class BeliefSet<T extends Formula,S extends Signature>
- java.lang.Object
-
- org.tweetyproject.commons.BeliefSet<T,S>
-
- Type Parameters:
T- The type of the beliefs in this belief set.S- The type of signature attached to this belief set.
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,BeliefBase
- Direct Known Subclasses:
AbstractBipolarFramework,ActionDescription,ActionQuerySet,ArgumentationKnowledgeBase,ClBeliefSet,CrMasBeliefSet,DefeasibleLogicProgram,DlBeliefSet,DungTheory,FolBeliefSet,MarkovLogicNetwork,MlBeliefSet,PclBeliefSet,PlBeliefSet,RclBeliefSet,RpclBeliefSet,SimplePlLogicDeductiveKnowledgebase
public abstract class BeliefSet<T extends Formula,S extends Signature> extends java.lang.Object implements BeliefBase, java.util.Collection<T>
This class models a belief set, i.e. a set of formulae of some formalism, and a signature.- Author:
- Matthias Thimm, Tim Janus, Anna Gessler
-
-
Field Summary
Fields Modifier and Type Field Description static booleanEQUALS_USES_SIGNATUREFlag that determines whetherObject.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.
-
Method Summary
Modifier and Type Method Description booleanadd(T f)booleanadd(T... formulas)Adds the specified elements to the end of this collection (optional operation).booleanaddAll(java.util.Collection<? extends T> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleanequals(java.lang.Object obj)SgetSignature()Returns a copy of the signature that is attached to his belief base (it is always equal to or larger thanBeliefBase.getMinimalSignature()).inthashCode()booleanisEmpty()java.util.Iterator<T>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)voidsetSignature(S sig)Sets the signature that is attached to his belief base to a copy of the given signature.intsize()java.lang.Object[]toArray()<R> R[]toArray(R[] a)java.lang.StringtoString()java.lang.StringtoString(boolean showSignature)returns a string representation of this belief set-
Methods inherited from interface org.tweetyproject.commons.BeliefBase
getMinimalSignature
-
-
-
-
Field Detail
-
EQUALS_USES_SIGNATURE
public static final boolean EQUALS_USES_SIGNATURE
Flag that determines whetherObject.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
-
-
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
-
getSignature
public S getSignature()
Returns a copy of the signature that is attached to his belief base (it is always equal to or larger thanBeliefBase.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... formulas)
Adds the specified elements to the end of this collection (optional operation).- Parameters:
formulas- to be appended to collection- Returns:
- true if all elements were added, false otherwise
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
-
contains
public boolean contains(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
hashCode
public int hashCode()
-
equals
public boolean equals(java.lang.Object obj)
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<T> iterator()
-
remove
public boolean remove(java.lang.Object o)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <R> R[] toArray(R[] a)
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceBeliefBase- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(boolean showSignature)
returns a string representation of this belief set- Parameters:
showSignature- whether to show the underlying signature- Returns:
- a string representation of this belief set
-
-