java.lang.Object
edu.harvard.seas.pl.abcdatalog.engine.topdown.Tuple

public class Tuple extends Object
A tuple of terms, i.e., an ordered list of fixed arity.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final Term[]
    The terms in this tuple.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tuple(Term[] elts)
     
    Tuple(List<Term> elts)
    Constructs a tuple from a list of terms.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    get(int i)
    Returns the term at the ith position in this tuple (0-indexed).
    int
     
    int
    Returns the arity of this tuple.
     
    unify(Tuple other)
    Attempts to unify this tuple with another tuple.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • elts

      public final Term[] elts
      The terms in this tuple.
  • Constructor Details

    • Tuple

      public Tuple(List<Term> elts)
      Constructs a tuple from a list of terms.
      Parameters:
      elts - the list of terms
    • Tuple

      public Tuple(Term[] elts)
  • Method Details

    • get

      public Term get(int i)
      Returns the term at the ith position in this tuple (0-indexed).
      Parameters:
      i - the position
      Returns:
      the term
    • size

      public int size()
      Returns the arity of this tuple.
      Returns:
      the arity
    • unify

      public Tuple unify(Tuple other)
      Attempts to unify this tuple with another tuple.
      Parameters:
      other - the other tuple
      Returns:
      the substitution resulting from the unification, or null if the unification fails
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object