fr.lip6.sma.simulacion.app.map
Class MapShapesModel

java.lang.Object
  extended by fr.lip6.sma.simulacion.app.map.MapShapesModel

public class MapShapesModel
extends Object

Classe pour gérer l'association des formes avec les agents. Cette association est locale pour chaque instance de l'application.

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

Field Summary
private  Map mMapAgentShape
          Map agent names to shape IDs.
private  int mMaxShapeID
          Last (max) shape ID.
private  BitSet mUsedShapeIDs
          Set of used shape IDs.
 
Constructor Summary
MapShapesModel(int inMaxShapeID)
          Constructor from the maximum number of shapes.
 
Method Summary
 int addAgent(String inAgentName)
          Create a new shape ID to the model on the arrival of an agent.
 int getAgentShapeID(String inAgentName)
          Gets the shape id of an agent geometric avatar.
 void removeAgent(String inAgentName)
          Method to remove a shape ID from the model on exit of the agent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mMapAgentShape

private final Map mMapAgentShape
Map agent names to shape IDs.


mUsedShapeIDs

private final BitSet mUsedShapeIDs
Set of used shape IDs.


mMaxShapeID

private final int mMaxShapeID
Last (max) shape ID.

Constructor Detail

MapShapesModel

public MapShapesModel(int inMaxShapeID)
Constructor from the maximum number of shapes.

Parameters:
inMaxShapeID - maximum number of shapes.
Method Detail

getAgentShapeID

public int getAgentShapeID(String inAgentName)
Gets the shape id of an agent geometric avatar.

Parameters:
inAgentName - The agent name in the system.
Returns:
The shape ID in use for the selected agent. Null if agent not found.

addAgent

public int addAgent(String inAgentName)
Create a new shape ID to the model on the arrival of an agent. If the agent is already in the set, return its previously assigned shape ID.

Parameters:
inAgentName - the name of the agent.
Returns:
the shape ID of the agent.

removeAgent

public void removeAgent(String inAgentName)
Method to remove a shape ID from the model on exit of the agent.

Parameters:
inAgentName - The name of the agent.