Package net.sf.tweety.logics.dl.syntax
Class AssociativeDlFormula
- java.lang.Object
-
- net.sf.tweety.logics.dl.syntax.ComplexConcept
-
- net.sf.tweety.logics.dl.syntax.AssociativeDlFormula
-
- All Implemented Interfaces:
java.lang.Iterable<ComplexConcept>,java.util.Collection<ComplexConcept>,java.util.List<ComplexConcept>,Formula,AssociativeFormulaSupport.AssociativeSupportBridge,AssociativeFormula<ComplexConcept>,ClassicalFormula,Conjunctable,Disjunctable,Invertable,ProbabilityAware,SimpleLogicalFormula
- Direct Known Subclasses:
Intersection,Union
public abstract class AssociativeDlFormula extends ComplexConcept implements AssociativeFormula<ComplexConcept>, AssociativeFormulaSupport.AssociativeSupportBridge
This class captures the common functionalities of description logic associative formulas (union and intersection).- Author:
- Anna Gessler, Matthias Thimm, Tim Janus
-
-
Field Summary
Fields Modifier and Type Field Description protected AssociativeFormulaSupport<ComplexConcept>supportThis helper class implements most of the common functionality of an associative formula, so the implementation can delegate the method calls to the support class.
-
Constructor Summary
Constructors Constructor Description AssociativeDlFormula()Creates a new (empty) associative formula.AssociativeDlFormula(java.util.Collection<? extends ComplexConcept> formulas)Creates a new associative formula with the given inner formulas.AssociativeDlFormula(ComplexConcept first, ComplexConcept second)Creates a new associative formula with the two given formulae
-
Method Summary
Modifier and Type Method Description voidadd(int index, ComplexConcept element)booleanadd(ComplexConcept e)booleanaddAll(int index, java.util.Collection<? extends ComplexConcept> c)booleanaddAll(java.util.Collection<? extends ComplexConcept> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)SignaturecreateEmptySignature()booleanequals(java.lang.Object obj)ComplexConceptget(int index)java.util.List<ComplexConcept>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<Predicate>getPredicates()Processes the set of all predicates which appear in this formulaDlSignaturegetSignature()Returns the signature of the language of this formula.inthashCode()intindexOf(java.lang.Object o)booleanisEmpty()booleanisLiteral()java.util.Iterator<ComplexConcept>iterator()intlastIndexOf(java.lang.Object o)java.util.ListIterator<ComplexConcept>listIterator()java.util.ListIterator<ComplexConcept>listIterator(int index)ComplexConceptremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)ComplexConceptset(int index, ComplexConcept element)intsize()java.util.List<ComplexConcept>subList(int fromIndex, int toIndex)java.lang.Object[]toArray()<T> T[]toArray(T[] a)java.lang.StringtoString()-
Methods inherited from class net.sf.tweety.logics.dl.syntax.ComplexConcept
clone, collapseAssociativeFormulas, combineWithAnd, combineWithOr, complement, getAtoms, getPredicateCls, getUniformProbability
-
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, getAtoms, getPredicateCls
-
-
-
-
Field Detail
-
support
protected AssociativeFormulaSupport<ComplexConcept> support
This helper class implements most of the common functionality of an associative formula, so the implementation can delegate the method calls to the support class.
-
-
Constructor Detail
-
AssociativeDlFormula
public AssociativeDlFormula()
Creates a new (empty) associative formula.
-
AssociativeDlFormula
public AssociativeDlFormula(ComplexConcept first, ComplexConcept second)
Creates a new associative formula with the two given formulae- Parameters:
first- a relational formula.second- a relational formula.
-
AssociativeDlFormula
public AssociativeDlFormula(java.util.Collection<? extends ComplexConcept> formulas)
Creates a new associative formula with the given inner formulas.- Parameters:
formulas- a collection of formulas.
-
-
Method Detail
-
createEmptySignature
public Signature createEmptySignature()
- Specified by:
createEmptySignaturein interfaceAssociativeFormulaSupport.AssociativeSupportBridge- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
getSignature
public DlSignature getSignature()
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Specified by:
getSignaturein classComplexConcept- Returns:
- the signature of the language of this formula.
-
getPredicates
public java.util.Set<Predicate> getPredicates()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Specified by:
getPredicatesin classComplexConcept- Returns:
- all predicates that appear in this formula
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteralin interfaceSimpleLogicalFormula- Returns:
- true if the formula represents a literal in the language or false otherwise
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<ComplexConcept>- Specified by:
hashCodein interfacejava.util.List<ComplexConcept>- Specified by:
hashCodein interfaceSimpleLogicalFormula- Specified by:
hashCodein classComplexConcept
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Collection<ComplexConcept>- Specified by:
equalsin interfacejava.util.List<ComplexConcept>- Specified by:
equalsin interfaceSimpleLogicalFormula- Specified by:
equalsin classComplexConcept
-
getFormulas
public java.util.List<ComplexConcept> getFormulas()
- Specified by:
getFormulasin interfaceAssociativeFormula<ComplexConcept>- 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<ComplexConcept>- 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
add
public boolean add(ComplexConcept e)
- Specified by:
addin interfacejava.util.Collection<ComplexConcept>- Specified by:
addin interfacejava.util.List<ComplexConcept>
-
addAll
public boolean addAll(java.util.Collection<? extends ComplexConcept> c)
- Specified by:
addAllin interfacejava.util.Collection<ComplexConcept>- Specified by:
addAllin interfacejava.util.List<ComplexConcept>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<ComplexConcept>- Specified by:
clearin interfacejava.util.List<ComplexConcept>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<ComplexConcept>- Specified by:
containsin interfacejava.util.List<ComplexConcept>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<ComplexConcept>- Specified by:
containsAllin interfacejava.util.List<ComplexConcept>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<ComplexConcept>- Specified by:
isEmptyin interfacejava.util.List<ComplexConcept>
-
iterator
public java.util.Iterator<ComplexConcept> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<ComplexConcept>- Specified by:
iteratorin interfacejava.lang.Iterable<ComplexConcept>- Specified by:
iteratorin interfacejava.util.List<ComplexConcept>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<ComplexConcept>- Specified by:
removein interfacejava.util.List<ComplexConcept>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<ComplexConcept>- Specified by:
removeAllin interfacejava.util.List<ComplexConcept>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<ComplexConcept>- Specified by:
retainAllin interfacejava.util.List<ComplexConcept>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<ComplexConcept>- Specified by:
sizein interfacejava.util.List<ComplexConcept>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<ComplexConcept>- Specified by:
toArrayin interfacejava.util.List<ComplexConcept>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfacejava.util.Collection<ComplexConcept>- Specified by:
toArrayin interfacejava.util.List<ComplexConcept>
-
add
public void add(int index, ComplexConcept element)- Specified by:
addin interfacejava.util.List<ComplexConcept>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends ComplexConcept> c)- Specified by:
addAllin interfacejava.util.List<ComplexConcept>
-
get
public ComplexConcept get(int index)
- Specified by:
getin interfacejava.util.List<ComplexConcept>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfacejava.util.List<ComplexConcept>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List<ComplexConcept>
-
listIterator
public java.util.ListIterator<ComplexConcept> listIterator()
- Specified by:
listIteratorin interfacejava.util.List<ComplexConcept>
-
listIterator
public java.util.ListIterator<ComplexConcept> listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List<ComplexConcept>
-
remove
public ComplexConcept remove(int index)
- Specified by:
removein interfacejava.util.List<ComplexConcept>
-
set
public ComplexConcept set(int index, ComplexConcept element)
- Specified by:
setin interfacejava.util.List<ComplexConcept>
-
subList
public java.util.List<ComplexConcept> subList(int fromIndex, int toIndex)
- Specified by:
subListin interfacejava.util.List<ComplexConcept>
-
-