Class ComparisonBuiltInLiteral

Direct Known Subclasses:
EqualityComparisonBuiltInLiteral

public class ComparisonBuiltInLiteral extends BuiltInLiteral
Implementation of the logic comparison built-in literal.

E.g. "x < 4"

  • Constructor Details

    • ComparisonBuiltInLiteral

      public ComparisonBuiltInLiteral(Term leftTerm, Term rightTerm, ComparisonOperator operator)
      Constructs a new ComparisonBuiltInLiteral.
      Parameters:
      leftTerm - left term.
      rightTerm - right term.
      operator - comparison operator.
      Throws:
      IllegalArgumentException - if left term, right term or comparison operator are null.
  • Method Details

    • toString

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

      public ImmutableTermList getTerms()
      Specified by:
      getTerms in class Literal
    • applySubstitution

      public ComparisonBuiltInLiteral applySubstitution(Substitution substitution)
      Constructs new ComparisonBuiltInLiteral after applying the substitution to the literal terms.
      Specified by:
      applySubstitution in class Literal
      Parameters:
      substitution - substitution to apply.
      Returns:
      a comparison built-in literal after applying the given substitution. The literal will be new if some term has changed, otherwise it will be the same.
    • accept

      public <T> T accept(LogicSchemaVisitor<T> visitor)
      Specified by:
      accept in class Literal
    • buildNegatedLiteral

      public ComparisonBuiltInLiteral buildNegatedLiteral()
      Description copied from class: Literal
      This method constructs a new literal that is the negation of this one.

      E.g. given an ordinary literal "P(x)" it will return a new literal "not(P(x))", or given a built-in literal "x < y" it will return "x >= y"

      Overrides:
      buildNegatedLiteral in class Literal
      Returns:
      a new literal that is the negation of this literal, if this is possible.
    • getLeftTerm

      public Term getLeftTerm()
    • getRightTerm

      public Term getRightTerm()
    • getOperator

      public ComparisonOperator getOperator()
    • getOperationName

      public String getOperationName()
      Description copied from class: BuiltInLiteral
      Returns the built-in literal operation name.
      Specified by:
      getOperationName in class BuiltInLiteral
      Returns:
      the operation name.