Class Conditional

java.lang.Object
org.tweetyproject.logics.cl.syntax.Conditional
All Implemented Interfaces:
Formula, Rule<PlFormula,PlFormula>, SimpleLogicalFormula
Direct Known Subclasses:
ProbabilisticConditional

public class Conditional extends Object implements SimpleLogicalFormula, Rule<PlFormula,PlFormula>
This class represents a basic conditional (B|A) with formulas A,B.
Author:
Matthias Thimm, Tim Janus
  • Constructor Details

    • Conditional

      public Conditional(PlFormula conclusion)
      Creates a new conditional with a tautological premise and given conclusion.
      Parameters:
      conclusion - the conclusion (a formula) of this conditional.
    • Conditional

      public Conditional(PlFormula premise, PlFormula conclusion)
      Creates a new conditional with the given premise and conclusion.
      Parameters:
      premise - the premise (a formula) of this conditional.
      conclusion - the conclusion (a formula) of this conditional.
  • Method Details

    • getPremise

      public Collection<PlFormula> getPremise()
      Description copied from interface: Rule
      Returns the premise of this rule.
      Specified by:
      getPremise in interface Rule<PlFormula,PlFormula>
      Returns:
      the premise of this rule.
    • getConclusion

      public PlFormula getConclusion()
      Description copied from interface: Rule
      Returns the conclusion of this rule.
      Specified by:
      getConclusion in interface Rule<PlFormula,PlFormula>
      Returns:
      the conclusion of this rule.
    • isFact

      public boolean isFact()
      Checks whether this conditional is a fact, i.e. has a tautological premise.
      Specified by:
      isFact in interface Rule<PlFormula,PlFormula>
      Returns:
      "true" iff this conditional is a fact.
    • getSignature

      public Signature getSignature()
      Description copied from interface: Formula
      Returns the signature of the language of this formula.
      Specified by:
      getSignature in interface Formula
      Specified by:
      getSignature in interface Rule<PlFormula,PlFormula>
      Returns:
      the signature of the language of this formula.
    • toString

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

      public Conjunction combineWithAnd(Conjunctable f)
      Combines this conditional with another formula using logical conjunction (AND).

      This operation is unsupported for conditionals, and calling this method will result in an exception.

      Parameters:
      f - the formula to combine with.
      Returns:
      this method will not return anything as it throws an exception.
      Throws:
      UnsupportedOperationException - because conditionals cannot be combined using AND.
    • combineWithOr

      public Disjunction combineWithOr(Disjunctable f)
      Combines this conditional with another formula using logical disjunction (OR).

      This operation is unsupported for conditionals, and calling this method will result in an exception.

      Parameters:
      f - the formula to combine with.
      Returns:
      this method will not return anything as it throws an exception.
      Throws:
      UnsupportedOperationException - because conditionals cannot be combined using OR.
    • complement

      public Conditional complement()
      Returns the complement of this conditional.

      The complement is a new conditional with the same premise but with the complement of the conclusion.

      Returns:
      a new conditional that represents the complement of this conditional.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface SimpleLogicalFormula
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface SimpleLogicalFormula
      Overrides:
      equals in class Object
    • getAtoms

      public Set<Proposition> getAtoms()
      Description copied from interface: SimpleLogicalFormula
      Processes the set of all atoms which appear in this formula
      Specified by:
      getAtoms in interface SimpleLogicalFormula
      Returns:
      The set of all atoms
    • getPredicates

      public Set<? extends Predicate> getPredicates()
      Description copied from interface: SimpleLogicalFormula
      Processes the set of all predicates which appear in this formula
      Specified by:
      getPredicates in interface SimpleLogicalFormula
      Returns:
      all predicates that appear in this formula
    • clone

      public Conditional clone()
      Description copied from interface: SimpleLogicalFormula
      Creates a deep copy of this formula
      Specified by:
      clone in interface SimpleLogicalFormula
      Returns:
      the cloned formula
    • isLiteral

      public boolean isLiteral()
      Specified by:
      isLiteral in interface SimpleLogicalFormula
      Returns:
      true if the formula represents a literal in the language or false otherwise
    • getPredicateCls

      public Class<? extends Predicate> getPredicateCls()
      Specified by:
      getPredicateCls in interface SimpleLogicalFormula
      Returns:
      The class description of the predicate used by this formula.
    • isConstraint

      public boolean isConstraint()
      Description copied from interface: Rule
      isConstraint
      Specified by:
      isConstraint in interface Rule<PlFormula,PlFormula>
      Returns:
      whether the rule is a constraint
    • setConclusion

      public void setConclusion(PlFormula conclusion)
      Description copied from interface: Rule
      Set the conclusion of this rule.
      Specified by:
      setConclusion in interface Rule<PlFormula,PlFormula>
      Parameters:
      conclusion - some formula
    • addPremise

      public void addPremise(PlFormula premise)
      Description copied from interface: Rule
      Add the given premise to this rule.
      Specified by:
      addPremise in interface Rule<PlFormula,PlFormula>
      Parameters:
      premise - some formula
    • addPremises

      public void addPremises(Collection<? extends PlFormula> premises)
      Description copied from interface: Rule
      Add the given premises to this rule.
      Specified by:
      addPremises in interface Rule<PlFormula,PlFormula>
      Parameters:
      premises - some formulas