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>
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 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 void
add(int index, ComplexConcept element)
boolean
add(ComplexConcept e)
boolean
addAll(int index, java.util.Collection<? extends ComplexConcept> c)
boolean
addAll(java.util.Collection<? extends ComplexConcept> c)
void
clear()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
Signature
createEmptySignature()
boolean
equals(java.lang.Object obj)
ComplexConcept
get(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 formulaDlSignature
getSignature()
Returns the signature of the language of this formula.int
hashCode()
int
indexOf(java.lang.Object o)
boolean
isEmpty()
boolean
isLiteral()
java.util.Iterator<ComplexConcept>
iterator()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<ComplexConcept>
listIterator()
java.util.ListIterator<ComplexConcept>
listIterator(int index)
ComplexConcept
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
ComplexConcept
set(int index, ComplexConcept element)
int
size()
java.util.List<ComplexConcept>
subList(int fromIndex, int toIndex)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
java.lang.String
toString()
-
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:
createEmptySignature
in interfaceAssociativeFormulaSupport.AssociativeSupportBridge
- Returns:
- An empty signature of the language of the AssociativeFormula implementation
-
getSignature
public DlSignature getSignature()
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Specified by:
getSignature
in classComplexConcept
- Returns:
- the signature of the language of this formula.
-
getPredicates
public java.util.Set<Predicate> 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 classComplexConcept
- Returns:
- all predicates that appear in this formula
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteral
in interfaceSimpleLogicalFormula
- Returns:
- true if the formula represents a literal in the language or false otherwise
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
hashCode
in interfacejava.util.List<ComplexConcept>
- Specified by:
hashCode
in interfaceSimpleLogicalFormula
- Specified by:
hashCode
in classComplexConcept
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
equals
in interfacejava.util.List<ComplexConcept>
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Specified by:
equals
in classComplexConcept
-
getFormulas
public java.util.List<ComplexConcept> getFormulas()
- Specified by:
getFormulas
in 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:AssociativeFormula
Process the formulas of type C that are children of this associative formula- Specified by:
getFormulas
in 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:
toString
in classjava.lang.Object
-
add
public boolean add(ComplexConcept e)
- Specified by:
add
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
add
in interfacejava.util.List<ComplexConcept>
-
addAll
public boolean addAll(java.util.Collection<? extends ComplexConcept> c)
- Specified by:
addAll
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
addAll
in interfacejava.util.List<ComplexConcept>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
clear
in interfacejava.util.List<ComplexConcept>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
contains
in interfacejava.util.List<ComplexConcept>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
containsAll
in interfacejava.util.List<ComplexConcept>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
isEmpty
in interfacejava.util.List<ComplexConcept>
-
iterator
public java.util.Iterator<ComplexConcept> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
iterator
in interfacejava.lang.Iterable<ComplexConcept>
- Specified by:
iterator
in interfacejava.util.List<ComplexConcept>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
remove
in interfacejava.util.List<ComplexConcept>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
removeAll
in interfacejava.util.List<ComplexConcept>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
retainAll
in interfacejava.util.List<ComplexConcept>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
size
in interfacejava.util.List<ComplexConcept>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
toArray
in interfacejava.util.List<ComplexConcept>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<ComplexConcept>
- Specified by:
toArray
in interfacejava.util.List<ComplexConcept>
-
add
public void add(int index, ComplexConcept element)
- Specified by:
add
in interfacejava.util.List<ComplexConcept>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends ComplexConcept> c)
- Specified by:
addAll
in interfacejava.util.List<ComplexConcept>
-
get
public ComplexConcept get(int index)
- Specified by:
get
in interfacejava.util.List<ComplexConcept>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<ComplexConcept>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<ComplexConcept>
-
listIterator
public java.util.ListIterator<ComplexConcept> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<ComplexConcept>
-
listIterator
public java.util.ListIterator<ComplexConcept> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<ComplexConcept>
-
remove
public ComplexConcept remove(int index)
- Specified by:
remove
in interfacejava.util.List<ComplexConcept>
-
set
public ComplexConcept set(int index, ComplexConcept element)
- Specified by:
set
in interfacejava.util.List<ComplexConcept>
-
subList
public java.util.List<ComplexConcept> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<ComplexConcept>
-
-