Class Complement

java.lang.Object
org.tweetyproject.logics.dl.syntax.ComplexConcept
org.tweetyproject.logics.dl.syntax.Complement
All Implemented Interfaces:
Formula, ClassicalFormula, Conjunctable, Disjunctable, Invertable, ProbabilityAware, SimpleLogicalFormula

public class Complement extends ComplexConcept
This class models the complement (negation) in description logics.
Author:
Anna Gessler
See Also:
  • Constructor Details

    • Complement

      public Complement(ComplexConcept formula)
      Creates a new complement with the given concept to be negated.
      Parameters:
      formula - the concept to be negated
  • Method Details

    • getPredicates

      public Set<Predicate> getPredicates()
      Returns the set of predicates used in this complement, which are the predicates used in the negated concept.
      Specified by:
      getPredicates in interface SimpleLogicalFormula
      Specified by:
      getPredicates in class ComplexConcept
      Returns:
      a set of predicates used in the negated concept
    • clone

      public ComplexConcept clone()
      Clones this complement.
      Specified by:
      clone in interface SimpleLogicalFormula
      Specified by:
      clone in class ComplexConcept
      Returns:
      a clone of this complement
    • collapseAssociativeFormulas

      public ComplexConcept collapseAssociativeFormulas()
      Collapses associative formulas within the negated concept, if applicable.
      Specified by:
      collapseAssociativeFormulas in class ComplexConcept
      Returns:
      a new complement with the collapsed negated concept
    • toString

      public String toString()
      Returns a string representation of this complement.
      Overrides:
      toString in class Object
      Returns:
      a string representing this complement, in the form "(not concept)"
    • hashCode

      public int hashCode()
      Computes the hash code for this complement based on its negated concept.
      Specified by:
      hashCode in interface SimpleLogicalFormula
      Specified by:
      hashCode in class ComplexConcept
      Returns:
      the hash code of this complement
    • isLiteral

      public boolean isLiteral()
      Determines whether this complement is a literal. A complement is a literal if the negated concept is a literal.
      Returns:
      true if the negated concept is a literal, false otherwise
    • getFormula

      public ComplexConcept getFormula()
      Returns the concept that is being negated by this complement.
      Returns:
      the concept being negated by this complement
    • getSignature

      public DlSignature getSignature()
      Returns the description logic signature for this complement, which is the signature of the negated concept.
      Specified by:
      getSignature in interface Formula
      Specified by:
      getSignature in class ComplexConcept
      Returns:
      the signature of the negated concept
    • equals

      public boolean equals(Object obj)
      Compares this complement to another object for equality. Two complements are considered equal if their negated concepts are equal.
      Specified by:
      equals in interface SimpleLogicalFormula
      Specified by:
      equals in class ComplexConcept
      Parameters:
      obj - the object to compare this complement with
      Returns:
      true if the two complements are equal, false otherwise