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>
,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
ConstructorDescriptionCreates 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 TypeMethodDescriptionvoid
boolean
boolean
Adds the specified elements to the end of this collection (optional operation).boolean
addAll
(int index, Collection<? extends PlFormula> c) boolean
addAll
(Collection<? extends PlFormula> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
get
(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.int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) int
Returns the number of occurrences of the given proposition within this formularemove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
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, trim
Methods inherited from interface org.tweetyproject.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
Methods 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
Creates a new associative formula with the two given formulae- Parameters:
first
- a propositional formula.second
- a propositional formula.
-
-
Method Details
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Specified by:
getPredicates
in classPlFormula
- Returns:
- all predicates that appear in this formula
-
getFormulas
- Specified by:
getFormulas
in interfaceAssociativeFormula<PlFormula>
- Returns:
- all the formulas saved as childs in the associative formula
-
getFormulas
Description copied from interface:AssociativeFormula
Process the formulas of type C that are children of this associative formula- Specified by:
getFormulas
in 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:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Specified by:
getAtoms
in classPlFormula
- Returns:
- The set of all atoms
-
getLiterals
Description copied from class:PlFormula
Returns all literals, i.e. all formulas of the form "a" or "!a" where "a" is a proposition, that appear in this formula.- Specified by:
getLiterals
in classPlFormula
- Returns:
- all literals appearing in this formula.
-
toString
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Overrides:
getSignature
in classPlFormula
- Returns:
- the signature of the language of this formula.
-
createEmptySignature
- Specified by:
createEmptySignature
in interfaceAssociativeFormulaSupport.AssociativeSupportBridge
- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
numberOfOccurrences
Description copied from class:PlFormula
Returns the number of occurrences of the given proposition within this formula- Specified by:
numberOfOccurrences
in classPlFormula
- Parameters:
p
- some proposition- Returns:
- the number of occurrences of the given proposition within this formula
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<PlFormula>
- Specified by:
hashCode
in interfaceList<PlFormula>
- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Specified by:
hashCode
in classPlFormula
-
equals
- Specified by:
equals
in interfaceCollection<PlFormula>
- Specified by:
equals
in interfaceList<PlFormula>
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Specified by:
equals
in classPlFormula
-
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
public void clear() -
contains
-
containsAll
- Specified by:
containsAll
in interfaceCollection<PlFormula>
- Specified by:
containsAll
in interfaceList<PlFormula>
-
isEmpty
public boolean isEmpty() -
iterator
-
remove
-
removeAll
-
retainAll
-
size
public int size() -
toArray
-
toArray
-
add
-
addAll
-
get
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<PlFormula>
-
listIterator
- Specified by:
listIterator
in interfaceList<PlFormula>
-
listIterator
- Specified by:
listIterator
in interfaceList<PlFormula>
-
remove
-
set
-
subList
-