fr.lifl.jedi.model
Class Environment.EnvironmentCell

java.lang.Object
  extended by fr.lifl.jedi.model.Environment.EnvironmentCell
Enclosing class:
Environment

public class Environment.EnvironmentCell
extends java.lang.Object

This inner class corresponds to an unitary cell of the environment.

This cell has two coordinates (x,y), that correspond to the position of its lower left corner in the environment.

A cell contains all positions of the environment contained in the set [x, x+1[ * [y, y+1[. Consequently, if the surface of an agent contains one point in [x, x+1[ * [y, y+1[, this agent is considered as contained in this cell.

Version:
JEDI V 2.2
Created the 30th oct. 2008
Modified the 4th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Field Summary
protected  Environment environment
          The environment where this cell lies.
protected  java.awt.Point position
          The coordinates of the cell in the environment.
protected  java.util.Set<Agent> theAgents
          The set of all agents that are present in this cell.
 
Constructor Summary
Environment.EnvironmentCell(Environment e, int x, int y)
          Constructor of the class EnvironmentCell.
 
Method Summary
 void addAgent(Agent a)
          Adds an agent to this cell.
 java.util.Set<Agent> getAgents()
          Gets the set of all agents present in this cell.
 java.awt.Point getPosition()
          Gets the coordinates of the lower left side of the cell in the environment.
 void removeAgent(Agent a)
          Removes an agent from this cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

protected java.awt.Point position
The coordinates of the cell in the environment.


environment

protected Environment environment
The environment where this cell lies.


theAgents

protected java.util.Set<Agent> theAgents
The set of all agents that are present in this cell.

Constructor Detail

Environment.EnvironmentCell

public Environment.EnvironmentCell(Environment e,
                                   int x,
                                   int y)
Constructor of the class EnvironmentCell.

Parameters:
e - the environment where lies the cell.
x - the x coordinate of the lower left part of the cell.
y - the y coordinate of the lower left part of the cell.
Method Detail

getAgents

public java.util.Set<Agent> getAgents()
Gets the set of all agents present in this cell.

Returns:
the set of all agents present in this cell.

addAgent

public void addAgent(Agent a)
Adds an agent to this cell.

Parameters:
a - The agent to add

removeAgent

public void removeAgent(Agent a)
Removes an agent from this cell.

Parameters:
a - The agent to remove.

getPosition

public java.awt.Point getPosition()
Gets the coordinates of the lower left side of the cell in the environment.

Returns:
The coordinates of the lower left side of the cell in the environment.