Package net.sf.tweety.logics.pl.syntax
Class AssociativePlFormula
- java.lang.Object
-
- net.sf.tweety.logics.pl.syntax.PlFormula
-
- net.sf.tweety.logics.pl.syntax.AssociativePlFormula
-
- All Implemented Interfaces:
Iterable<PlFormula>,Collection<PlFormula>,List<PlFormula>,net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge,net.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<PlFormula>,net.sf.tweety.logics.commons.syntax.interfaces.ClassicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Invertable,net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
- Direct Known Subclasses:
Conjunction,Disjunction
public abstract class AssociativePlFormula extends PlFormula implements net.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<PlFormula>, net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge, Collection<PlFormula>
This class captures the common functionalities of formulas with an associative operation like conjunction, disjunction, etc.- Author:
- Matthias Thimm, Tim Janus
-
-
Constructor Summary
Constructors Constructor Description AssociativePlFormula()Creates a new (empty) associative formula.AssociativePlFormula(Collection<? extends PlFormula> formulas)Creates a new associative formula with the given inner formulas.AssociativePlFormula(PlFormula first, PlFormula second)Creates a new associative formula with the two given formulae
-
Method Summary
Modifier and Type Method Description voidadd(int index, PlFormula element)booleanadd(PlFormula f)booleanaddAll(int index, Collection<? extends PlFormula> c)booleanaddAll(Collection<? extends PlFormula> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)net.sf.tweety.commons.SignaturecreateEmptySignature()booleanequals(Object obj)PlFormulaget(int index)Set<Proposition>getAtoms()List<PlFormula>getFormulas()<C extends net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula>
Set<C>getFormulas(Class<C> cls)Set<PlFormula>getLiterals()Returns all literals, i.e.Set<PlPredicate>getPredicates()PlSignaturegetSignature()inthashCode()intindexOf(Object o)booleanisEmpty()Iterator<PlFormula>iterator()intlastIndexOf(Object o)ListIterator<PlFormula>listIterator()ListIterator<PlFormula>listIterator(int index)intnumberOfOccurrences(Proposition p)Returns the number of occurrences of the given proposition within this formulaPlFormularemove(int index)booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)PlFormulaset(int index, PlFormula element)intsize()List<PlFormula>subList(int fromIndex, int toIndex)Object[]toArray()Object[]toArray(Object[] a)StringtoString()-
Methods inherited from class net.sf.tweety.logics.pl.syntax.PlFormula
clone, collapseAssociativeFormulas, combineWithAnd, combineWithOr, complement, getModels, getModels, getPredicateCls, getPrimeImplicants, getUniformProbability, isClause, isConjunctiveClause, isLiteral, replace, resolvableWith, resolveWith, toBlakeCanonicalForm, toCnf, toDnf, toNnf, trim
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
createEmptyFormula, getEmptySymbol, getOperatorSymbol
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Field Detail
-
support
protected net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport<PlFormula> support
The inner formulas of this formula
-
-
Constructor Detail
-
AssociativePlFormula
public AssociativePlFormula()
Creates a new (empty) associative formula.
-
AssociativePlFormula
public AssociativePlFormula(Collection<? extends PlFormula> formulas)
Creates a new associative formula with the given inner formulas.- Parameters:
formulas- a collection of formulas.
-
-
Method Detail
-
getPredicates
public Set<PlPredicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getPredicatesin classPlFormula
-
getFormulas
public List<PlFormula> getFormulas()
- Specified by:
getFormulasin interfacenet.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<PlFormula>
-
getFormulas
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula> Set<C> getFormulas(Class<C> cls)
- Specified by:
getFormulasin interfacenet.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<PlFormula>
-
getAtoms
public Set<Proposition> getAtoms()
-
getLiterals
public Set<PlFormula> getLiterals()
Description copied from class:PlFormulaReturns all literals, i.e. all formulas of the form "a" or "!a" where "a" is a proposition, that appear in this formula.- Specified by:
getLiteralsin classPlFormula- Returns:
- all literals appearing in this formula.
-
getSignature
public PlSignature getSignature()
- Specified by:
getSignaturein interfacenet.sf.tweety.commons.Formula- Overrides:
getSignaturein classPlFormula
-
createEmptySignature
public net.sf.tweety.commons.Signature createEmptySignature()
- Specified by:
createEmptySignaturein interfacenet.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
-
numberOfOccurrences
public int numberOfOccurrences(Proposition p)
Description copied from class:PlFormulaReturns the number of occurrences of the given proposition within this formula- Specified by:
numberOfOccurrencesin classPlFormula- Parameters:
p- some proposition- Returns:
- the number of occurrences of the given proposition within this formula
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
add
public boolean add(PlFormula f)
-
addAll
public boolean addAll(Collection<? extends PlFormula> c)
-
clear
public void clear()
-
contains
public boolean contains(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<PlFormula>- Specified by:
containsAllin interfaceList<PlFormula>
-
isEmpty
public boolean isEmpty()
-
remove
public boolean remove(Object o)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
size
public int size()
-
toArray
public Object[] toArray()
-
addAll
public boolean addAll(int index, Collection<? extends PlFormula> c)
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<PlFormula>
-
listIterator
public ListIterator<PlFormula> listIterator()
- Specified by:
listIteratorin interfaceList<PlFormula>
-
listIterator
public ListIterator<PlFormula> listIterator(int index)
- Specified by:
listIteratorin interfaceList<PlFormula>
-
-