fr.lip6.sma.simulacion.server
Class LocalAgentImpl

java.lang.Object
  extended by fr.lip6.sma.simulacion.server.AgentImpl
      extended by fr.lip6.sma.simulacion.server.LocalAgentImpl
All Implemented Interfaces:
Agent, LocalAgent, LocalAgentWithProperties
Direct Known Subclasses:
LocalAwareAgentImpl, LocalLogAgentImpl

public abstract class LocalAgentImpl
extends AgentImpl
implements LocalAgentWithProperties

Classe pour les agents locaux. Cette classe gère une liste de propriétés et répond au message getGame.

Version:
$Revision: 3 $
Author:
Paul Guyot
See Also:
"aucun test défini."

Field Summary
private  AgentListManager mAgentListManager
          Référence sur la liste des agents.
private  String mAgentName
          Référence sur le nom de l'agent.
private  Map mProperties
          Référence sur les propriétés de l'agent.
private  PropertyChangeSupport mPropertyChangeSupport
          Gestionnaire pour les changements des propriétés.
 
Fields inherited from interface fr.lip6.sma.simulacion.server.Agent
AVATAR_PROPERTY_KEY, CLASS_KEY, IMPLEMENTATION_KEY, LOCATION_KEY, ONMAP_KEY, PROPERTIES_KEY, TYPE_PROPERTY_KEY
 
Constructor Summary
LocalAgentImpl(AgentListManager inAgentListManager, String inAgentName, Map inProperties)
          Constructeur à partir du gestionnaire de liste, d'un nom et de propriétés.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener inListener)
          Ajoute un client pour les changements des propriétés.
 void addPropertyChangeListener(String inPropertyName, PropertyChangeListener inListener)
          Ajoute un client pour les changements d'une propriété.
 String execute(String inOperationName, Map inParams)
          Exécute une opération.
 void executeAsync(String inOperationName, Map inParams)
          Exécute une opération de manière asynchrone sans retourner le résultat.
protected  AgentListManager getAgentListManager()
          Accesseur sur la liste des agents.
 String getAgentName()
          Accesseur sur le nom de l'agent.
 String getProperty(String inPropertyName)
          Accesseur sur une propriété de l'agent.
 void removePropertyChangeListener(PropertyChangeListener inListener)
          Supprime un client pour les changements des propriétés.
 void removePropertyChangeListener(String inPropertyName, PropertyChangeListener inListener)
          Supprimer un client pour les changements d'une propriété.
protected  String setProperty(String inPropertyName, String inValue)
          Sélecteur sur une propriété de l'agent.
 
Methods inherited from class fr.lip6.sma.simulacion.server.AgentImpl
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.lip6.sma.simulacion.server.Agent
equals, getAgentClass, hashCode
 

Field Detail

mAgentListManager

private final AgentListManager mAgentListManager
Référence sur la liste des agents.


mAgentName

private final String mAgentName
Référence sur le nom de l'agent.


mProperties

private final Map mProperties
Référence sur les propriétés de l'agent.


mPropertyChangeSupport

private final PropertyChangeSupport mPropertyChangeSupport
Gestionnaire pour les changements des propriétés.

Constructor Detail

LocalAgentImpl

public LocalAgentImpl(AgentListManager inAgentListManager,
                      String inAgentName,
                      Map inProperties)
Constructeur à partir du gestionnaire de liste, d'un nom et de propriétés.

Parameters:
inAgentListManager - gestionnaire de la liste des agents.
inAgentName - nom de l'agent.
inProperties - propriétés de l'agent.
Method Detail

getAgentListManager

protected final AgentListManager getAgentListManager()
Accesseur sur la liste des agents.

Returns:
le gestionnaire de liste des agents.

getAgentName

public final String getAgentName()
Accesseur sur le nom de l'agent.

Specified by:
getAgentName in interface Agent
Returns:
le nom de l'agent.

getProperty

public final String getProperty(String inPropertyName)
Accesseur sur une propriété de l'agent.

Specified by:
getProperty in interface LocalAgentWithProperties
Parameters:
inPropertyName - nom de la propriété
Returns:
la propriété ou null si elle n'existe pas.

setProperty

protected final String setProperty(String inPropertyName,
                                   String inValue)
Sélecteur sur une propriété de l'agent.

Parameters:
inPropertyName - nom de la propriété
inValue - la nouvelle valeur de la propriété.
Returns:
l'ancienne valeur.

execute

public String execute(String inOperationName,
                      Map inParams)
               throws AgentException
Exécute une opération. Cette classe ne gère que le message getGame.

Specified by:
execute in interface Agent
Parameters:
inOperationName - nom de l'opération à exécuter.
inParams - paramètres de l'opération.
Returns:
le résultat de l'opération (sous forme de chaîne).
Throws:
AgentException - si l'opération n'existe pas ou un autre problème est survenu dans l'exécution de la méthode de l'agent.

executeAsync

public final void executeAsync(String inOperationName,
                               Map inParams)
Exécute une opération de manière asynchrone sans retourner le résultat.

Specified by:
executeAsync in interface Agent
Specified by:
executeAsync in interface LocalAgent
Parameters:
inOperationName - nom de l'opération à exécuter.
inParams - paramètres de l'opération.

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener inListener)
Ajoute un client pour les changements des propriétés.

Specified by:
addPropertyChangeListener in interface LocalAgentWithProperties
Parameters:
inListener - client à ajouter.

addPropertyChangeListener

public final void addPropertyChangeListener(String inPropertyName,
                                            PropertyChangeListener inListener)
Ajoute un client pour les changements d'une propriété.

Specified by:
addPropertyChangeListener in interface LocalAgentWithProperties
Parameters:
inPropertyName - nom de la propriété.
inListener - client à ajouter.

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener inListener)
Supprime un client pour les changements des propriétés.

Specified by:
removePropertyChangeListener in interface LocalAgentWithProperties
Parameters:
inListener - client à supprimer.

removePropertyChangeListener

public final void removePropertyChangeListener(String inPropertyName,
                                               PropertyChangeListener inListener)
Supprimer un client pour les changements d'une propriété.

Specified by:
removePropertyChangeListener in interface LocalAgentWithProperties
Parameters:
inPropertyName - nom de la propriété.
inListener - client à supprimer.