Class SimplePlRule

java.lang.Object
org.tweetyproject.arg.deductive.syntax.SimplePlRule
All Implemented Interfaces:
Formula, Rule<PlFormula,PlFormula>

public class SimplePlRule extends Object implements Rule<PlFormula,PlFormula>
Represents a simple propositional logic rule. The rule consists of a set of premises (support) and a conclusion (claim). The premises and conclusion are propositional logic formulas (PlFormula). This class implements the Rule interface and provides basic functionality for manipulating and querying the premises and conclusion of the rule.
Author:
Federico Cerutti (federico.cerutti@acm.org)
  • Constructor Details

    • SimplePlRule

      public SimplePlRule()
      Default constructor. Initializes the rule with no conclusion and an empty set of premises.
    • SimplePlRule

      public SimplePlRule(PlFormula _claim)
      Constructs a rule with the specified conclusion and an empty set of premises.
      Parameters:
      _claim - The propositional logic formula representing the conclusion of the rule.
    • SimplePlRule

      public SimplePlRule(PlFormula _claim, Set<PlFormula> _support)
      Constructs a rule with the specified conclusion and set of premises.
      Parameters:
      _claim - The propositional logic formula representing the conclusion of the rule.
      _support - The set of propositional logic formulas representing the premises of the rule.
  • Method Details

    • addPremise

      public void addPremise(PlFormula arg0)
      Adds a premise to the rule.
      Specified by:
      addPremise in interface Rule<PlFormula,PlFormula>
      Parameters:
      arg0 - The propositional logic formula to be added as a premise.
    • addPremises

      public void addPremises(Collection<? extends PlFormula> arg0)
      Adds a collection of premises to the rule.
      Specified by:
      addPremises in interface Rule<PlFormula,PlFormula>
      Parameters:
      arg0 - The collection of propositional logic formulas to be added as premises.
    • getConclusion

      public PlFormula getConclusion()
      Retrieves the conclusion (claim) of the rule.
      Specified by:
      getConclusion in interface Rule<PlFormula,PlFormula>
      Returns:
      The propositional logic formula representing the conclusion of the rule.
    • getPremise

      public Collection<? extends PlFormula> getPremise()
      Retrieves the premises (support) of the rule.
      Specified by:
      getPremise in interface Rule<PlFormula,PlFormula>
      Returns:
      The set of propositional logic formulas representing the premises of the rule.
    • getSignature

      public Signature getSignature()
      Retrieves the signature of the rule, which includes the signature of both the premises and the conclusion.
      Specified by:
      getSignature in interface Formula
      Specified by:
      getSignature in interface Rule<PlFormula,PlFormula>
      Returns:
      The propositional logic signature of the rule.
    • isConstraint

      public boolean isConstraint()
      Determines if this rule is a constraint. In this case, the rule is not considered a constraint.
      Specified by:
      isConstraint in interface Rule<PlFormula,PlFormula>
      Returns:
      False, as this rule is not a constraint.
    • isFact

      public boolean isFact()
      Determines if this rule is a fact. A rule is considered a fact if it has no premises.
      Specified by:
      isFact in interface Rule<PlFormula,PlFormula>
      Returns:
      True if the rule has no premises, false otherwise.
    • setConclusion

      public void setConclusion(PlFormula arg0)
      Sets the conclusion (claim) of the rule.
      Specified by:
      setConclusion in interface Rule<PlFormula,PlFormula>
      Parameters:
      arg0 - The propositional logic formula to be set as the conclusion of the rule.
    • equals

      public boolean equals(Object obj)
      Checks if this rule is equal to another object. Two rules are considered equal if they have the same conclusion and premises.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare with this rule.
      Returns:
      True if the rules are equal, false otherwise.
    • hashCode

      public int hashCode()
      Computes the hash code for this rule based on the premises.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code of the rule.
    • toString

      public String toString()
      Returns a string representation of this rule. If the rule is a fact (i.e., has no premises), only the conclusion is returned. Otherwise, the premises and conclusion are returned in the format "premises -> conclusion".
      Overrides:
      toString in class Object
      Returns:
      The string representation of this rule.