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

public class TermSchema extends Object
A list of terms of fixed arity representing the attribute schema for a relation of the same arity (i.e., the 2nd term in the list is the attribute for the 2nd "column" in the relation).
  • Field Details

    • attributes

      public final List<Term> attributes
      The attributes of this schema.
  • Constructor Details

    • TermSchema

      public TermSchema(List<Term> terms)
      Constructs a schema from a list of terms.
      Parameters:
      terms - the terms
    • TermSchema

      public TermSchema(TermSchema other)
      Constructs a schema from another schema.
      Parameters:
      other - the other schema
    • TermSchema

      public TermSchema(int arity)
      Constructs a schema of the supplied arity. The attributes are given unique but arbitrary names.
      Parameters:
      arity - the arity
  • Method Details

    • get

      public Term get(int i)
      Returns the term at the given index into the schema.
      Parameters:
      i - the index
      Returns:
      the term
    • get

      public int get(Term t)
      Returns the index of the given term in the schema. If the term appears multiple times in the schema, returns the first position.
      Parameters:
      t - the term
      Returns:
      the index
    • size

      public int size()
      Returns the size of this schema.
      Returns:
      the size
    • 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