Class Intention

java.lang.Object
jason.asSemantics.Intention
All Implemented Interfaces:
ToDOM, java.io.Serializable, java.lang.Comparable<Intention>, java.lang.Iterable<IntendedMeans>
Direct Known Subclasses:
fork.ForkIntention

public class Intention
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Intention>, java.lang.Iterable<IntendedMeans>, ToDOM
Represents and Intention (a stack of IntendedMeans). The comparable sorts the intentions based on the atomic property: atomic intentions comes first.
Author:
Jomi and Rafael
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
      Constant Field Values
    • EmptyInt

      public static final Intention EmptyInt
    • idCount

      private static java.util.concurrent.atomic.AtomicInteger idCount
    • id

      private int id
    • atomicCount

      private int atomicCount
    • isSuspended

      private boolean isSuspended
    • suspendedReason

      private Term suspendedReason
    • place

    • interestedInUpdateEvents

      private int interestedInUpdateEvents
    • imWithGoalCondition

      private int imWithGoalCondition
    • gIntention

      private Intention gIntention
    • intendedMeans

      private java.util.Deque<IntendedMeans> intendedMeans
    • noReason

      public static Atom noReason
  • Constructor Details

    • Intention

      public Intention()
  • Method Details

    • setGIntention

      public void setGIntention​(Intention i)
    • getGIntention

      public Intention getGIntention()
    • getId

      public int getId()
    • push

      public void push​(IntendedMeans im)
    • peek

      public IntendedMeans peek()
    • pop

      public IntendedMeans pop()
    • isAtomic

      public boolean isAtomic()
    • setAtomic

      public void setAtomic​(int a)
    • setNoInterestInUpdateEvents

      public void setNoInterestInUpdateEvents()
    • hasInterestInUpdateEvents

      public boolean hasInterestInUpdateEvents()
    • hasGoalCondition

      public boolean hasGoalCondition()
    • iterator

      public java.util.Iterator<IntendedMeans> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<IntendedMeans>
    • isFinished

      public boolean isFinished()
    • size

      public int size()
    • clearIM

      public void clearIM()
    • setSuspended

      public void setSuspended​(boolean b)
      suspended intention means suspended by the internal action .suspend
    • isSuspended

      public boolean isSuspended()
    • setSuspendedReason

      public void setSuspendedReason​(Term r)
    • getSuspendedReason

      public Term getSuspendedReason()
    • getIM

      public IntendedMeans getIM​(IMCondition c, Unifier u)
      returns the IntendedMeans that succeeds in test c, returns null if there isn't one
    • getBottom

      public IntendedMeans getBottom()
    • getPlace

      public Circumstance.IntentionPlace getPlace()
      returns where the intention is in the interpreter data structures. It is updated by circumstance getAllIntentions.
    • setPlace

      public void setPlace​(Circumstance.IntentionPlace place)
    • getStateBasedOnPlace

      public Intention.State getStateBasedOnPlace()
    • hasTrigger

      public boolean hasTrigger​(Trigger g, Unifier u)
      returns true if the intention has an IM where TE = g, using u to verify equality
    • dropGoal

      public IntendedMeans dropGoal​(IMCondition c, Unifier u)
      remove all IMs until the lowest IM that succeeds in test c
    • fail

      public void fail​(Circumstance c)
    • findEventForFailure

      public Pair<Event,​java.lang.Integer> findEventForFailure​(Trigger tevent, PlanLibrary pl, Circumstance c)
    • compareTo

      public int compareTo​(Intention o)
      atomic intentions are grater than not atomic intentions
      Specified by:
      compareTo in interface java.lang.Comparable<Intention>
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • clone

      public Intention clone()
      Overrides:
      clone in class java.lang.Object
    • copyTo

      public void copyTo​(Intention i)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getAsTerm

      public Structure getAsTerm()
    • getAsDOM

      public org.w3c.dom.Element getAsDOM​(org.w3c.dom.Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM