Class LdoAssociativeFormula
- java.lang.Object
-
- org.tweetyproject.arg.dung.ldo.syntax.LdoFormula
-
- org.tweetyproject.arg.dung.ldo.syntax.LdoAssociativeFormula
-
- All Implemented Interfaces:
java.lang.Iterable<LdoFormula>,java.util.Collection<LdoFormula>,java.util.List<LdoFormula>,Formula,AssociativeFormulaSupport.AssociativeSupportBridge,AssociativeFormula<LdoFormula>,ClassicalFormula,Conjunctable,Disjunctable,Invertable,ProbabilityAware,SimpleLogicalFormula
- Direct Known Subclasses:
LdoConjunction,LdoDisjunction
public abstract class LdoAssociativeFormula extends LdoFormula implements AssociativeFormula<LdoFormula>, AssociativeFormulaSupport.AssociativeSupportBridge, java.util.Collection<LdoFormula>
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 LdoAssociativeFormula()Creates a new (empty) associative formula.LdoAssociativeFormula(java.util.Collection<? extends LdoFormula> formulas)Creates a new associative formula with the given inner formulas.LdoAssociativeFormula(LdoFormula first, LdoFormula second)Creates a new associative formula with the two given formulae
-
Method Summary
Modifier and Type Method Description voidadd(int index, LdoFormula element)booleanadd(LdoFormula f)booleanadd(LdoFormula... formulas)Adds the specified elements to the end of this collection (optional operation).booleanaddAll(int index, java.util.Collection<? extends LdoFormula> c)booleanaddAll(java.util.Collection<? extends LdoFormula> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)SignaturecreateEmptySignature()booleanequals(java.lang.Object obj)LdoFormulaget(int index)java.util.Set<LdoArgument>getAtoms()Processes the set of all atoms which appear in this formulajava.util.List<LdoFormula>getFormulas()<C extends SimpleLogicalFormula>
java.util.Set<C>getFormulas(java.lang.Class<C> cls)Process the formulas of type C that are children of this associative formulajava.util.Set<LdoFormula>getLiterals()Returns all literals, i.e.java.util.Set<PlPredicate>getPredicates()Processes the set of all predicates which appear in this formulaDungSignaturegetSignature()Returns the signature of the language of this formula.inthashCode()intindexOf(java.lang.Object o)booleanisEmpty()java.util.Iterator<LdoFormula>iterator()intlastIndexOf(java.lang.Object o)java.util.ListIterator<LdoFormula>listIterator()java.util.ListIterator<LdoFormula>listIterator(int index)LdoFormularemove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)LdoFormulaset(int index, LdoFormula element)intsize()java.util.List<LdoFormula>subList(int fromIndex, int toIndex)java.lang.Object[]toArray()java.lang.Object[]toArray(java.lang.Object[] a)java.lang.StringtoString()-
Methods inherited from class org.tweetyproject.arg.dung.ldo.syntax.LdoFormula
clone, combineWithAnd, combineWithOr, complement, getDividers, getPredicateCls, getUniformProbability, isLiteral
-
Methods inherited from interface org.tweetyproject.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
createEmptyFormula, getEmptySymbol, getOperatorSymbol
-
Methods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
clone, getPredicateCls, isLiteral
-
-
-
-
Constructor Detail
-
LdoAssociativeFormula
public LdoAssociativeFormula()
Creates a new (empty) associative formula.
-
LdoAssociativeFormula
public LdoAssociativeFormula(java.util.Collection<? extends LdoFormula> formulas)
Creates a new associative formula with the given inner formulas.- Parameters:
formulas- a collection of formulas.
-
LdoAssociativeFormula
public LdoAssociativeFormula(LdoFormula first, LdoFormula second)
Creates a new associative formula with the two given formulae- Parameters:
first- a propositional formula.second- a propositional formula.
-
-
Method Detail
-
getPredicates
public java.util.Set<PlPredicate> getPredicates()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Specified by:
getPredicatesin classLdoFormula- Returns:
- all predicates that appear in this formula
-
getFormulas
public java.util.List<LdoFormula> getFormulas()
- Specified by:
getFormulasin interfaceAssociativeFormula<LdoFormula>- Returns:
- all the formulas saved as childs in the associative formula
-
getFormulas
public <C extends SimpleLogicalFormula> java.util.Set<C> getFormulas(java.lang.Class<C> cls)
Description copied from interface:AssociativeFormulaProcess the formulas of type C that are children of this associative formula- Specified by:
getFormulasin interfaceAssociativeFormula<LdoFormula>- 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
public java.util.Set<LdoArgument> getAtoms()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Specified by:
getAtomsin classLdoFormula- Returns:
- The set of all atoms
-
getLiterals
public java.util.Set<LdoFormula> getLiterals()
Description copied from class:LdoFormulaReturns 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 classLdoFormula- Returns:
- all literals appearing in this formula.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getSignature
public DungSignature getSignature()
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Overrides:
getSignaturein classLdoFormula- Returns:
- the signature of the language of this formula.
-
createEmptySignature
public Signature createEmptySignature()
- Specified by:
createEmptySignaturein interfaceAssociativeFormulaSupport.AssociativeSupportBridge- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<LdoFormula>- Specified by:
hashCodein interfacejava.util.List<LdoFormula>- Specified by:
hashCodein interfaceSimpleLogicalFormula- Specified by:
hashCodein classLdoFormula
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Collection<LdoFormula>- Specified by:
equalsin interfacejava.util.List<LdoFormula>- Specified by:
equalsin interfaceSimpleLogicalFormula- Specified by:
equalsin classLdoFormula
-
add
public boolean add(LdoFormula f)
- Specified by:
addin interfacejava.util.Collection<LdoFormula>- Specified by:
addin interfacejava.util.List<LdoFormula>
-
add
public boolean add(LdoFormula... 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 LdoFormula> c)
- Specified by:
addAllin interfacejava.util.Collection<LdoFormula>- Specified by:
addAllin interfacejava.util.List<LdoFormula>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<LdoFormula>- Specified by:
clearin interfacejava.util.List<LdoFormula>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<LdoFormula>- Specified by:
containsin interfacejava.util.List<LdoFormula>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<LdoFormula>- Specified by:
containsAllin interfacejava.util.List<LdoFormula>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<LdoFormula>- Specified by:
isEmptyin interfacejava.util.List<LdoFormula>
-
iterator
public java.util.Iterator<LdoFormula> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<LdoFormula>- Specified by:
iteratorin interfacejava.lang.Iterable<LdoFormula>- Specified by:
iteratorin interfacejava.util.List<LdoFormula>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<LdoFormula>- Specified by:
removein interfacejava.util.List<LdoFormula>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<LdoFormula>- Specified by:
removeAllin interfacejava.util.List<LdoFormula>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<LdoFormula>- Specified by:
retainAllin interfacejava.util.List<LdoFormula>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<LdoFormula>- Specified by:
sizein interfacejava.util.List<LdoFormula>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<LdoFormula>- Specified by:
toArrayin interfacejava.util.List<LdoFormula>
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Specified by:
toArrayin interfacejava.util.Collection<LdoFormula>- Specified by:
toArrayin interfacejava.util.List<LdoFormula>
-
add
public void add(int index, LdoFormula element)- Specified by:
addin interfacejava.util.List<LdoFormula>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends LdoFormula> c)- Specified by:
addAllin interfacejava.util.List<LdoFormula>
-
get
public LdoFormula get(int index)
- Specified by:
getin interfacejava.util.List<LdoFormula>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfacejava.util.List<LdoFormula>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List<LdoFormula>
-
listIterator
public java.util.ListIterator<LdoFormula> listIterator()
- Specified by:
listIteratorin interfacejava.util.List<LdoFormula>
-
listIterator
public java.util.ListIterator<LdoFormula> listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List<LdoFormula>
-
remove
public LdoFormula remove(int index)
- Specified by:
removein interfacejava.util.List<LdoFormula>
-
set
public LdoFormula set(int index, LdoFormula element)
- Specified by:
setin interfacejava.util.List<LdoFormula>
-
subList
public java.util.List<LdoFormula> subList(int fromIndex, int toIndex)
- Specified by:
subListin interfacejava.util.List<LdoFormula>
-
-