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:
Iterable<T>,Collection<T>,BeliefBase
- Direct Known Subclasses:
AbstractBipolarFramework,ActionDescription,ActionQuerySet,ArgumentationKnowledgeBase,ClBeliefSet,CrMasBeliefSet,DefeasibleLogicProgram,DlBeliefSet,DungTheory,FolBeliefSet,MarkovLogicNetwork,MlBeliefSet,PclBeliefSet,PlBeliefSet,RclBeliefSet,RpclBeliefSet,SetAf,SimplePlLogicDeductiveKnowledgebase
public abstract class BeliefSet<T extends Formula,S extends Signature>
extends Object
implements BeliefBase, 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
FieldsModifier and TypeFieldDescriptionstatic final booleanFlag 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. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanAdds the specified elements to the end of this collection (optional operation).booleanaddAll(Collection<? extends T> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanReturns a copy of the signature that is attached to his belief base (it is always equal to or larger thanBeliefBase.getMinimalSignature()).inthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) voidsetSignature(S sig) Sets the signature that is attached to his belief base to a copy of the given signature.intsize()Object[]toArray()<R> R[]toArray(R[] a) toString()toString(boolean showSignature) returns a string representation of this belief setMethods inherited from interface org.tweetyproject.commons.BeliefBase
getMinimalSignatureMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
EQUALS_USES_SIGNATURE
public static final boolean EQUALS_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.- See Also:
-
-
Constructor Details
-
BeliefSet
public BeliefSet()Creates a new (empty) belief set. -
BeliefSet
Creates a new belief set with the given collection of formulae.- Parameters:
c- a collection of formulae.
-
BeliefSet
Creates a new belief set with the given type of signature.- Parameters:
sig- a signature
-
-
Method Details
-
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
Sets the signature that is attached to his belief base to a copy of the given signature.- Parameters:
sig- a signature- Throws:
IllegalArgumentException- if the given signature is smaller in size than the belief base's formulas' signature.
-
add
- Specified by:
addin interfaceCollection<T extends Formula>
-
add
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
- Specified by:
addAllin interfaceCollection<T extends Formula>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T extends Formula>
-
contains
- Specified by:
containsin interfaceCollection<T extends Formula>
-
containsAll
- Specified by:
containsAllin interfaceCollection<T extends Formula>
-
hashCode
public int hashCode() -
equals
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T extends Formula>
-
iterator
-
remove
- Specified by:
removein interfaceCollection<T extends Formula>
-
removeAll
- Specified by:
removeAllin interfaceCollection<T extends Formula>
-
retainAll
- Specified by:
retainAllin interfaceCollection<T extends Formula>
-
size
public int size()- Specified by:
sizein interfaceCollection<T extends Formula>
-
toArray
- Specified by:
toArrayin interfaceCollection<T extends Formula>
-
toArray
public <R> R[] toArray(R[] a) - Specified by:
toArrayin interfaceCollection<T extends Formula>
-
toString
- Specified by:
toStringin interfaceBeliefBase- Overrides:
toStringin classObject
-
toString
returns a string representation of this belief set- Parameters:
showSignature- whether to show the underlying signature- Returns:
- a string representation of this belief set
-