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 java.lang.Object implements SimpleLogicalFormula, Rule<PlFormula,PlFormula>
This class represents a basic conditional (B|A) with formulas A,B.- Author:
- Matthias Thimm, Tim Janus
-
-
Constructor Summary
Constructors Constructor Description Conditional(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 Type Method Description voidaddPremise(PlFormula premise)Add the given premise to this rule.voidaddPremises(java.util.Collection<? extends PlFormula> premises)Add the given premises to this rule.Conditionalclone()Creates a deep copy of this formulaConjunctioncombineWithAnd(Conjunctable f)DisjunctioncombineWithOr(Disjunctable f)Conditionalcomplement()booleanequals(java.lang.Object obj)java.util.Set<Proposition>getAtoms()Processes the set of all atoms which appear in this formulaPlFormulagetConclusion()Returns the conclusion of this rule.java.lang.Class<? extends Predicate>getPredicateCls()java.util.Set<? extends Predicate>getPredicates()Processes the set of all predicates which appear in this formulajava.util.Collection<PlFormula>getPremise()Returns the premise of this rule.SignaturegetSignature()Returns the signature of the language of this formula.inthashCode()booleanisConstraint()booleanisFact()Checks whether this conditional is a fact, i.e.booleanisLiteral()voidsetConclusion(PlFormula conclusion)Set the conclusion of this rule.java.lang.StringtoString()
-
-
-
Constructor Detail
-
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.
-
-
Method Detail
-
getPremise
public java.util.Collection<PlFormula> getPremise()
Description copied from interface:RuleReturns the premise of this rule.- Specified by:
getPremisein interfaceRule<PlFormula,PlFormula>- Returns:
- the premise of this rule.
-
getConclusion
public PlFormula getConclusion()
Description copied from interface:RuleReturns the conclusion of this rule.- Specified by:
getConclusionin interfaceRule<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.
-
getSignature
public Signature getSignature()
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Specified by:
getSignaturein interfaceRule<PlFormula,PlFormula>- Returns:
- the signature of the language of this formula.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
combineWithAnd
public Conjunction combineWithAnd(Conjunctable f)
-
combineWithOr
public Disjunction combineWithOr(Disjunctable f)
-
complement
public Conditional complement()
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classjava.lang.Object
-
getAtoms
public java.util.Set<Proposition> getAtoms()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Returns:
- The set of all atoms
-
getPredicates
public java.util.Set<? extends Predicate> getPredicates()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Returns:
- all predicates that appear in this formula
-
clone
public Conditional clone()
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceSimpleLogicalFormula- Returns:
- the cloned formula
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteralin interfaceSimpleLogicalFormula- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getPredicateCls
public java.lang.Class<? extends Predicate> getPredicateCls()
- Specified by:
getPredicateClsin interfaceSimpleLogicalFormula- Returns:
- The class description of the predicate used by this formula.
-
isConstraint
public boolean isConstraint()
- Specified by:
isConstraintin interfaceRule<PlFormula,PlFormula>
-
setConclusion
public void setConclusion(PlFormula conclusion)
Description copied from interface:RuleSet the conclusion of this rule.- Specified by:
setConclusionin interfaceRule<PlFormula,PlFormula>- Parameters:
conclusion- some formula
-
addPremise
public void addPremise(PlFormula premise)
Description copied from interface:RuleAdd the given premise to this rule.- Specified by:
addPremisein interfaceRule<PlFormula,PlFormula>- Parameters:
premise- some formula
-
-