Class SimplePlRule
java.lang.Object
org.tweetyproject.arg.deductive.syntax.SimplePlRule
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 Summary
ConstructorDescriptionDefault constructor.SimplePlRule
(PlFormula _claim) Constructs a rule with the specified conclusion and an empty set of premises.SimplePlRule
(PlFormula _claim, Set<PlFormula> _support) Constructs a rule with the specified conclusion and set of premises. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPremise
(PlFormula arg0) Adds a premise to the rule.void
addPremises
(Collection<? extends PlFormula> arg0) Adds a collection of premises to the rule.boolean
Checks if this rule is equal to another object.Retrieves the conclusion (claim) of the rule.Collection
<? extends PlFormula> Retrieves the premises (support) of the rule.Retrieves the signature of the rule, which includes the signature of both the premises and the conclusion.int
hashCode()
Computes the hash code for this rule based on the premises.boolean
Determines if this rule is a constraint.boolean
isFact()
Determines if this rule is a fact.void
setConclusion
(PlFormula arg0) Sets the conclusion (claim) of the rule.toString()
Returns a string representation of this rule.
-
Constructor Details
-
SimplePlRule
public SimplePlRule()Default constructor. Initializes the rule with no conclusion and an empty set of premises. -
SimplePlRule
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
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
Adds a premise to the rule.- Specified by:
addPremise
in interfaceRule<PlFormula,
PlFormula> - Parameters:
arg0
- The propositional logic formula to be added as a premise.
-
addPremises
Adds a collection of premises to the rule.- Specified by:
addPremises
in interfaceRule<PlFormula,
PlFormula> - Parameters:
arg0
- The collection of propositional logic formulas to be added as premises.
-
getConclusion
Retrieves the conclusion (claim) of the rule.- Specified by:
getConclusion
in interfaceRule<PlFormula,
PlFormula> - Returns:
- The propositional logic formula representing the conclusion of the rule.
-
getPremise
Retrieves the premises (support) of the rule.- Specified by:
getPremise
in interfaceRule<PlFormula,
PlFormula> - Returns:
- The set of propositional logic formulas representing the premises of the rule.
-
getSignature
Retrieves the signature of the rule, which includes the signature of both the premises and the conclusion.- Specified by:
getSignature
in interfaceFormula
- Specified by:
getSignature
in interfaceRule<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 interfaceRule<PlFormula,
PlFormula> - Returns:
- False, as this rule is not a constraint.
-
isFact
-
setConclusion
Sets the conclusion (claim) of the rule.- Specified by:
setConclusion
in interfaceRule<PlFormula,
PlFormula> - Parameters:
arg0
- The propositional logic formula to be set as the conclusion of the rule.
-
equals
Checks if this rule is equal to another object. Two rules are considered equal if they have the same conclusion and premises. -
hashCode
-
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".
-