Package jason.asSyntax
Class Trigger
java.lang.Object
jason.asSyntax.DefaultTerm
jason.asSyntax.Literal
jason.asSyntax.Atom
jason.asSyntax.Structure
jason.asSyntax.Trigger
- All Implemented Interfaces:
LogicalFormula
,Term
,ToDOM
,ToJson
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Term>
public class Trigger extends Structure implements java.lang.Cloneable
Represents an AgentSpeak trigger (like +!g, +p, ...).
It is composed by:
an operator (+ or -);
a type (, !, or ?);
a literal
(it extends structure to be used as a term)
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Trigger.TEOperator
static class
Trigger.TEType
Nested classes/interfaces inherited from class jason.asSyntax.Literal
Literal.FalseLiteral, Literal.TrueLiteral
-
Field Summary
Fields Modifier and Type Field Description private boolean
isTerm
private Literal
literal
private static java.util.logging.Logger
logger
private Trigger.TEOperator
operator
private static long
serialVersionUID
private Trigger.TEType
type
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
Constructors Constructor Description Trigger(Trigger.TEOperator op, Trigger.TEType t, Literal l)
-
Method Summary
Modifier and Type Method Description Trigger
capply(Unifier u)
clone and applies together (and faster than clone and then apply)Trigger
clone()
make a deep copy of the termsboolean
equals(java.lang.Object o)
int
getArity()
returns the number of terms of this literalorg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLLiteral
getLiteral()
Trigger.TEOperator
getOperator()
PredicateIndicator
getPredicateIndicator()
return [+|-][!|?] super.getPredicateIndicatorTerm
getTerm(int i)
returns the i-th term (first term is 0)Trigger.TEType
getType()
boolean
isAchvGoal()
boolean
isAddition()
boolean
isGoal()
boolean
isMetaEvent()
boolean
isUpdate()
returns true if the trigger is an add (+bel) or del (-bel)static Trigger
parseTrigger(java.lang.String sTe)
prefer to use ASSyntax.parseTriggerboolean
sameType(Trigger e)
void
setAsTriggerTerm(boolean b)
void
setLiteral(Literal literal)
void
setTerm(int i, Term t)
void
setTrigOp(Trigger.TEOperator op)
java.lang.String
toString()
static Trigger
tryToGetTrigger(Term t)
try to convert the term t into a trigger, in case t is a trigger term, a string that can be parsed to a trigger, a var with value trigger, ....Methods inherited from class jason.asSyntax.Structure
addTerm, addTerms, addTerms, calcHashCode, cloneNS, countVars, delTerm, getSingletonVars, getTerms, getTermsSize, hasTerm, hasVar, isAtom, isGround, isStructure, isUnary, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerms, subsumes, varToReplace
Methods inherited from class jason.asSyntax.Atom
compareTo, getFunctor, getNS
Methods inherited from class jason.asSyntax.Literal
addAnnot, addAnnots, addAnnots, addSource, addSourceInfoAsAnnots, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnot, getAnnots, getAnnots, getAsJson, getAsListOfTerms, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFromListOfTerms, newFunctor, noSource, parseLiteral, setAnnots, setNegated, subjectToBUF
Methods inherited from class jason.asSyntax.DefaultTerm
getCyclicVar, getErrorMsg, getSrcInfo, hashCode, isArithExpr, isCyclicTerm, isInternalAction, isList, isMap, isNumeric, isPlanBody, isPred, isRule, 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, isPred, isRule, 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 -
operator
-
type
-
literal
-
isTerm
private boolean isTerm
-
-
Constructor Details
-
Trigger
-
-
Method Details
-
parseTrigger
prefer to use ASSyntax.parseTrigger -
getArity
public int getArity()Description copied from class:Literal
returns the number of terms of this literal -
getTerm
Description copied from class:Literal
returns the i-th term (first term is 0) -
setTerm
-
setTrigOp
-
sameType
-
equals
public boolean equals(java.lang.Object o) -
isAchvGoal
public boolean isAchvGoal() -
isGoal
public boolean isGoal() -
isUpdate
public boolean isUpdate()returns true if the trigger is an add (+bel) or del (-bel) -
isMetaEvent
public boolean isMetaEvent() -
getOperator
-
getType
-
isAddition
public boolean isAddition() -
clone
Description copied from class:Structure
make a deep copy of the terms -
capply
Description copied from interface:Term
clone and applies together (and faster than clone and then apply) -
getPredicateIndicator
return [+|-][!|?] super.getPredicateIndicator- Overrides:
getPredicateIndicator
in classLiteral
-
getLiteral
-
setLiteral
-
setAsTriggerTerm
public void setAsTriggerTerm(boolean b) -
toString
public java.lang.String toString() -
tryToGetTrigger
try to convert the term t into a trigger, in case t is a trigger term, a string that can be parsed to a trigger, a var with value trigger, ....- Throws:
jason.asSyntax.parser.ParseException
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML
-