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() |
getPredicateClscontainsTermsOfType, exchange, getTerms, isGround, isLiteral, isWellFormed, substitutefinalize, getClass, notify, notifyAll, wait, wait, waitexchange, isGround, isWellFormed, substitutegetPredicateCls, isLiteralcontainsTermsOfType, getTermsDLPHead 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 DLPElementpublic 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.Objectpublic boolean equals(java.lang.Object other)
equals in interface SimpleLogicalFormulaequals in class java.lang.Objectpublic int hashCode()
hashCode in interface SimpleLogicalFormulahashCode in class java.lang.Objectpublic int compareTo(Rule arg0)
compareTo in interface java.lang.Comparable<Rule>public Rule clone()
SimpleLogicalFormulaclone in interface ComplexLogicalFormulaclone in interface SimpleLogicalFormulaclone in interface DLPElementclone in class DLPElementAdapterpublic FolSignature getSignature()
FormulagetSignature in interface FormulagetSignature in interface Rule<DLPHead,DLPElement>getSignature in interface DLPElementpublic java.util.Collection<DLPElement> getPremise()
RulegetPremise in interface Rule<DLPHead,DLPElement>public DLPHead getConclusion()
RulegetConclusion in interface Rule<DLPHead,DLPElement>public Rule substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
ComplexLogicalFormulasubstitute in interface ComplexLogicalFormulasubstitute in interface DLPElementv - 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()
SimpleLogicalFormulagetAtoms in interface SimpleLogicalFormulagetAtoms in interface DLPElementpublic java.util.Set<DLPPredicate> getPredicates()
SimpleLogicalFormulagetPredicates in interface SimpleLogicalFormulagetPredicates in interface DLPElementpublic java.util.Set<Term<?>> getTerms()
getTerms in interface LogicStructurepublic 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>