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, 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
Methods inherited from class jason.asSyntax.Structure |
addTerm, addTerms, addTerms, calcHashCode, compareTo, countVars, delTerm, getSingletonVars, getTerms, getTermsSize, hasTerm, hasVar, isAtom, isGround, isStructure, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerms, varToReplace |
Methods inherited from class jason.asSyntax.Literal |
addAnnot, addAnnots, addAnnots, addSource, canBeAddedInBB, clearAnnots, copy, delAnnot, delAnnots, delSource, delSources, equalsAsStructure, forceFullLiteralImpl, getAnnots, getAnnots, getAsListOfTerms, getSources, getTermsArray, hasAnnot, hasAnnot, hasSource, hasSource, hasSubsetAnnot, hasSubsetAnnot, importAnnots, isLiteral, logicalConsequence, negated, newFromListOfTerms, parseLiteral, setAnnots, setNegated |
Methods inherited from class jason.asSyntax.DefaultTerm |
getErrorMsg, getSrcInfo, hashCode, isArithExpr, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, 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 |
getSrcInfo, isArithExpr, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isUnnamedVar, isVar, setSrcInfo |
Trigger
public Trigger(Trigger.TEOperator op,
Trigger.TEType t,
Literal l)
parseTrigger
public static Trigger parseTrigger(java.lang.String sTe)
- prefer to use ASSyntax.parseTrigger
getArity
public int getArity()
- Description copied from class:
Literal
- returns the number of terms of this literal
- Overrides:
getArity
in class Structure
getTerm
public Term getTerm(int i)
- Description copied from class:
Literal
- returns the i-th term (first term is 0)
- Overrides:
getTerm
in class Structure
setTerm
public void setTerm(int i,
Term t)
- Overrides:
setTerm
in class Structure
setTrigOp
public void setTrigOp(Trigger.TEOperator op)
sameType
public boolean sameType(Trigger e)
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interface Term
- Overrides:
equals
in class Structure
isAchvGoal
public boolean isAchvGoal()
isGoal
public boolean isGoal()
getOperator
public Trigger.TEOperator getOperator()
getType
public Trigger.TEType getType()
isAddition
public boolean isAddition()
clone
public Trigger clone()
- Description copied from class:
Structure
- make a deep copy of the terms
- Specified by:
clone
in interface Term
- Overrides:
clone
in class Structure
getPredicateIndicator
public PredicateIndicator getPredicateIndicator()
- return [+|-][!|?] super.getPredicateIndicator
- Overrides:
getPredicateIndicator
in class Literal
apply
public boolean apply(Unifier u)
- Description copied from interface:
Term
- replaces variables by their values in the unifier, returns true if some variable was applied
- Specified by:
apply
in interface Term
- Overrides:
apply
in class Structure
getLiteral
public Literal getLiteral()
setLiteral
public void setLiteral(Literal literal)
setAsTriggerTerm
public void setAsTriggerTerm(boolean b)
toString
public java.lang.String toString()
- Overrides:
toString
in class Structure
tryToGetTrigger
public static Trigger tryToGetTrigger(Term t)
throws jason.asSyntax.parser.ParseException
- 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
- Specified by:
getAsDOM
in interface ToDOM
- Overrides:
getAsDOM
in class Structure