Package net.sf.tweety.commons
Class BeliefSet<T extends Formula,S extends Signature>
- java.lang.Object
-
- net.sf.tweety.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 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.
-
Method Summary
Modifier and Type Method Description boolean
add(T f)
boolean
add(T... formulas)
Adds the specified elements to the end of this collection (optional operation).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 thanBeliefBase.getMinimalSignature()
).int
hashCode()
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 interface net.sf.tweety.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:
toString
in interfaceBeliefBase
- Overrides:
toString
in classjava.lang.Object
-
-