galatea.hla
Class GInterface

java.lang.Object
  extended bygalatea.hla.GInterface

public class GInterface
extends java.lang.Object

Class GInterface definition. Clase Interface entre el GLIDER y los Agentes This class implements an extension for the DEVS simulation process of Galatea, which, by de way, is the same as in GLIDER. This extension, specified in UML diagrams in [Uzcategui, 2002], provides for agent management in simulations. Agents are feeded by the simulator and their outputs, a list of actions to be executed, are collected as part of the code in the "process" method of this class. As we explain elswhere [Davila, Uzcategui:2002], this executing intentions are called INFLUENCES and this class is, basically, an influence manager.
The name of the class suggests that it serves as the interface between the simulator and the agentes. As a matter of fact, the interface agent-simulator is specific to each simulation model (to each system being simulated). What this GInterface class does is to load the file with the actual interface (that is, a Java file with a list of methods that describe the interface for a particular model) and, thereafter, deal with the managing of the method there contained (an example in the file Interface.java).
The new stage of the simulation process consists, therefore, of 1) the loading of the interface class, 2) at the time of an event, the collection of the influences from all the agents (gatherInfluences) and 3) the actual execution of the methods associated to those influences (collected with findMethods).
It is worth noticing that all this managing of interface class, influences and their methods is only possible thanks to the reflection capabilities provided by Java.
-------
La clase GInterface implementa una extensión al proceso de simulación de eventos discreto de Galatea (que es idéntico, hasta este punto, al de GLIDER). La extensión está especificada, con diagramas UML, en [Uzcátegui, 2002] y tiene como objetivo incorporar a los agentes al proceso de simulación, alimentándoles con información (sus entradas) y, mas importante, recogiendo todas las acciones que los agentes postulan para ser ejecutadas en el ambiente del sistema controlado por el simulador Galatea. Siguiendo la teoria de simulación que especifica a Galatea, esas intenciones de ejecución (acciones por ejecutar, no ejecutadas) son llamadas INFLUENCIAS.
El nombre de la clase se refiere a que sirve como interfaz entre el simulador y los agentes. Estríctamente, sin embargo, la interfaz entre el simulador y los agentes es una clase específica de cada modelo de simulación Galatea, pues contiene el listado de métodos y atributos específicos del modelo. GInterface simplemente gestiona la "carga" dinámica de esta clase, en tiempo de ejecución, y luego provee los servicios para que agentes y simulador interactúen sobre los métodos de esa interfaz específica (un ejemplo de tal interfaz se almacena, para efectos de referencia en el archivo Interface.java).
Esquemáticamente, el "proceso" de simulación con los agentes puede ser descrito así: 1) el simulador carga la clase con los métodos que el modelista usa para describir como el agente observa y cómo ejecuta acciones. 2) durante el proceso de simulación, el simulador, luego de ejecutar un evento de simulación como en DEVS, revisa el estado de los agentes y recoge las influencias que ellos postulan (gatherInfluences) para luego, usando los métodos Java asociados a esas influences (ubicados con findMethod), ejecutar esos códigos sobre el estado actual del simulador.
Es importante notar que los servicios de carga dinámica de clases y de gestión d métodos de la nueva clase son posibles a través de las previsiones para REFLEXION del lenguaje Java (provistas por la clase java.lang.Class).

Version:
0 20/06/01
Author:
J. Davila, K. Tucci

Field Summary
static LAgents agentList
          This variable represents the Agents' list.
static LInfluences influencesList
          This variable represents the list of the agents' influences.
static java.lang.Class interf
          This variable represents the interface to simulate the agents.
static java.lang.Object interfObject
          This is the interface to simulate the agents but as an Object variable.
 
Constructor Summary
GInterface()
           
 
Method Summary
static java.lang.reflect.Method findMethod(java.lang.String methodId)
          This method finds a method from the list of methods in the Interface.
static void gatherInfluences_test()
          This method gather all the influences generated by all the agents at a determined time.
static void init(java.lang.Object interfaz)
          This method returns the reference to the user's interface.
static void process_test()
          This method executes each influence at the influence list, while invoking the related methods to each influence.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

influencesList

public static LInfluences influencesList
This variable represents the list of the agents' influences. An influence is what an agent (who) wants to do at a determined time (exectime), from its location (where). The action to be executed is an influence.
-----
Esta variable representa la lista de influencias de los agentes. Una influencia es lo que quiere hacer un agente (who) en un momento (execTime) desde una posicion (where). La accion a ejecutarse es una influencia.


agentList

public static LAgents agentList
This variable represents the Agents' list.
-----
Esta variable representa la lista de agentes.


interf

public static java.lang.Class interf
This variable represents the interface to simulate the agents.
-----
Esta variable representa la interfaz para simular los agentes.


interfObject

public static java.lang.Object interfObject
This is the interface to simulate the agents but as an Object variable.
-----
Esta es la interfaz para simular los agentes pero como una variable de tipo Objeto.

Constructor Detail

GInterface

public GInterface()
Method Detail

init

public static void init(java.lang.Object interfaz)
This method returns the reference to the user's interface.
-----
Este método retorna la referencia a la interfaz del usuario. Esta interfaz es un archivo llamado "Interface.class".

Parameters:
interfaz - Object.
-----
interfaz – Object.

process_test

public static void process_test()
This method executes each influence at the influence list, while invoking the related methods to each influence.
-----
Este método ejecuta cada una de las influencias de la lista de influencias al invicar a los metodos relacionados a cada una de las influencias.


gatherInfluences_test

public static void gatherInfluences_test()
This method gather all the influences generated by all the agents at a determined time.
-----
Este método recoge todas las influencias producidas por todos los agentes en un determinado instante.


findMethod

public static java.lang.reflect.Method findMethod(java.lang.String methodId)
This method finds a method from the list of methods in the Interface. It assumes that each method's name is unique and that the method init() has already been called.
-------
Este método encuentra un método en la lista de métodos de la Interfaz. Asume que cada nombre de método es único y que el método init() ya ha sido llamado previamente.

Parameters:
methodId - String.
-----
methodId – String. Identificador del método.
Returns:
theMethod