Class AssociativeFolFormula
java.lang.Object
org.tweetyproject.logics.commons.syntax.RelationalFormula
org.tweetyproject.logics.fol.syntax.FolFormula
org.tweetyproject.logics.fol.syntax.AssociativeFolFormula
- All Implemented Interfaces:
- Iterable<RelationalFormula>,- Collection<RelationalFormula>,- List<RelationalFormula>,- Formula,- AssociativeFormulaSupport.AssociativeSupportBridge,- AssociativeFormula<RelationalFormula>,- ClassicalFormula,- ComplexLogicalFormula,- Conjunctable,- Disjunctable,- Invertable,- LogicStructure,- ProbabilityAware,- QuantifiedFormula,- SimpleLogicalFormula
- Direct Known Subclasses:
- Conjunction,- Disjunction,- ExclusiveDisjunction
public abstract class AssociativeFolFormula
extends FolFormula
implements AssociativeFormula<RelationalFormula>, AssociativeFormulaSupport.AssociativeSupportBridge
This class captures the common functionalities first order associative formulas like conjunction,
 disjunction, etc.
- Author:
- Matthias Thimm, Tim Janus
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new (empty) associative formula.AssociativeFolFormula(Collection<? extends RelationalFormula> formulas) Creates a new associative formula with the given inner formulas.AssociativeFolFormula(RelationalFormula first, RelationalFormula second) Creates a new associative formula with the two given formulae
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(int index, RelationalFormula element) booleanbooleanadd(FolFormula... formulas) Adds the specified elements to the end of this collection (optional operation).booleanaddAll(int index, Collection<? extends RelationalFormula> c) booleanaddAll(Collection<? extends RelationalFormula> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanChecks whether this formula contains any quantification.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 formulaProcesses the set of all predicates which appear in this formulagetTerms()Processes the set containing all terms of type C.inthashCode()intbooleanisClosed()Checks whether this formula is closed, i.e.booleanChecks whether this formula is closed, i.e.booleanisEmpty()booleanbooleanChecks whether this formula is well-bound, i.e.booleanisWellBound(Set<Variable> boundVariables) Checks whether this formula is well-bound, i.e.iterator()intlistIterator(int index) remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) set(int index, RelationalFormula element) intsize()subList(int fromIndex, int toIndex) substitute(Map<? extends Term<?>, ? extends Term<?>> termMap) Substitutes all occurrences of all terms "v" in map.keyset() in this formula by map.get(v) and returns the new formula.
 NOTE: variables bound to quantifiers are not substituted in their inner formulas even if they appear in the map.substitute(Term<?> v, Term<?> t) Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class org.tweetyproject.logics.fol.syntax.FolFormulaclone, collapseAssociativeFormulas, combineWithAnd, combineWithOr, complement, getSignature, getUniformProbability, isDnf, toDnf, toNnfMethods inherited from class org.tweetyproject.logics.commons.syntax.RelationalFormulaallGroundInstances, allSubstitutions, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isGround, isWellFormedMethods inherited from interface org.tweetyproject.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridgecreateEmptyFormula, getEmptySymbol, getOperatorSymbolMethods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArrayMethods inherited from interface org.tweetyproject.commons.FormulagetSignatureMethods inherited from interface java.util.ListreplaceAll, sort, spliteratorMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormulagetPredicateCls
- 
Constructor Details- 
AssociativeFolFormulapublic AssociativeFolFormula()Creates a new (empty) associative formula.
- 
AssociativeFolFormulaCreates a new associative formula with the two given formulae- Parameters:
- first- a relational formula.
- second- a relational formula.
 
- 
AssociativeFolFormulaCreates a new associative formula with the given inner formulas.- Parameters:
- formulas- a collection of formulas.
 
 
- 
- 
Method Details- 
createEmptySignature- Specified by:
- createEmptySignaturein interface- AssociativeFormulaSupport.AssociativeSupportBridge
- Returns:
- An empty signature of the language of the AssociativeFormula implementation
 
- 
getFunctors- Specified by:
- getFunctorsin class- RelationalFormula
- Returns:
- all functors that appear in this formula.
 
- 
containsQuantifierpublic boolean containsQuantifier()Description copied from interface:QuantifiedFormulaChecks whether this formula contains any quantification.- Specified by:
- containsQuantifierin interface- QuantifiedFormula
- Returns:
- "true" if this formula contains a quantification.
 
- 
getUnboundVariables- Specified by:
- getUnboundVariablesin interface- QuantifiedFormula
- Returns:
- a set of of unbound variables
 
- 
isClosedpublic boolean isClosed()Description copied from interface:QuantifiedFormulaChecks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier.- Specified by:
- isClosedin interface- QuantifiedFormula
- Returns:
- "true" if this formula is closed, "false" otherwise.
 
- 
isClosedDescription copied from interface:QuantifiedFormulaChecks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier. Every variable in "boundVariables" is already assumed to be bound.- Specified by:
- isClosedin interface- QuantifiedFormula
- Parameters:
- boundVariables- the variables assumed to be bound.
- Returns:
- "true" if this formula is closed wrt. "boundVariables", "false" otherwise.
 
- 
isWellBoundpublic boolean isWellBound()Description copied from interface:QuantifiedFormulaChecks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier's range.- Specified by:
- isWellBoundin interface- QuantifiedFormula
- Returns:
- "true" if this formula is well-bound, "false" otherwise.
 
- 
isWellBoundDescription copied from interface:QuantifiedFormulaChecks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier range. Every variable in "boundVariables" is assumed to be bound already.- Specified by:
- isWellBoundin interface- QuantifiedFormula
- Parameters:
- boundVariables- the variables assumed to be bound.
- Returns:
- "true" if this formula is well-bound, "false" otherwise.
 
- 
isLiteralpublic boolean isLiteral()- Specified by:
- isLiteralin interface- SimpleLogicalFormula
- Returns:
- true if the formula represents a literal in the language or false otherwise
 
- 
getQuantifierVariables- Specified by:
- getQuantifierVariablesin interface- QuantifiedFormula
- Overrides:
- getQuantifierVariablesin class- FolFormula
- Returns:
- a set containing all quantified variables
 
- 
getFormulas- Specified by:
- getFormulasin interface- AssociativeFormula<RelationalFormula>
- Returns:
- all the formulas saved as childs in the associative formula
 
- 
getFormulasDescription copied from interface:AssociativeFormulaProcess the formulas of type C that are children of this associative formula- Specified by:
- getFormulasin interface- AssociativeFormula<RelationalFormula>
- 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
 
- 
getAtomsDescription copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
- getAtomsin interface- SimpleLogicalFormula
- Specified by:
- getAtomsin class- RelationalFormula
- Returns:
- all atoms that appear in this formula.
 
- 
getTerms- Specified by:
- getTermsin interface- LogicStructure
- Returns:
- a set containing all terms of this logical structure
 
- 
getTermsDescription copied from interface:LogicStructureProcesses the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.- Specified by:
- getTermsin interface- LogicStructure
- Type Parameters:
- C- the type of terms
- Parameters:
- cls- The Class structure containing type information about the searched term
- Returns:
- A set containing all terms of type C of this logical structure
 
- 
getPredicatesDescription copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
- getPredicatesin interface- SimpleLogicalFormula
- Returns:
- all predicates that appear in this formula
 
- 
substituteDescription copied from class:RelationalFormulaSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula. NOTE: if "v" is a variable and bound to a quantifier then "v" is not substituted in that quantifiers inner formula.- Specified by:
- substitutein interface- ComplexLogicalFormula
- Specified by:
- substitutein class- FolFormula
- Parameters:
- v- the term to be substituted.
- t- the term to substitute.
- Returns:
- a formula where every occurrence of "v" is replaced by "t".
 
- 
substituteDescription copied from class:RelationalFormulaSubstitutes all occurrences of all terms "v" in map.keyset() in this formula by map.get(v) and returns the new formula.
 NOTE: variables bound to quantifiers are not substituted in their inner formulas even if they appear in the map.- Specified by:
- substitutein interface- ComplexLogicalFormula
- Overrides:
- substitutein class- RelationalFormula
- Parameters:
- termMap- a mapping defining which terms to be substituted.
- Returns:
- a formula where every term in map.keyset() has been replaced by map.get(v).
 
- 
toString- Specified by:
- toStringin class- RelationalFormula
 
- 
hashCodepublic int hashCode()- Specified by:
- hashCodein interface- Collection<RelationalFormula>
- Specified by:
- hashCodein interface- List<RelationalFormula>
- Specified by:
- hashCodein interface- SimpleLogicalFormula
- Overrides:
- hashCodein class- Object
 
- 
equals- Specified by:
- equalsin interface- Collection<RelationalFormula>
- Specified by:
- equalsin interface- List<RelationalFormula>
- Specified by:
- equalsin interface- SimpleLogicalFormula
- Overrides:
- equalsin class- Object
 
- 
add- Specified by:
- addin interface- Collection<RelationalFormula>
- Specified by:
- addin interface- List<RelationalFormula>
 
- 
addAdds 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:
- addAllin interface- Collection<RelationalFormula>
- Specified by:
- addAllin interface- List<RelationalFormula>
 
- 
clearpublic void clear()- Specified by:
- clearin interface- Collection<RelationalFormula>
- Specified by:
- clearin interface- List<RelationalFormula>
 
- 
contains- Specified by:
- containsin interface- Collection<RelationalFormula>
- Specified by:
- containsin interface- List<RelationalFormula>
 
- 
containsAll- Specified by:
- containsAllin interface- Collection<RelationalFormula>
- Specified by:
- containsAllin interface- List<RelationalFormula>
 
- 
isEmptypublic boolean isEmpty()- Specified by:
- isEmptyin interface- Collection<RelationalFormula>
- Specified by:
- isEmptyin interface- List<RelationalFormula>
 
- 
iterator- Specified by:
- iteratorin interface- Collection<RelationalFormula>
- Specified by:
- iteratorin interface- Iterable<RelationalFormula>
- Specified by:
- iteratorin interface- List<RelationalFormula>
 
- 
remove- Specified by:
- removein interface- Collection<RelationalFormula>
- Specified by:
- removein interface- List<RelationalFormula>
 
- 
removeAll- Specified by:
- removeAllin interface- Collection<RelationalFormula>
- Specified by:
- removeAllin interface- List<RelationalFormula>
 
- 
retainAll- Specified by:
- retainAllin interface- Collection<RelationalFormula>
- Specified by:
- retainAllin interface- List<RelationalFormula>
 
- 
sizepublic int size()- Specified by:
- sizein interface- Collection<RelationalFormula>
- Specified by:
- sizein interface- List<RelationalFormula>
 
- 
toArray- Specified by:
- toArrayin interface- Collection<RelationalFormula>
- Specified by:
- toArrayin interface- List<RelationalFormula>
 
- 
toArraypublic <T> T[] toArray(T[] a) - Specified by:
- toArrayin interface- Collection<RelationalFormula>
- Specified by:
- toArrayin interface- List<RelationalFormula>
 
- 
add- Specified by:
- addin interface- List<RelationalFormula>
 
- 
addAll- Specified by:
- addAllin interface- List<RelationalFormula>
 
- 
get- Specified by:
- getin interface- List<RelationalFormula>
 
- 
indexOf- Specified by:
- indexOfin interface- List<RelationalFormula>
 
- 
lastIndexOf- Specified by:
- lastIndexOfin interface- List<RelationalFormula>
 
- 
listIterator- Specified by:
- listIteratorin interface- List<RelationalFormula>
 
- 
listIterator- Specified by:
- listIteratorin interface- List<RelationalFormula>
 
- 
remove- Specified by:
- removein interface- List<RelationalFormula>
 
- 
set- Specified by:
- setin interface- List<RelationalFormula>
 
- 
subList- Specified by:
- subListin interface- List<RelationalFormula>
 
 
-