Class AssociativePlFormula
java.lang.Object
org.tweetyproject.logics.pl.syntax.PlFormula
org.tweetyproject.logics.pl.syntax.AssociativePlFormula
- All Implemented Interfaces:
Iterable<PlFormula>,Collection<PlFormula>,List<PlFormula>,SequencedCollection<PlFormula>,Formula,AssociativeFormulaSupport.AssociativeSupportBridge,AssociativeFormula<PlFormula>,ClassicalFormula,Conjunctable,Disjunctable,Invertable,ProbabilityAware,SimpleLogicalFormula
- Direct Known Subclasses:
Conjunction,Disjunction,ExclusiveDisjunction
public abstract class AssociativePlFormula
extends PlFormula
implements AssociativeFormula<PlFormula>, 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
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionvoidbooleanbooleanAdds the specified elements to the end of this collection (optional operation).booleanaddAll(int index, Collection<? extends PlFormula> c) booleanaddAll(Collection<? extends PlFormula> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanget(int index) getAtoms()Processes the set of all atoms which appear in this formula<C extends SimpleLogicalFormula>
Set<C> getFormulas(Class<C> cls) Process the formulas of type C that are children of this associative formulaReturns all literals, i.e.Processes the set of all predicates which appear in this formulaReturns the signature of the language of this formula.inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) intReturns the number of occurrences of the given proposition within this formularemove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object[]toArray()Object[]toString()Methods inherited from class org.tweetyproject.logics.pl.syntax.PlFormula
clone, collapseAssociativeFormulas, combineWithAnd, combineWithOr, complement, getModels, getModels, getPredicateCls, getPrimeImplicants, getUniformProbability, isClause, isConjunctiveClause, isLiteral, replace, resolvableWith, resolveWith, toBlakeCanonicalForm, toCnf, toDnf, toNnf, trimMethods inherited from interface org.tweetyproject.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
createEmptyFormula, getEmptySymbol, getOperatorSymbolMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, sort, spliteratorMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
clone, getPredicateCls, isLiteral
-
Constructor Details
-
AssociativePlFormula
public AssociativePlFormula()Creates a new (empty) associative formula. -
AssociativePlFormula
Creates a new associative formula with the given inner formulas.- Parameters:
formulas- a collection of formulas.
-
AssociativePlFormula
-
-
Method Details
-
getPredicates
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Specified by:
getPredicatesin classPlFormula- Returns:
- all predicates that appear in this formula
-
getFormulas
- Specified by:
getFormulasin interfaceAssociativeFormula<PlFormula>- Returns:
- all the formulas saved as childs in the associative formula
-
getFormulas
Description copied from interface:AssociativeFormulaProcess the formulas of type C that are children of this associative formula- Specified by:
getFormulasin interfaceAssociativeFormula<PlFormula>- Type Parameters:
C- the type of formulas- Parameters:
cls- the class structure defining the type of formulas which are searched.- Returns:
- A set of formulas of type C which are members of the associative formula
-
getAtoms
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Specified by:
getAtomsin classPlFormula- Returns:
- The set of all atoms
-
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.
-
toString
-
getSignature
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Overrides:
getSignaturein classPlFormula- Returns:
- the signature of the language of this formula.
-
createEmptySignature
- Specified by:
createEmptySignaturein interfaceAssociativeFormulaSupport.AssociativeSupportBridge- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
numberOfOccurrences
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()- Specified by:
hashCodein interfaceCollection<PlFormula>- Specified by:
hashCodein interfaceList<PlFormula>- Specified by:
hashCodein interfaceSimpleLogicalFormula- Specified by:
hashCodein classPlFormula
-
equals
-
add
-
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
-
clear
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<PlFormula>- Specified by:
containsAllin interfaceList<PlFormula>
-
isEmpty
-
iterator
-
remove
-
removeAll
-
retainAll
-
size
-
toArray
-
toArray
-
add
-
addAll
-
get
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<PlFormula>
-
listIterator
- Specified by:
listIteratorin interfaceList<PlFormula>
-
listIterator
- Specified by:
listIteratorin interfaceList<PlFormula>
-
remove
-
set
-
subList
-