simuLCS
Class Arena

java.lang.Object
  extended bysimuLCS.Entity
      extended bysimuLCS.Arena

public class Arena
extends Entity

The Circular Arena

Author:
Benoit

Field Summary
private  java.awt.Graphics2D graphics
           
private  int shift
           
private static int sizeGrad
           
 
Fields inherited from class simuLCS.Entity
color_ext, color_int, coord, generator, name, paintName, size
 
Constructor Summary
Arena(int s, int sh)
           
 
Method Summary
 java.awt.geom.Point2D closestPointTo(java.awt.geom.Point2D p)
          Returns the point of the arena which is the closest to p.
 java.awt.geom.Point2D closestPointTo(java.awt.geom.Point2D p, double radiusArenaToConsider)
          Gives the closest point of the Wall to a given point
 boolean collideWithMe(Agent a)
          Returns true if Agent a collides with the Arena
 double distanceTo(java.awt.geom.Point2D p)
          Calculates the distance between a point and the arena
 java.awt.geom.Point2D getCoordNearTo(Entity otherEntity)
          For the arena, the coordinates used to get the vector are the coordinates of the closest point of the arena
 double getRadius()
           
 double getRadiusBody()
           
 int getShift()
           
 boolean isDangerous()
          By convention, the Arena is dangerous.
 boolean isInside(double x, double y, double radiusBody)
          Returns true if the circle whose center is the point (x,y) and whose radius is radiusBody is colliding with the Arena
 boolean isMoving()
          Should be defined by subclasses
 void linkGraphics(java.awt.Graphics2D g)
           
 void move(Arena a, Entity[] others, int nbagents, java.awt.Graphics2D g)
          The Arena does not move.
 void paint(java.awt.Graphics2D g)
          Paints the Arena and the ticks around
private  void paintTimeSteps(java.awt.Graphics2D g, int timeSteps)
           
 void paintWithTimeSteps(java.awt.Graphics2D g, int timeSteps)
          Paint the Arena with the indication of the Time Steps
 
Methods inherited from class simuLCS.Entity
clear, getColor_ext, getColor_int, getCoord, getId, getName, getSize, isPaintName, setColor_ext, setColor_int, setName, setPaintName, setSize, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sizeGrad

private static final int sizeGrad
See Also:
Constant Field Values

graphics

private java.awt.Graphics2D graphics

shift

private int shift
Constructor Detail

Arena

public Arena(int s,
             int sh)
Method Detail

linkGraphics

public void linkGraphics(java.awt.Graphics2D g)
Parameters:
g -

paint

public void paint(java.awt.Graphics2D g)
Paints the Arena and the ticks around

Overrides:
paint in class Entity

paintTimeSteps

private void paintTimeSteps(java.awt.Graphics2D g,
                            int timeSteps)

paintWithTimeSteps

public void paintWithTimeSteps(java.awt.Graphics2D g,
                               int timeSteps)
Paint the Arena with the indication of the Time Steps

Parameters:
g -
timeSteps -

getRadius

public double getRadius()

getRadiusBody

public double getRadiusBody()
Overrides:
getRadiusBody in class Entity

getShift

public int getShift()

isInside

public boolean isInside(double x,
                        double y,
                        double radiusBody)
Returns true if the circle whose center is the point (x,y) and whose radius is radiusBody is colliding with the Arena

Parameters:
x -
y -
radiusBody -
Returns:

collideWithMe

public boolean collideWithMe(Agent a)
Returns true if Agent a collides with the Arena

Overrides:
collideWithMe in class Entity
Parameters:
a -
Returns:

distanceTo

public double distanceTo(java.awt.geom.Point2D p)
Calculates the distance between a point and the arena

Overrides:
distanceTo in class Entity
Parameters:
p - Point inside the arena
Returns:
the distance between the point and the closest wall

closestPointTo

public java.awt.geom.Point2D closestPointTo(java.awt.geom.Point2D p,
                                            double radiusArenaToConsider)
Gives the closest point of the Wall to a given point

Parameters:
p -
radiusArenaToConsider -
Returns:

closestPointTo

public java.awt.geom.Point2D closestPointTo(java.awt.geom.Point2D p)
Returns the point of the arena which is the closest to p. If p = 0,0 - no closest point, functions returns the NORTH one (arbitrary)

Parameters:
p - the point2D
Returns:
closest Point2D of the arena, - NORTH point if no closest

getCoordNearTo

public java.awt.geom.Point2D getCoordNearTo(Entity otherEntity)
For the arena, the coordinates used to get the vector are the coordinates of the closest point of the arena

Overrides:
getCoordNearTo in class Entity

isDangerous

public boolean isDangerous()
By convention, the Arena is dangerous.

Specified by:
isDangerous in class Entity
Returns:

isMoving

public boolean isMoving()
Description copied from class: Entity
Should be defined by subclasses

Specified by:
isMoving in class Entity
Returns:

move

public void move(Arena a,
                 Entity[] others,
                 int nbagents,
                 java.awt.Graphics2D g)
The Arena does not move.

Specified by:
move in class Entity
Parameters:
a - The Arena inside which to move
g - Graphics
See Also:
Entity.move(Arena,Entity[], int, java.awt.Graphics2D)