public class NLPRule extends ComplexLogicalFormulaAdapter implements ComplexLogicalFormula, Rule<FolFormula,FolFormula>
Modifier and Type | Field and Description |
---|---|
(package private) FolFormula |
conclusion |
(package private) java.util.Set<FolFormula> |
premise |
Constructor and Description |
---|
NLPRule() |
NLPRule(FolFormula conclusion) |
NLPRule(FolFormula conclusion,
java.util.Collection<FolFormula> premise) |
NLPRule(FolFormula conclusion,
FolFormula premise) |
NLPRule(NLPRule other) |
Modifier and Type | Method and Description |
---|---|
void |
addPremise(FolFormula premise) |
void |
addPremises(java.util.Collection<? extends FolFormula> premises) |
private void |
checkFormula(FolFormula formula)
Helper methods checks if the given FOL formula is supported by the nested logic
program language, that means it checks if it contains quantifiers and if that
is the case it throws a LanguageException
|
NLPRule |
clone()
Creates a deep copy of this formula
|
boolean |
equals(java.lang.Object other) |
java.util.Set<FOLAtom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
FolFormula |
getConclusion()
Returns the conclusion of this rule.
|
java.lang.Class<? extends Predicate> |
getPredicateCls() |
java.util.Set<Predicate> |
getPredicates()
Processes the set of all predicates which appear in this
formula
|
java.util.Collection<FolFormula> |
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() |
void |
setConclusion(FolFormula conclusion) |
NLPRule |
substitute(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and returns the new formula.
|
containsTermsOfType, exchange, getTerms, isGround, isLiteral, isWellFormed, substitute
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
exchange, isGround, isWellFormed, substitute
isLiteral
containsTermsOfType, getTerms
FolFormula conclusion
java.util.Set<FolFormula> premise
public NLPRule()
public NLPRule(NLPRule other)
public NLPRule(FolFormula conclusion)
public NLPRule(FolFormula conclusion, FolFormula premise)
public NLPRule(FolFormula conclusion, java.util.Collection<FolFormula> premise)
public void addPremise(FolFormula premise) throws LanguageException
addPremise
in interface Rule<FolFormula,FolFormula>
LanguageException
public void addPremises(java.util.Collection<? extends FolFormula> premises)
addPremises
in interface Rule<FolFormula,FolFormula>
public void setConclusion(FolFormula conclusion) throws LanguageException
setConclusion
in interface Rule<FolFormula,FolFormula>
LanguageException
private void checkFormula(FolFormula formula) throws LanguageException
formula
- The formula which gets checkedLanguageException
public java.util.Collection<FolFormula> getPremise()
Rule
getPremise
in interface Rule<FolFormula,FolFormula>
public FolFormula getConclusion()
Rule
getConclusion
in interface Rule<FolFormula,FolFormula>
public FolSignature getSignature()
Formula
getSignature
in interface Formula
getSignature
in interface Rule<FolFormula,FolFormula>
public boolean isFact()
isFact
in interface Rule<FolFormula,FolFormula>
public boolean isConstraint()
isConstraint
in interface Rule<FolFormula,FolFormula>
public java.util.Set<FOLAtom> getAtoms()
SimpleLogicalFormula
getAtoms
in interface SimpleLogicalFormula
public java.util.Set<Predicate> getPredicates()
SimpleLogicalFormula
getPredicates
in interface SimpleLogicalFormula
public java.lang.Class<? extends Predicate> getPredicateCls()
getPredicateCls
in interface SimpleLogicalFormula
public java.util.Set<Term<?>> getTerms()
getTerms
in interface LogicStructure
public NLPRule substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
ComplexLogicalFormula
substitute
in interface ComplexLogicalFormula
v
- the term to be substituted.t
- the term to substitute.java.lang.IllegalArgumentException
- if "v" and "t" are of different sortspublic int hashCode()
hashCode
in interface SimpleLogicalFormula
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in interface SimpleLogicalFormula
equals
in class java.lang.Object
public NLPRule clone()
SimpleLogicalFormula
clone
in interface ComplexLogicalFormula
clone
in interface SimpleLogicalFormula
clone
in class ComplexLogicalFormulaAdapter