java.lang.Object
edu.upc.fib.inlab.imp.kse.logics.logicschema.domain.Literal
Direct Known Subclasses:
BuiltInLiteral, OrdinaryLiteral

public abstract class Literal extends Object
Implementation of the logic literal. Literals might be Ordinary (e.g. "Emp(x)"), or built-in (e.g. "x < 4") A literal should appear, at most, inside the body of one NormalClause. That is, literals should not be reused among several NormalClauses.
  • Constructor Details

    • Literal

      public Literal()
  • Method Details

    • getTerms

      public abstract ImmutableTermList getTerms()
    • getArity

      public int getArity()
    • applySubstitution

      public abstract Literal applySubstitution(Substitution substitution)
      Parameters:
      substitution - not null
      Returns:
      a literal after applying the given substitution. The literal will be new if some term has changed, otherwise it will be the same
    • getUsedVariables

      public Set<Variable> getUsedVariables()
    • accept

      public abstract <T> T accept(LogicSchemaVisitor<T> visitor)
    • buildNegatedLiteral

      public Literal buildNegatedLiteral()
      This method builds 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"

      Not all built-in literals can be negated. Thus, this function might throw an Exception.

      Returns:
      a new literal that is the negation of this literal, if this is possible
      Throws:
      NoNegatableLiteral - in case the literal cannot be negated
    • canBeNegated

      public boolean canBeNegated()
      Returns:
      whether this literal can be negated.
      See Also:
    • isGround

      public boolean isGround()
      Returns:
      true if all its terms of literal are constants, false otherwise