Class Conditional
java.lang.Object
org.tweetyproject.logics.cl.syntax.Conditional
- All Implemented Interfaces:
Formula
,Rule<PlFormula,
,PlFormula> SimpleLogicalFormula
- Direct Known Subclasses:
ProbabilisticConditional
This class represents a basic conditional (B|A) with formulas A,B.
- Author:
- Matthias Thimm, Tim Janus
-
Constructor Summary
ConstructorDescriptionConditional
(PlFormula conclusion) Creates a new conditional with a tautological premise and given conclusion.Conditional
(PlFormula premise, PlFormula conclusion) Creates a new conditional with the given premise and conclusion. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPremise
(PlFormula premise) Add the given premise to this rule.void
addPremises
(Collection<? extends PlFormula> premises) Add the given premises to this rule.clone()
Creates a deep copy of this formulaCombines this conditional with another formula using logical conjunction (AND).Combines this conditional with another formula using logical disjunction (OR).Returns the complement of this conditional.boolean
getAtoms()
Processes the set of all atoms which appear in this formulaReturns the conclusion of this rule.Processes the set of all predicates which appear in this formulaReturns the premise of this rule.Returns the signature of the language of this formula.int
hashCode()
boolean
isConstraintboolean
isFact()
Checks whether this conditional is a fact, i.e.boolean
void
setConclusion
(PlFormula conclusion) Set the conclusion of this rule.toString()
-
Constructor Details
-
Conditional
Creates a new conditional with a tautological premise and given conclusion.- Parameters:
conclusion
- the conclusion (a formula) of this conditional.
-
Conditional
-
-
Method Details
-
getPremise
Description copied from interface:Rule
Returns the premise of this rule.- Specified by:
getPremise
in interfaceRule<PlFormula,
PlFormula> - Returns:
- the premise of this rule.
-
getConclusion
-
isFact
-
getSignature
Description copied from interface:Formula
Returns the signature of the language of this formula.- Specified by:
getSignature
in interfaceFormula
- Specified by:
getSignature
in interfaceRule<PlFormula,
PlFormula> - Returns:
- the signature of the language of this formula.
-
toString
-
combineWithAnd
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
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
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 interfaceSimpleLogicalFormula
- Overrides:
hashCode
in classObject
-
equals
- Specified by:
equals
in interfaceSimpleLogicalFormula
- Overrides:
equals
in classObject
-
getAtoms
Description copied from interface:SimpleLogicalFormula
Processes the set of all atoms which appear in this formula- Specified by:
getAtoms
in interfaceSimpleLogicalFormula
- Returns:
- The set of all atoms
-
getPredicates
Description copied from interface:SimpleLogicalFormula
Processes the set of all predicates which appear in this formula- Specified by:
getPredicates
in interfaceSimpleLogicalFormula
- Returns:
- all predicates that appear in this formula
-
clone
Description copied from interface:SimpleLogicalFormula
Creates a deep copy of this formula- Specified by:
clone
in interfaceSimpleLogicalFormula
- Returns:
- the cloned formula
-
isLiteral
public boolean isLiteral()- Specified by:
isLiteral
in interfaceSimpleLogicalFormula
- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getPredicateCls
- Specified by:
getPredicateCls
in interfaceSimpleLogicalFormula
- 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 interfaceRule<PlFormula,
PlFormula> - Returns:
- whether the rule is a constraint
-
setConclusion
-
addPremise
-
addPremises
Description copied from interface:Rule
Add the given premises to this rule.- Specified by:
addPremises
in interfaceRule<PlFormula,
PlFormula> - Parameters:
premises
- some formulas
-