Class DefaultAtom

java.lang.Object
fr.lirmm.graphik.integraal.api.core.AbstractAtom
fr.lirmm.graphik.integraal.core.DefaultAtom
All Implemented Interfaces:
Atom, Serializable, Comparable<Atom>, Iterable<Term>

public class DefaultAtom extends AbstractAtom implements Serializable
Class that implements atoms.
See Also:
  • Constructor Details

    • DefaultAtom

      public DefaultAtom(Predicate predicate)
      Creates an atom with the specified predicate and its declared arity.
      Parameters:
      predicate - the atom predicate
    • DefaultAtom

      public DefaultAtom(Predicate predicate, List<Term> terms)
      Creates an atom with the specified predicate and term list.
      Parameters:
      predicate - the atom predicate
      terms - the atom terms
    • DefaultAtom

      public DefaultAtom(Predicate predicate, Term... terms)
      Creates an atom with the specified predicate and term array.
      Parameters:
      predicate - the atom predicate
      terms - the atom terms
    • DefaultAtom

      public DefaultAtom(Atom atom)
      Creates a copy of the specified atom.
      Parameters:
      atom - the atom to copy
  • Method Details

    • getTerms

      @Deprecated public Collection<Term> getTerms(Term.Type type)
      Deprecated.
      Description copied from interface: Atom
      This method is deprecated since 1.3, use Atom.getConstants() and Atom.getVariables() instead.

      Get all Term of the specified type.
      Specified by:
      getTerms in interface Atom
      Parameters:
      type - the term type to filter on
      Returns:
      all Term of the specified type.
    • getConstants

      public Set<Constant> getConstants()
      Description copied from interface: Atom
      Get all constants that appear is this atom.
      Specified by:
      getConstants in interface Atom
      Overrides:
      getConstants in class AbstractAtom
      Returns:
      all constants that appear is this atom.
    • getVariables

      public Set<Variable> getVariables()
      Description copied from interface: Atom
      Get all variables that appear is this atom.
      Specified by:
      getVariables in interface Atom
      Overrides:
      getVariables in class AbstractAtom
      Returns:
      all variables that appear is this atom.
    • getLiterals

      public Set<Literal> getLiterals()
      Description copied from interface: Atom
      Get all literals that appear is this atom.
      Specified by:
      getLiterals in interface Atom
      Overrides:
      getLiterals in class AbstractAtom
      Returns:
      all literals that appear is this atom.
    • contains

      public boolean contains(Term term)
      Description copied from interface: Atom
      Returns true if the term list contains the specified term.
      Specified by:
      contains in interface Atom
      Parameters:
      term - the term to search for
      Returns:
      true if the term list contains the specified term, false otherwise.
    • indexOf

      public int indexOf(Term t)
      Description copied from interface: Atom
      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.
      Specified by:
      indexOf in interface Atom
      Parameters:
      t - term to search for
      Returns:
      the index of the first occurrence of the specified term.
    • indexesOf

      public int[] indexesOf(Term term)
      Description copied from interface: Atom
      Returns the indexes of a given term in the atom.
      Specified by:
      indexesOf in interface Atom
      Parameters:
      term - the term to search for
      Returns:
      the indexes at which the term occurs
    • setPredicate

      public void setPredicate(Predicate predicate)
      Set the predicate.
      Specified by:
      setPredicate in interface Atom
      Parameters:
      predicate - the predicate to assign
    • getPredicate

      public Predicate getPredicate()
      Get the predicate.
      Specified by:
      getPredicate in interface Atom
      Returns:
      the predicate of this atom.
    • setTerm

      public void setTerm(int index, Term term)
      Set the Term with the specified index.
      Specified by:
      setTerm in interface Atom
      Parameters:
      index - the position to update
      term - the term to store at the given position
    • getTerm

      public Term getTerm(int index)
      Returns the Term with the specified index.
      Specified by:
      getTerm in interface Atom
      Parameters:
      index - the position to read
      Returns:
      the nth term of this Atom.
    • setTerms

      public void setTerms(List<Term> terms)
      Sets the list of terms.
      Parameters:
      terms - the terms to assign
    • getTerms

      public List<Term> getTerms()
      Returns the List of Term.
      Specified by:
      getTerms in interface Atom
      Returns:
      an ordered List that represents the terms of this Atom.
    • iterator

      public Iterator<Term> iterator()
      Description copied from interface: Atom
      Return an Iterator of Term.
      Specified by:
      iterator in interface Atom
      Specified by:
      iterator in interface Iterable<Term>
      Overrides:
      iterator in class AbstractAtom
      Returns:
      an iterator over the atom terms