Class ASPAtom

  • All Implemented Interfaces:
    Comparable<ASPLiteral>, net.sf.tweety.commons.Formula, net.sf.tweety.logics.commons.syntax.interfaces.Atom, net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula, net.sf.tweety.logics.commons.syntax.interfaces.Invertable, net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure, net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula

    public class ASPAtom
    extends ASPLiteral
    This class models an atom, which is a basic structure for building literals and rules for logic programs.
    Author:
    Tim Janus, Thomas Vengels, Matthias Thimm, Anna Gessler
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface net.sf.tweety.logics.commons.syntax.interfaces.Atom

        net.sf.tweety.logics.commons.syntax.interfaces.Atom.AtomImpl, net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATE
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> arguments
      A list of arguments of the atom
      protected net.sf.tweety.logics.commons.syntax.Predicate predicate
      The predicate identifying the atom
    • Constructor Summary

      Constructors 
      Constructor Description
      ASPAtom()
      Empty constructor.
      ASPAtom​(String name)
      Creates a new atom with the given predicate name and no terms.
      ASPAtom​(String symbol, net.sf.tweety.logics.commons.syntax.interfaces.Term<?>... terms)
      Creates an atom with the given predicate as name and the given terms as argument
      ASPAtom​(net.sf.tweety.logics.commons.syntax.Predicate p)
      Creates a new ASPAtom with the given predicate.
      ASPAtom​(net.sf.tweety.logics.commons.syntax.Predicate p, List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> terms)
      Creates a new atom with the given predicate and terms.
      ASPAtom​(net.sf.tweety.logics.fol.syntax.FolAtom other)
      Copy-Constructor: Generates a deep copy of the given FOL atom.
      ASPAtom​(ASPAtom other)
      Copy-Constructor: Generates a deep copy of the given ASP atom.
    • Field Detail

      • predicate

        protected net.sf.tweety.logics.commons.syntax.Predicate predicate
        The predicate identifying the atom
      • arguments

        protected List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> arguments
        A list of arguments of the atom
    • Constructor Detail

      • ASPAtom

        public ASPAtom()
        Empty constructor.
      • ASPAtom

        public ASPAtom​(net.sf.tweety.logics.commons.syntax.Predicate p,
                       List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> terms)
        Creates a new atom with the given predicate and terms.
        Parameters:
        p - a predicate
        terms - arguments of the atom
      • ASPAtom

        public ASPAtom​(String name)
        Creates a new atom with the given predicate name and no terms.
        Parameters:
        name - a name
      • ASPAtom

        public ASPAtom​(net.sf.tweety.logics.fol.syntax.FolAtom other)
        Copy-Constructor: Generates a deep copy of the given FOL atom.
        Parameters:
        other - The FOL atom acting as source for the deep copy
      • ASPAtom

        public ASPAtom​(ASPAtom other)
        Copy-Constructor: Generates a deep copy of the given ASP atom.
        Parameters:
        other - The atom acting as source for the deep copy
      • ASPAtom

        public ASPAtom​(String symbol,
                       net.sf.tweety.logics.commons.syntax.interfaces.Term<?>... terms)
        Creates an atom with the given predicate as name and the given terms as argument
        Parameters:
        symbol - The name of the atom
        terms - A list of Term<?> defining the arguments of the term
      • ASPAtom

        public ASPAtom​(net.sf.tweety.logics.commons.syntax.Predicate p)
        Creates a new ASPAtom with the given predicate.
        Parameters:
        p - a predicate
    • Method Detail

      • getName

        public String getName()
      • getLiterals

        public SortedSet<ASPLiteral> getLiterals()
        Description copied from class: ASPBodyElement
        Returns all literals in this element in form of a SortedSet. Literals are atoms or strict negations of atoms.
        Specified by:
        getLiterals in class ASPBodyElement
        Returns:
        all the literals used in the rule element
      • getPredicates

        public Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
        Specified by:
        getPredicates in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getPredicates in class ASPElement
      • getAtoms

        public Set<ASPAtom> getAtoms()
        Specified by:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getAtoms in class ASPElement
      • getSignature

        public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
        Specified by:
        getSignature in interface net.sf.tweety.commons.Formula
        Specified by:
        getSignature in class ASPElement
      • clone

        public ASPAtom clone()
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        clone in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        clone in class ASPElement
      • 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)
      • getPredicate

        public net.sf.tweety.logics.commons.syntax.Predicate getPredicate()
      • setPredicate

        public net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATE setPredicate​(net.sf.tweety.logics.commons.syntax.Predicate newer)
      • addArgument

        public void addArgument​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> arg)
                         throws net.sf.tweety.logics.commons.error.LanguageException
        Throws:
        net.sf.tweety.logics.commons.error.LanguageException
      • getArguments

        public List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getArguments()
      • isComplete

        public boolean isComplete()
      • compareTo

        public int compareTo​(ASPLiteral o)
      • cloneWithAddedTerm

        public ASPAtom cloneWithAddedTerm​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> term)
        Description copied from class: ASPLiteral
        Creates a copy of the literal and adds the given term as argument to the end of the argument list.
        Specified by:
        cloneWithAddedTerm in class ASPLiteral
        Parameters:
        term - the new argument.
        Returns:
        A copy of the literal containing the given term as new argument.
      • getAtom

        public ASPAtom getAtom()
        Specified by:
        getAtom in class ASPLiteral
        Returns:
        The atom representing the literal.
      • complement

        public ASPLiteral complement()
        Specified by:
        complement in interface net.sf.tweety.logics.commons.syntax.interfaces.Invertable
        Specified by:
        complement in class ASPLiteral
      • getTerm

        public net.sf.tweety.logics.commons.syntax.interfaces.Term<?> getTerm​(int i)
      • equals

        public boolean equals​(Object o)
        Specified by:
        equals in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Overrides:
        hashCode in class Object