Package net.sf.tweety.lp.asp.syntax
Class DefaultNegation
- java.lang.Object
-
- net.sf.tweety.lp.asp.syntax.ASPElement
-
- net.sf.tweety.lp.asp.syntax.ASPBodyElement
-
- net.sf.tweety.lp.asp.syntax.DefaultNegation
-
- All Implemented Interfaces:
net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
public class DefaultNegation extends ASPBodyElement
This class represents a default negated literal, i.e. "not a", where a is a classical atom or an aggregate atom.In answer set programming, the body of a rule is usually composed of a set of positive and negative literals, where this valuation refers to default negation or negation as failure. When implementing a rule, there are two opportunities:
- implement the rule with two distinct lists, representing the sets of positive and negative literals
- implement the rule with one set containing super literals, where a super literal can be positive or strictly negated, with or without default negation.
This library takes the second approach, which allows more flexibility, but comes at the cost that malformed constructs like "not not a" are not intercepted by the library.
- Author:
- Tim Janus, Thomas Vengels, Anna Gessler
-
-
Constructor Summary
Constructors Constructor Description DefaultNegation(ASPBodyElement at)Creates new default negation with the given literal.
-
Method Summary
Modifier and Type Method Description DefaultNegationclone()booleanequals(Object obj)Set<ASPAtom>getAtoms()ASPBodyElementgetLiteral()SortedSet<ASPLiteral>getLiterals()Returns all literals in this element in form of a SortedSet.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()booleanisLiteral()booleanisWellFormed()voidsetLiteral(ASPBodyElement literal)ASPBodyElementsubstitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v)StringtoString()-
Methods inherited from class net.sf.tweety.lp.asp.syntax.ASPElement
containsTermsOfType, exchange, getPredicateCls, isGround, substitute
-
-
-
-
Constructor Detail
-
DefaultNegation
public DefaultNegation(ASPBodyElement at)
Creates new default negation with the given literal.- Parameters:
at- a classical atom or an aggregate atom
-
-
Method Detail
-
getLiterals
public SortedSet<ASPLiteral> getLiterals()
Description copied from class:ASPBodyElementReturns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.- Specified by:
getLiteralsin classASPBodyElement- Returns:
- all the literals used in the rule element
-
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 ASPBodyElement 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 classASPBodyElement
-
getSignature
public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
- Specified by:
getSignaturein interfacenet.sf.tweety.commons.Formula- Specified by:
getSignaturein classASPElement
-
isWellFormed
public boolean isWellFormed()
- Specified by:
isWellFormedin interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Overrides:
isWellFormedin classASPElement
-
isLiteral
public boolean isLiteral()
-
getTerms
public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
-
getTerms
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms(Class<C> cls)
-
clone
public DefaultNegation 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
-
getLiteral
public ASPBodyElement getLiteral()
-
setLiteral
public void setLiteral(ASPBodyElement literal)
-
hashCode
public int hashCode()
-
-