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
,ExtendedTheory
,FolBeliefSet
,MarkovLogicNetwork
,MlBeliefSet
,PclBeliefSet
,PlBeliefSet
,RclBeliefSet
,RecursiveExtendedTheory
,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
Modifier and TypeFieldDescriptionstatic final boolean
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. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Adds the specified elements to the end of this collection (optional operation).boolean
addAll
(Collection<? extends T> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
Returns a copy of the signature that is attached to his belief base (it is always equal to or larger thanBeliefBase.getMinimalSignature()
).int
hashCode()
boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(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()
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
getMinimalSignature
Methods 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:
add
in 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:
addAll
in interfaceCollection<T extends Formula>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<T extends Formula>
-
contains
- Specified by:
contains
in interfaceCollection<T extends Formula>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T extends Formula>
-
hashCode
-
equals
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<T extends Formula>
-
iterator
-
remove
- Specified by:
remove
in interfaceCollection<T extends Formula>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<T extends Formula>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<T extends Formula>
-
size
public int size()- Specified by:
size
in interfaceCollection<T extends Formula>
-
toArray
- Specified by:
toArray
in interfaceCollection<T extends Formula>
-
toArray
public <R> R[] toArray(R[] a) - Specified by:
toArray
in interfaceCollection<T extends Formula>
-
toString
- Specified by:
toString
in interfaceBeliefBase
- Overrides:
toString
in 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
-