Class DefaultInternalAction

java.lang.Object
jason.asSemantics.DefaultInternalAction
All Implemented Interfaces:
InternalAction, java.io.Serializable
Direct Known Subclasses:
abolish, add, add_annot, add_nested_source, add_plan, all_names, asserta, assertz, at, atom, belief, broadcast, clear, clone, concat, copy_term, count, create, create, create, create_agent, current_intention, date, delete, df_register, difference, drop_all_events, drop_all_intentions, drop_intention, empty, eval, fail, findall, foreach, fork, get_src_info, ground, if_then_else, include, intend, intention, internal_action, join, kill_agent, length, list, list_files, list_plans, list_rules, literal, log, loop, lower_case, member, mi, min, my_name, namespace, nano_time, nth, number, perceive, plan_label, prefix, print_unifier, println, put, puts, random, range, relevant_plan, relevant_plans, relevant_rules, remove_plan, remove_source_annot, rename_apart, replace, resume, reverse, save_agent, send, set_random_seed, setof, shuffle, signal, sort, stopMAS, string, structure, sublist, substring, succeed_goal, suffix, suspend, suspended, term2string, time, type, upper_case, verbose, verbose, version, wait

public class DefaultInternalAction
extends java.lang.Object
implements InternalAction, java.io.Serializable
Default implementation of the internal action interface (it simply returns false for the interface methods). Useful to create new internal actions.
Author:
Jomi
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static long serialVersionUID  
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultInternalAction()  
  • Method Summary

    Modifier and Type Method Description
    boolean canBeUsedInContext()
    Return true if the internal action can be used in plans' context
    protected void checkArguments​(Term[] args)  
    void destroy()  
    java.lang.Object execute​(TransitionSystem ts, Unifier un, Term[] args)
    Executes the internal action.
    int getMaxArgs()  
    int getMinArgs()  
    Term[] prepareArguments​(Literal body, Unifier un)
    Prepare body's terms to be used in 'execute', normally it consist of cloning and applying each term
    boolean suspendIntention()
    Returns true if the internal action (IA) should suspend the intention where the IA is called

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • DefaultInternalAction

      public DefaultInternalAction()
  • Method Details

    • suspendIntention

      public boolean suspendIntention()
      Description copied from interface: InternalAction
      Returns true if the internal action (IA) should suspend the intention where the IA is called
      Specified by:
      suspendIntention in interface InternalAction
    • canBeUsedInContext

      public boolean canBeUsedInContext()
      Description copied from interface: InternalAction
      Return true if the internal action can be used in plans' context
      Specified by:
      canBeUsedInContext in interface InternalAction
    • getMinArgs

      public int getMinArgs()
    • getMaxArgs

      public int getMaxArgs()
    • checkArguments

      protected void checkArguments​(Term[] args) throws JasonException
      Throws:
      JasonException
    • prepareArguments

      public Term[] prepareArguments​(Literal body, Unifier un)
      Description copied from interface: InternalAction
      Prepare body's terms to be used in 'execute', normally it consist of cloning and applying each term
      Specified by:
      prepareArguments in interface InternalAction
    • execute

      public java.lang.Object execute​(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.Exception
      Description copied from interface: InternalAction
      Executes the internal action. It should return a Boolean or an Iterator. A true boolean return means that the IA was successfully executed. An Iterator result means that there is more than one answer for this IA (e.g. see member internal action).
      Specified by:
      execute in interface InternalAction
      Throws:
      java.lang.Exception
    • destroy

      public void destroy() throws java.lang.Exception
      Specified by:
      destroy in interface InternalAction
      Throws:
      java.lang.Exception