Package org.tweetyproject.lp.nlp.syntax
Class NLPRule
java.lang.Object
org.tweetyproject.logics.commons.syntax.ComplexLogicalFormulaAdapter
org.tweetyproject.lp.nlp.syntax.NLPRule
- All Implemented Interfaces:
Formula,Rule<FolFormula,,FolFormula> ComplexLogicalFormula,LogicStructure,SimpleLogicalFormula
public class NLPRule
extends ComplexLogicalFormulaAdapter
implements ComplexLogicalFormula, Rule<FolFormula,FolFormula>
A rule of a nested logic program. A nested logic program contains not quantified
first order formulas.
- Author:
- Tim Janus
-
Constructor Summary
ConstructorsConstructorDescriptionNLPRule()NLPRule(FolFormula conclusion) NLPRule(FolFormula conclusion, Collection<FolFormula> premise) NLPRule(FolFormula conclusion, FolFormula premise) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPremise(FolFormula premise) Add the given premise to this rule.voidaddPremises(Collection<? extends FolFormula> premises) Add the given premises to this rule.clone()Creates a deep copy of this formulabooleangetAtoms()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.getTerms()inthashCode()booleanisConstraintbooleanisFact()isFactvoidsetConclusion(FolFormula conclusion) Set the conclusion of this rule.substitute(Term<?> v, Term<?> t) Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.Methods inherited from class org.tweetyproject.logics.commons.syntax.ComplexLogicalFormulaAdapter
containsTermsOfType, exchange, getTerms, isGround, isLiteral, isWellFormed, substituteMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.ComplexLogicalFormula
exchange, isGround, isWellFormed, substituteMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.LogicStructure
containsTermsOfType, getTermsMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
isLiteral
-
Constructor Details
-
NLPRule
public NLPRule() -
NLPRule
-
NLPRule
-
NLPRule
-
NLPRule
-
-
Method Details
-
addPremise
Description copied from interface:RuleAdd the given premise to this rule.- Specified by:
addPremisein interfaceRule<FolFormula,FolFormula> - Parameters:
premise- some formula- Throws:
LanguageException
-
addPremises
Description copied from interface:RuleAdd the given premises to this rule.- Specified by:
addPremisesin interfaceRule<FolFormula,FolFormula> - Parameters:
premises- some formulas
-
setConclusion
Description copied from interface:RuleSet the conclusion of this rule.- Specified by:
setConclusionin interfaceRule<FolFormula,FolFormula> - Parameters:
conclusion- some formula- Throws:
LanguageException
-
getPremise
Description copied from interface:RuleReturns the premise of this rule.- Specified by:
getPremisein interfaceRule<FolFormula,FolFormula> - Returns:
- the premise of this rule.
-
getConclusion
Description copied from interface:RuleReturns the conclusion of this rule.- Specified by:
getConclusionin interfaceRule<FolFormula,FolFormula> - Returns:
- the conclusion of this rule.
-
getSignature
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Specified by:
getSignaturein interfaceRule<FolFormula,FolFormula> - Returns:
- the signature of the language of this formula.
-
isFact
public boolean isFact()Description copied from interface:RuleisFact- Specified by:
isFactin interfaceRule<FolFormula,FolFormula> - Returns:
- whether the rule is a fact
-
isConstraint
public boolean isConstraint()Description copied from interface:RuleisConstraint- Specified by:
isConstraintin interfaceRule<FolFormula,FolFormula> - Returns:
- whether the rule is a constraint
-
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
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
-
getPredicateCls
- Specified by:
getPredicateClsin interfaceSimpleLogicalFormula- Returns:
- The class description of the predicate used by this formula.
-
getTerms
- Specified by:
getTermsin interfaceLogicStructure- Returns:
- a set containing all terms of this logical structure
-
substitute
Description copied from interface:ComplexLogicalFormulaSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.- Specified by:
substitutein interfaceComplexLogicalFormula- Parameters:
v- the term to be substituted.t- the term to substitute.- Returns:
- a formula where every occurrence of "v" is replaced by "t".
- Throws:
IllegalArgumentException- if "v" and "t" are of different sorts
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classObject
-
equals
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classObject
-
clone
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceComplexLogicalFormula- Specified by:
clonein interfaceSimpleLogicalFormula- Specified by:
clonein classComplexLogicalFormulaAdapter- Returns:
- the cloned formula
-