public class Rule extends DLPElementAdapter implements java.lang.Comparable<Rule>, DLPElement, Rule<DLPHead,DLPElement>
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List<DLPElement> |
body |
(package private) DLPHead |
head |
Constructor and Description |
---|
Rule()
Default-Ctor: Creates an empty rule without any head literals or body elements
|
Rule(DLPHead head)
Ctor: Create a rule with the given head, cause there are no
body elements the created rule is a fact.
|
Rule(DLPLiteral head)
Ctor: Create a rule with the given head, cause there are no
body elements the created rule is a fact.
|
Rule(DLPLiteral head,
DLPElement body) |
Rule(DLPLiteral head,
java.util.List<DLPElement> litsBody) |
Rule(java.util.List<DLPLiteral> litsHead,
java.util.List<DLPElement> litsBody) |
Rule(Rule other)
Copy-Ctor: Makes a deep copy of the given rule
|
Rule(java.lang.String ruleexpr) |
Modifier and Type | Method and Description |
---|---|
void |
addPremise(DLPElement premise) |
void |
addPremises(java.util.Collection<? extends DLPElement> premises) |
Rule |
clone()
Creates a deep copy of this formula
|
int |
compareTo(Rule arg0) |
boolean |
equals(java.lang.Object other) |
java.util.Set<DLPAtom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
DLPHead |
getConclusion()
Returns the conclusion of this rule.
|
java.util.SortedSet<DLPLiteral> |
getLiterals() |
java.util.Set<DLPPredicate> |
getPredicates()
Processes the set of all predicates which appear in this
formula
|
java.util.Collection<DLPElement> |
getPremise()
Returns the premise of this rule.
|
FolSignature |
getSignature()
Returns the signature of the language of this formula.
|
java.util.Set<Term<?>> |
getTerms() |
int |
hashCode() |
boolean |
isConstraint() |
boolean |
isFact() |
boolean |
isSafe()
Proofs if the given rule is safe for use in a solver.
|
void |
setConclusion(DLPHead conclusion) |
void |
setConclusion(DLPLiteral literal) |
Rule |
substitute(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and returns the new formula.
|
java.lang.String |
toString() |
getPredicateCls
containsTermsOfType, exchange, getTerms, isGround, isLiteral, isWellFormed, substitute
finalize, getClass, notify, notifyAll, wait, wait, wait
exchange, isGround, isWellFormed, substitute
getPredicateCls, isLiteral
containsTermsOfType, getTerms
DLPHead head
java.util.List<DLPElement> body
public Rule()
public Rule(Rule other)
public Rule(DLPHead head)
head
- The head of the rule as ELPHeadpublic Rule(DLPLiteral head)
head
- The head of the rule as ELPLiteralpublic Rule(DLPLiteral head, DLPElement body)
public Rule(DLPLiteral head, java.util.List<DLPElement> litsBody)
public Rule(java.util.List<DLPLiteral> litsHead, java.util.List<DLPElement> litsBody)
public Rule(java.lang.String ruleexpr)
public java.util.SortedSet<DLPLiteral> getLiterals()
getLiterals
in interface DLPElement
public boolean isFact()
isFact
in interface Rule<DLPHead,DLPElement>
public boolean isConstraint()
isConstraint
in interface Rule<DLPHead,DLPElement>
public boolean isSafe()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in interface SimpleLogicalFormula
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface SimpleLogicalFormula
hashCode
in class java.lang.Object
public int compareTo(Rule arg0)
compareTo
in interface java.lang.Comparable<Rule>
public Rule clone()
SimpleLogicalFormula
clone
in interface ComplexLogicalFormula
clone
in interface SimpleLogicalFormula
clone
in interface DLPElement
clone
in class DLPElementAdapter
public FolSignature getSignature()
Formula
getSignature
in interface Formula
getSignature
in interface Rule<DLPHead,DLPElement>
getSignature
in interface DLPElement
public java.util.Collection<DLPElement> getPremise()
Rule
getPremise
in interface Rule<DLPHead,DLPElement>
public DLPHead getConclusion()
Rule
getConclusion
in interface Rule<DLPHead,DLPElement>
public Rule substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
ComplexLogicalFormula
substitute
in interface ComplexLogicalFormula
substitute
in interface DLPElement
v
- the term to be substituted.t
- the term to substitute.java.lang.IllegalArgumentException
- if "v" and "t" are of different sortspublic java.util.Set<DLPAtom> getAtoms()
SimpleLogicalFormula
getAtoms
in interface SimpleLogicalFormula
getAtoms
in interface DLPElement
public java.util.Set<DLPPredicate> getPredicates()
SimpleLogicalFormula
getPredicates
in interface SimpleLogicalFormula
getPredicates
in interface DLPElement
public java.util.Set<Term<?>> getTerms()
getTerms
in interface LogicStructure
public void setConclusion(DLPHead conclusion)
setConclusion
in interface Rule<DLPHead,DLPElement>
public void setConclusion(DLPLiteral literal)
public void addPremise(DLPElement premise)
addPremise
in interface Rule<DLPHead,DLPElement>
public void addPremises(java.util.Collection<? extends DLPElement> premises)
addPremises
in interface Rule<DLPHead,DLPElement>