Package net.sf.tweety.lp.asp.syntax
Class ASPHead
- java.lang.Object
-
- net.sf.tweety.lp.asp.syntax.ASPElement
-
- net.sf.tweety.lp.asp.syntax.ASPHead
-
- All Implemented Interfaces:
Iterable<ASPLiteral>,Collection<ASPLiteral>,List<ASPLiteral>,net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge,net.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<ASPLiteral>,net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable,net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
public class ASPHead extends ASPElement implements net.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<ASPLiteral>, net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable, net.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
This formula represents the head of an disjunctive rule which is a disjunction of literals.- Author:
- Tim Janus, Anna Gessler
-
-
Constructor Summary
Constructors Constructor Description ASPHead()Empty Constructor.ASPHead(List<ASPLiteral> head_elements)Creates a new head with the given elements.ASPHead(ASPHead other)Copy-ConstructorASPHead(ASPLiteral head)Creates a new head with a single element.
-
Method Summary
Modifier and Type Method Description voidadd(int index, ASPLiteral element)booleanadd(ASPLiteral e)booleanadd(ASPLiteral... formulas)Adds the specified elements to the end of this collection (optional operation).booleanaddAll(int index, Collection<? extends ASPLiteral> c)booleanaddAll(Collection<? extends ASPLiteral> c)voidclear()ASPHeadclone()net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormulacombineWithOr(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)booleancontains(Object o)booleancontainsAll(Collection<?> c)<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
booleancontainsTermsOfType(Class<C> cls)ASPHeadcreateEmptyFormula()net.sf.tweety.logics.fol.syntax.FolSignaturecreateEmptySignature()booleanequals(Object other)ASPHeadexchange(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)ASPLiteralget(int index)Set<ASPAtom>getAtoms()StringgetEmptySymbol()List<ASPLiteral>getFormulas()<C extends net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula>
Set<C>getFormulas(Class<C> cls)SortedSet<ASPLiteral>getLiterals()Returns all literals in this element in form of a SortedSet.StringgetOperatorSymbol()Class<? extends net.sf.tweety.logics.commons.syntax.Predicate>getPredicateCls()Set<net.sf.tweety.logics.commons.syntax.Predicate>getPredicates()net.sf.tweety.logics.fol.syntax.FolSignaturegetSignature()Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getTerms()<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
Set<C>getTerms(Class<C> cls)inthashCode()intindexOf(Object o)booleanisEmpty()booleanisGround()booleanisLiteral()booleanisWellFormed()Iterator<ASPLiteral>iterator()intlastIndexOf(Object o)ListIterator<ASPLiteral>listIterator()ListIterator<ASPLiteral>listIterator(int index)ASPLiteralremove(int index)booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)ASPLiteralset(int index, ASPLiteral element)intsize()List<ASPLiteral>subList(int fromIndex, int toIndex)ASPHeadsubstitute(Map<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>,? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> map)ASPHeadsubstitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v)Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Constructor Detail
-
ASPHead
public ASPHead()
Empty Constructor.
-
ASPHead
public ASPHead(List<ASPLiteral> head_elements)
Creates a new head with the given elements.- Parameters:
head_elements- list of literals
-
ASPHead
public ASPHead(ASPLiteral head)
Creates a new head with a single element.- Parameters:
head- an ASP literal
-
ASPHead
public ASPHead(ASPHead other)
Copy-Constructor- Parameters:
other- another ASPHead
-
-
Method Detail
-
isGround
public boolean isGround()
- Specified by:
isGroundin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Overrides:
isGroundin classASPElement
-
isWellFormed
public boolean isWellFormed()
- Specified by:
isWellFormedin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Overrides:
isWellFormedin classASPElement
-
getPredicateCls
public Class<? extends net.sf.tweety.logics.commons.syntax.Predicate> getPredicateCls()
- Specified by:
getPredicateClsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Overrides:
getPredicateClsin classASPElement
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteralin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
getTerms
public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
- Specified by:
getTermsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
getTerms
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms(Class<C> cls)
- Specified by:
getTermsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
containsTermsOfType
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> boolean containsTermsOfType(Class<C> cls)
- Specified by:
containsTermsOfTypein interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure- Overrides:
containsTermsOfTypein classASPElement
-
getPredicates
public Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getPredicatesin classASPElement
-
getAtoms
public Set<ASPAtom> getAtoms()
- Specified by:
getAtomsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getAtomsin classASPElement
-
substitute
public ASPHead substitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v)
- Specified by:
substitutein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
substitutein classASPElement
-
getSignature
public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
- Specified by:
getSignaturein interfacenet.sf.tweety.commons.Formula- Specified by:
getSignaturein classASPElement
-
clone
public ASPHead clone()
- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
clonein classASPElement
-
add
public boolean add(ASPLiteral e)
- Specified by:
addin interfaceCollection<ASPLiteral>- Specified by:
addin interfaceList<ASPLiteral>
-
add
public void add(int index, ASPLiteral element)- Specified by:
addin interfaceList<ASPLiteral>
-
addAll
public boolean addAll(Collection<? extends ASPLiteral> c)
- Specified by:
addAllin interfaceCollection<ASPLiteral>- Specified by:
addAllin interfaceList<ASPLiteral>
-
addAll
public boolean addAll(int index, Collection<? extends ASPLiteral> c)- Specified by:
addAllin interfaceList<ASPLiteral>
-
add
public boolean add(ASPLiteral... 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
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<ASPLiteral>- Specified by:
clearin interfaceList<ASPLiteral>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<ASPLiteral>- Specified by:
containsin interfaceList<ASPLiteral>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<ASPLiteral>- Specified by:
containsAllin interfaceList<ASPLiteral>
-
get
public ASPLiteral get(int index)
- Specified by:
getin interfaceList<ASPLiteral>
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOfin interfaceList<ASPLiteral>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<ASPLiteral>- Specified by:
isEmptyin interfaceList<ASPLiteral>
-
iterator
public Iterator<ASPLiteral> iterator()
- Specified by:
iteratorin interfaceCollection<ASPLiteral>- Specified by:
iteratorin interfaceIterable<ASPLiteral>- Specified by:
iteratorin interfaceList<ASPLiteral>
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<ASPLiteral>
-
listIterator
public ListIterator<ASPLiteral> listIterator()
- Specified by:
listIteratorin interfaceList<ASPLiteral>
-
listIterator
public ListIterator<ASPLiteral> listIterator(int index)
- Specified by:
listIteratorin interfaceList<ASPLiteral>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<ASPLiteral>- Specified by:
removein interfaceList<ASPLiteral>
-
remove
public ASPLiteral remove(int index)
- Specified by:
removein interfaceList<ASPLiteral>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<ASPLiteral>- Specified by:
removeAllin interfaceList<ASPLiteral>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<ASPLiteral>- Specified by:
retainAllin interfaceList<ASPLiteral>
-
set
public ASPLiteral set(int index, ASPLiteral element)
- Specified by:
setin interfaceList<ASPLiteral>
-
size
public int size()
- Specified by:
sizein interfaceCollection<ASPLiteral>- Specified by:
sizein interfaceList<ASPLiteral>
-
subList
public List<ASPLiteral> subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceList<ASPLiteral>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<ASPLiteral>- Specified by:
toArrayin interfaceList<ASPLiteral>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<ASPLiteral>- Specified by:
toArrayin interfaceList<ASPLiteral>
-
getFormulas
public List<ASPLiteral> getFormulas()
- Specified by:
getFormulasin interfacenet.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<ASPLiteral>
-
getFormulas
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula> Set<C> getFormulas(Class<C> cls)
- Specified by:
getFormulasin interfacenet.sf.tweety.logics.commons.syntax.interfaces.AssociativeFormula<ASPLiteral>
-
createEmptyFormula
public ASPHead createEmptyFormula()
- Specified by:
createEmptyFormulain interfacenet.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
-
createEmptySignature
public net.sf.tweety.logics.fol.syntax.FolSignature createEmptySignature()
- Specified by:
createEmptySignaturein interfacenet.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
-
getOperatorSymbol
public String getOperatorSymbol()
- Specified by:
getOperatorSymbolin interfacenet.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
-
getEmptySymbol
public String getEmptySymbol()
- Specified by:
getEmptySymbolin interfacenet.sf.tweety.logics.commons.syntax.AssociativeFormulaSupport.AssociativeSupportBridge
-
combineWithOr
public net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula combineWithOr(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)
- Specified by:
combineWithOrin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Disjunctable
-
substitute
public ASPHead substitute(Map<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>,? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> map) throws IllegalArgumentException
- Specified by:
substitutein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Overrides:
substitutein classASPElement- Throws:
IllegalArgumentException
-
exchange
public ASPHead exchange(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t) throws IllegalArgumentException
- Specified by:
exchangein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Overrides:
exchangein classASPElement- Throws:
IllegalArgumentException
-
getLiterals
public SortedSet<ASPLiteral> getLiterals()
Returns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.- Returns:
- all the literals used in the rule element
-
equals
public boolean equals(Object other)
- Specified by:
equalsin interfaceCollection<ASPLiteral>- Specified by:
equalsin interfaceList<ASPLiteral>- Specified by:
equalsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Overrides:
equalsin classObject
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<ASPLiteral>- Specified by:
hashCodein interfaceList<ASPLiteral>- Specified by:
hashCodein interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Overrides:
hashCodein classObject
-
-