ballworlds.framework
Interface BallEnvironment

All Known Implementing Classes:
World

public interface BallEnvironment

A BallEnvironment manages the Balls in an associated World. It does so by providing methods that allow Balls to be added and removed to that World, along with other methods that relate to those Balls.

Author:
David Mutchler, Salman Azhar and others, January 2005. Modified September, 2008.

Method Summary
 void addBall(Ball ballToAdd)
          Adds the given Ball to this BallEnvironment's World.
 boolean isInsideWorldX(Point2D p)
          Returns true if the given point's x-coordinate is inside this BallEnvironment's World.
 boolean isInsideWorldY(Point2D p)
          Returns true if the given point's y-coordinate is inside this BallEnvironment's World.
 Point2D middleOfWorld()
          Returns a new Point2D that is at the middle of this BallEnvironment's World.
 void removeBall(Ball ballToRemove)
          Removes the given Ball from this BallEnvironment's World.
 

Method Detail

addBall

void addBall(Ball ballToAdd)
Adds the given Ball to this BallEnvironment's World.

Parameters:
ballToAdd - the Ball to add to this BallEnvironment's World

removeBall

void removeBall(Ball ballToRemove)
Removes the given Ball from this BallEnvironment's World.

Parameters:
ballToRemove - the Ball to remove from this BallEnvironment's World

isInsideWorldX

boolean isInsideWorldX(Point2D p)
Returns true if the given point's x-coordinate is inside this BallEnvironment's World.

Parameters:
p - the point whose x-coordinate to check
Returns:
true if the given point's x-coordinate is inside this BallEnvironment's World

isInsideWorldY

boolean isInsideWorldY(Point2D p)
Returns true if the given point's y-coordinate is inside this BallEnvironment's World.

Parameters:
p - the point whose y-coordinate to check
Returns:
true if the given point's y-coordinate is inside this BallEnvironment's World

middleOfWorld

Point2D middleOfWorld()
Returns a new Point2D that is at the middle of this BallEnvironment's World.

Returns:
a new Point2D that is at the middle of this BallEnvironment's World