jason.asSyntax
Class Trigger

Package class diagram package Trigger
java.lang.Object
  extended by jason.asSyntax.DefaultTerm
      extended by jason.asSyntax.Literal
          extended by jason.asSyntax.Atom
              extended by jason.asSyntax.Structure
                  extended by 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

Nested Class Summary
static class Trigger.TEOperator
           
static class Trigger.TEType
           
 
Field Summary
 
Fields inherited from class jason.asSyntax.Structure
emptyTermArray, emptyTermList
 
Fields inherited from class jason.asSyntax.Literal
LFalse, LNeg, LPos, LTrue, predicateIndicatorCache
 
Fields inherited from class jason.asSyntax.DefaultTerm
hashCodeCache, srcInfo
 
Constructor Summary
Trigger(Trigger.TEOperator op, Trigger.TEType t, Literal l)
           
 
Method Summary
 boolean apply(Unifier u)
          replaces variables by their values in the unifier, returns true if some variable was applied
 Trigger clone()
          make a deep copy of the terms
 boolean equals(java.lang.Object o)
           
 int getArity()
          returns the number of terms of this literal
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
          get as XML
 Literal getLiteral()
           
 Trigger.TEOperator getOperator()
           
 PredicateIndicator getPredicateIndicator()
          return [+|-][!|?] super.getPredicateIndicator
 Term getTerm(int i)
          returns the i-th term (first term is 0)
 Trigger.TEType getType()
           
 boolean isAchvGoal()
           
 boolean isAddition()
           
 boolean isGoal()
           
 boolean isMetaEvent()
           
static Trigger parseTrigger(java.lang.String sTe)
          prefer to use ASSyntax.parseTrigger
 boolean 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, compareTo, countVars, delTerm, getSingletonVars, getTerms, getTermsSize, hasTerm, hasVar, isAtom, isGround, isStructure, makeTermsAnnon, makeVarsAnnon, makeVarsAnnon, parse, setTerms, varToReplace
 
Methods inherited from class jason.asSyntax.Atom
getFunctor
 
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
 

Constructor Detail

Trigger

public Trigger(Trigger.TEOperator op,
               Trigger.TEType t,
               Literal l)
Method Detail

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()

isMetaEvent

public boolean isMetaEvent()

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