Class LdoAssociativeFormula
- java.lang.Object
-
- net.sf.tweety.arg.dung.ldo.syntax.LdoFormula
-
- net.sf.tweety.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
-
-
Field Summary
Fields Modifier and Type Field Description protected AssociativeFormulaSupport<LdoFormula>
support
The inner formulas of this formula
-
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 void
add(int index, LdoFormula element)
boolean
add(LdoFormula f)
boolean
addAll(int index, java.util.Collection<? extends LdoFormula> c)
boolean
addAll(java.util.Collection<? extends LdoFormula> c)
void
clear()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
Signature
createEmptySignature()
boolean
equals(java.lang.Object obj)
LdoFormula
get(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 formulaDungSignature
getSignature()
Returns the signature of the language of this formula.int
hashCode()
int
indexOf(java.lang.Object o)
boolean
isEmpty()
java.util.Iterator<LdoFormula>
iterator()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<LdoFormula>
listIterator()
java.util.ListIterator<LdoFormula>
listIterator(int index)
LdoFormula
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
LdoFormula
set(int index, LdoFormula element)
int
size()
java.util.List<LdoFormula>
subList(int fromIndex, int toIndex)
java.lang.Object[]
toArray()
java.lang.Object[]
toArray(java.lang.Object[] a)
java.lang.String
toString()
-
Methods inherited from class net.sf.tweety.arg.dung.ldo.syntax.LdoFormula
clone, combineWithAnd, combineWithOr, complement, getDividers, getPredicateCls, getUniformProbability, isLiteral
-
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 net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
clone, getPredicateCls, isLiteral
-
-
-
-
Field Detail
-
support
protected AssociativeFormulaSupport<LdoFormula> support
The inner formulas of this formula
-
-
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:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Specified by:
getPredicates
in classLdoFormula
- Returns:
- all predicates that appear in this formula
-
getFormulas
public java.util.List<LdoFormula> getFormulas()
- Specified by:
getFormulas
in 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:AssociativeFormula
Process the formulas of type C that are children of this associative formula- Specified by:
getFormulas
in 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:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Specified by:
getAtoms
in classLdoFormula
- Returns:
- The set of all atoms
-
getLiterals
public java.util.Set<LdoFormula> getLiterals()
Description copied from class:LdoFormula
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 classLdoFormula
- Returns:
- all literals appearing in this formula.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSignature
public DungSignature getSignature()
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Overrides:
getSignature
in classLdoFormula
- Returns:
- the signature of the language of this formula.
-
createEmptySignature
public Signature createEmptySignature()
- Specified by:
createEmptySignature
in interfaceAssociativeFormulaSupport.AssociativeSupportBridge
- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<LdoFormula>
- Specified by:
hashCode
in interfacejava.util.List<LdoFormula>
- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Specified by:
hashCode
in classLdoFormula
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Collection<LdoFormula>
- Specified by:
equals
in interfacejava.util.List<LdoFormula>
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Specified by:
equals
in classLdoFormula
-
add
public boolean add(LdoFormula f)
- Specified by:
add
in interfacejava.util.Collection<LdoFormula>
- Specified by:
add
in interfacejava.util.List<LdoFormula>
-
addAll
public boolean addAll(java.util.Collection<? extends LdoFormula> c)
- Specified by:
addAll
in interfacejava.util.Collection<LdoFormula>
- Specified by:
addAll
in interfacejava.util.List<LdoFormula>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<LdoFormula>
- Specified by:
clear
in interfacejava.util.List<LdoFormula>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<LdoFormula>
- Specified by:
contains
in interfacejava.util.List<LdoFormula>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<LdoFormula>
- Specified by:
containsAll
in interfacejava.util.List<LdoFormula>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<LdoFormula>
- Specified by:
isEmpty
in interfacejava.util.List<LdoFormula>
-
iterator
public java.util.Iterator<LdoFormula> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<LdoFormula>
- Specified by:
iterator
in interfacejava.lang.Iterable<LdoFormula>
- Specified by:
iterator
in interfacejava.util.List<LdoFormula>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<LdoFormula>
- Specified by:
remove
in interfacejava.util.List<LdoFormula>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<LdoFormula>
- Specified by:
removeAll
in interfacejava.util.List<LdoFormula>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<LdoFormula>
- Specified by:
retainAll
in interfacejava.util.List<LdoFormula>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<LdoFormula>
- Specified by:
size
in interfacejava.util.List<LdoFormula>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<LdoFormula>
- Specified by:
toArray
in interfacejava.util.List<LdoFormula>
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Specified by:
toArray
in interfacejava.util.Collection<LdoFormula>
- Specified by:
toArray
in interfacejava.util.List<LdoFormula>
-
add
public void add(int index, LdoFormula element)
- Specified by:
add
in interfacejava.util.List<LdoFormula>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends LdoFormula> c)
- Specified by:
addAll
in interfacejava.util.List<LdoFormula>
-
get
public LdoFormula get(int index)
- Specified by:
get
in interfacejava.util.List<LdoFormula>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<LdoFormula>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<LdoFormula>
-
listIterator
public java.util.ListIterator<LdoFormula> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<LdoFormula>
-
listIterator
public java.util.ListIterator<LdoFormula> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<LdoFormula>
-
remove
public LdoFormula remove(int index)
- Specified by:
remove
in interfacejava.util.List<LdoFormula>
-
set
public LdoFormula set(int index, LdoFormula element)
- Specified by:
set
in interfacejava.util.List<LdoFormula>
-
subList
public java.util.List<LdoFormula> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<LdoFormula>
-
-