Package jason.asSyntax
Class Rule
java.lang.Object
- All Implemented Interfaces:
LogicalFormula
,Term
,ToDOM
,ToJson
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Term>
public class Rule extends LiteralImpl
A rule is a Literal (head) with a body, as in "a :- b & c".
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class jason.asSyntax.Literal
Literal.FalseLiteral, Literal.TrueLiteral
-
Field Summary
Fields Modifier and Type Field Description private LogicalFormula
body
private boolean
isTerm
private static java.util.logging.Logger
logger
private static long
serialVersionUID
Fields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermList
Fields inherited from class jason.asSyntax.Literal
DefaultNS, LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
Fields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfo
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected int
calcHashCode()
Term
capply(Unifier u)
clone and applies together (and faster than clone and then apply)Rule
clone()
make a deep copy of the termsvoid
countVars(java.util.Map<VarTerm,java.lang.Integer> c)
boolean
equals(java.lang.Object o)
org.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLLogicalFormula
getBody()
Literal
getHead()
boolean
hasVar(VarTerm t, Unifier u)
Literal
headCApply(Unifier u)
Literal
headClone()
boolean
isAtom()
boolean
isGround()
boolean
isRule()
boolean
isTerm()
Literal
makeVarsAnnon(Unifier un)
replaces all variables of the term for unnamed variables (_).void
setAsTerm(boolean b)
java.lang.String
toString()
Methods inherited from class jason.asSyntax.LiteralImpl
canBeAddedInBB, cloneNS, getErrorMsg, getPredicateIndicator, negated, setNegated
Methods inherited from class jason.asSyntax.Pred
addAnnot, addAnnots, addAnnots, addSource, capplyAnnots, clearAnnots, createSource, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, getAnnot, getAnnots, getAnnots, getSources, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isPred, parsePred, setAnnots, toStringAsTerm
Methods inherited from class jason.asSyntax.Structure
addTerm, addTerms, addTerms, delTerm, getArity, getSingletonVars, getTerm, getTerms, getTermsSize, hasTerm, isStructure, isUnary, makeTermsAnnon, makeVarsAnnon, parse, setTerm, setTerms, subsumes, varToReplace
Methods inherited from class jason.asSyntax.Atom
compareTo, getFunctor, getNS
Methods inherited from class jason.asSyntax.Literal
addSourceInfoAsAnnots, copy, delAnnots, forceFullLiteralImpl, getAsJson, getAsListOfTerms, getTermsArray, isLiteral, logicalConsequence, newFromListOfTerms, newFunctor, noSource, parseLiteral, subjectToBUF
Methods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getSrcInfo, hashCode, isArithExpr, isCyclicTerm, isInternalAction, isList, isMap, isNumeric, isPlanBody, isSet, isString, isUnnamedVar, isVar, resetHashCodeCache, setSrcInfo
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface jason.asSyntax.Term
getCyclicVar, getSrcInfo, isArithExpr, isCyclicTerm, isInternalAction, isList, isMap, isNumeric, isPlanBody, isSet, isString, isUnnamedVar, isVar, setSrcInfo
Methods inherited from interface jason.util.ToJson
getAsJsonStr
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
logger
private static java.util.logging.Logger logger -
body
-
isTerm
private boolean isTerm
-
-
Constructor Details
-
Rule
-
Rule
-
-
Method Details
-
isRule
public boolean isRule()- Specified by:
isRule
in interfaceTerm
- Overrides:
isRule
in classDefaultTerm
-
isAtom
public boolean isAtom()- Specified by:
isAtom
in interfaceTerm
- Overrides:
isAtom
in classLiteralImpl
-
isGround
public boolean isGround() -
setAsTerm
public void setAsTerm(boolean b) -
isTerm
public boolean isTerm() -
equals
public boolean equals(java.lang.Object o)- Specified by:
equals
in interfaceTerm
- Overrides:
equals
in classLiteralImpl
-
calcHashCode
protected int calcHashCode()- Overrides:
calcHashCode
in classLiteralImpl
-
getBody
-
getHead
-
makeVarsAnnon
Description copied from class:Literal
replaces all variables of the term for unnamed variables (_).- Overrides:
makeVarsAnnon
in classPred
- Parameters:
un
- is the unifier that contains the map of replacements
-
capply
Description copied from interface:Term
clone and applies together (and faster than clone and then apply)- Specified by:
capply
in interfaceTerm
- Overrides:
capply
in classLiteralImpl
-
clone
Description copied from class:Structure
make a deep copy of the terms- Specified by:
clone
in interfaceTerm
- Overrides:
clone
in classLiteralImpl
-
headClone
-
headCApply
-
toString
public java.lang.String toString() -
hasVar
-
countVars
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML- Specified by:
getAsDOM
in interfaceToDOM
- Overrides:
getAsDOM
in classLiteralImpl
-