<commit_before>/*
 * $Id$
 */

package fipa.core;

import java.util.Enumeration;
import java.util.Vector;
import java.lang.reflect.*;

import fipa.lang.acl.*;

/**************************************************************

  Name: Agent

  Responsibility and Collaborations:

  + Abstract placeholder for user-defined agents.

  + Provides primitives for sending and receiving messages.
    (ACLMessage)

  + Schedules and executes complex behaviours.
    (Behaviour)

****************************************************************/

/**
 * The abstract Agent class.
 * All the agents belonging to the agent platform must inherit from
 * this Agent class.  Agent is composed by a single execution thread
 * for the active part.  All the tasks that must be performed by an
 * agent are implemented as Behaviours, which are called and scheduled
 * in a round-robin fashion by the agent scheduler.  All the specific
 * tasks an agent has to implement must be added as Behaviours to the
 * particular Agent derived class.  The abstract Agent class provides
 * the agent developer with some methods to implement some
 * communication paradigms: FipaRequest (corresponding to the
 * FIPA-request protocol), SendReceive (when a message requires only a
 * single answer notification), blockingSendReceive (the corresponding
 * blocking paradigm).  In fact, by default all protocols and
 * communication paradigms are non-blocking.  In order to allow the
 * user to be able to add its own tasks, the method addTask is
 * provided by the abstract Agent, requiring as a parameter the name
 * of the method implementing the task. As soon as the method is
 * called, the task specified is added to the queue of ready tasks for
 * the scheduler.
 * 
 * @version 2.0 5/98
 * */
public class Agent implements Runnable, CommBroadcaster { // FIXME: Should be abstract ?

  protected Vector msgQueue = new Vector();
  protected Vector listeners = new Vector();
  protected Vector actions = new Vector();

  protected ACLMessage   currentMessage;
  protected String       myName;
  protected Thread       myThread;
  protected boolean      isActive = false;

  private ACLParser parser = null; // FIXME: Must be initialized with a valid ACL parser

  public void activate(String name) { // FIXME: Check with FIPA specs for agent lifecycle

    myName = new String(name);

    isActive = true;
    myThread = new Thread(this);
    myThread.start();

  }

  protected void localStartup() {}

  public final void run() {

    local_startup();

    System.out.println(myName + ": initializing...");

    schedule();

    System.out.println(myName + ": exiting...");

  }
<commit_msg>Fixed a syntax error: local_startup() was to be localStartup().<commit_after>/*
 * $Id$
 */

package fipa.core;

import java.util.Enumeration;
import java.util.Vector;
import java.lang.reflect.*;

import fipa.lang.acl.*;

/**************************************************************

  Name: Agent

  Responsibility and Collaborations:

  + Abstract placeholder for user-defined agents.

  + Provides primitives for sending and receiving messages.
    (ACLMessage)

  + Schedules and executes complex behaviours.
    (Behaviour)

****************************************************************/

/**
 * The abstract Agent class.
 * All the agents belonging to the agent platform must inherit from
 * this Agent class.  Agent is composed by a single execution thread
 * for the active part.  All the tasks that must be performed by an
 * agent are implemented as Behaviours, which are called and scheduled
 * in a round-robin fashion by the agent scheduler.  All the specific
 * tasks an agent has to implement must be added as Behaviours to the
 * particular Agent derived class.  The abstract Agent class provides
 * the agent developer with some methods to implement some
 * communication paradigms: FipaRequest (corresponding to the
 * FIPA-request protocol), SendReceive (when a message requires only a
 * single answer notification), blockingSendReceive (the corresponding
 * blocking paradigm).  In fact, by default all protocols and
 * communication paradigms are non-blocking.  In order to allow the
 * user to be able to add its own tasks, the method addTask is
 * provided by the abstract Agent, requiring as a parameter the name
 * of the method implementing the task. As soon as the method is
 * called, the task specified is added to the queue of ready tasks for
 * the scheduler.
 * 
 * @version 2.0 5/98
 * */
public class Agent implements Runnable, CommBroadcaster { // FIXME: Should be abstract ?

  protected Vector msgQueue = new Vector();
  protected Vector listeners = new Vector();
  protected Vector actions = new Vector();

  protected ACLMessage   currentMessage;
  protected String       myName;
  protected Thread       myThread;
  protected boolean      isActive = false;

  private ACLParser parser = null; // FIXME: Must be initialized with a valid ACL parser

  public void activate(String name) { // FIXME: Check with FIPA specs for agent lifecycle

    myName = new String(name);

    isActive = true;
    myThread = new Thread(this);
    myThread.start();

  }

  protected void localStartup() {}

  public final void run() {

    localStartup();

    System.out.println(myName + ": initializing...");

    schedule();

    System.out.println(myName + ": exiting...");

  }

{'fraction_non_alphanumeric': 0.1172093023255814, 'fraction_numerical': 0.0018604651162790699, 'mean_word_length': 3.7491166077738516, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2610284', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1319, 'n_words': 618}