Interface Atom

All Superinterfaces:
Comparable<Atom>, Iterable<Term>
All Known Implementing Classes:
AbstractAtom, DefaultAtom

public interface Atom extends Comparable<Atom>, Iterable<Term>
This interface represents a logical atom. An atom is of the form p(e1…ek) where p is a predicate, k >= 1 the arity of p, and each ei is a term.
Author:
Clément Sipieter (INRIA/CNRS) <clement@6pi.fr>
  • Method Details

    • setPredicate

      void setPredicate(Predicate predicate)
      Set the Predicate of this Atom.
      Parameters:
      predicate - the predicate to assign
    • getPredicate

      Predicate getPredicate()
      Get the Predicate of this Atom.
      Returns:
      the predicate of this atom.
    • setTerm

      void setTerm(int index, Term term)
      Set the nth term of this Atom. The first index is 0.
      Parameters:
      index - the position to update
      term - the term to store at the given position
    • getTerm

      Term getTerm(int index)
      Get the nth term of this Atom. The first index is 0.
      Parameters:
      index - the position to read
      Returns:
      the nth term of this Atom.
    • indexOf

      int indexOf(Term t)
      Returns the index of the first occurrence of the specified term in the term list of this atom, or -1 if this atom does not contain the term.
      Parameters:
      t - term to search for
      Returns:
      the index of the first occurrence of the specified term.
    • indexesOf

      int[] indexesOf(Term term)
      Returns the indexes of a given term in the atom.
      Parameters:
      term - the term to search for
      Returns:
      the indexes at which the term occurs
    • contains

      boolean contains(Term t)
      Returns true if the term list contains the specified term.
      Parameters:
      t - the term to search for
      Returns:
      true if the term list contains the specified term, false otherwise.
    • getTerms

      List<Term> getTerms()
      Get an ordered List that represents the terms of this Atom.
      Returns:
      an ordered List that represents the terms of this Atom.
    • getTerms

      Deprecated.
      This method is deprecated since 1.3, use getConstants() and getVariables() instead.

      Get all Term of the specified type.
      Parameters:
      type - the term type to filter on
      Returns:
      all Term of the specified type.
    • getVariables

      Set<Variable> getVariables()
      Get all variables that appear is this atom.
      Returns:
      all variables that appear is this atom.
    • getConstants

      Set<Constant> getConstants()
      Get all constants that appear is this atom.
      Returns:
      all constants that appear is this atom.
    • getLiterals

      Set<Literal> getLiterals()
      Get all literals that appear is this atom.
      Returns:
      all literals that appear is this atom.
    • iterator

      Iterator<Term> iterator()
      Return an Iterator of Term.
      Specified by:
      iterator in interface Iterable<Term>
      Returns:
      an iterator over the atom terms
    • appendTo

      void appendTo(StringBuilder sb)
      Appends this object representation to the provided builder.
      Parameters:
      sb - the target builder