ballWorlds
Interface WorldDescriber

All Superinterfaces:
Drawable
All Known Subinterfaces:
World
All Known Implementing Classes:
VisibleWorld, WorldWithManyThreads, WorldWithTwoOrThreeThreads

public interface WorldDescriber
extends Drawable

A WorldDescriber is an object that can describe (return) attributes about itself like its middle point, its Color and Shape (inherited from Drawable), and how an object that has gone outside of this World should bounce.

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

Method Summary
 List<World> getAllWorlds()
          Returns a List that contains all the Worlds in the Universe.
 World getAnotherWorld()
          Returns a random other World (or this World if it is the only one).
 boolean isInsideWorldX(Point2D p)
          Returns true if the given point's x-coordinate is inside this World.
 boolean isInsideWorldY(Point2D p)
          Returns true if the given point's y-coordinate is inside this World.
 Point2D middleOfWorld()
          Returns a Point2D that is at the middle of this World.
 Point2D randomPointInWorld()
          Returns a Point2D that is a random point in this World.
 
Methods inherited from interface ballWorlds.Drawable
getColor, getShape
 

Method Detail

middleOfWorld

Point2D middleOfWorld()
Returns a Point2D that is at the middle of this World.

Returns:
a Point2D that is at the middle of this World.

randomPointInWorld

Point2D randomPointInWorld()
Returns a Point2D that is a random point in this World.

Returns:
a Point2D that is a random point in this World.

isInsideWorldX

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

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

isInsideWorldY

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

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

getAnotherWorld

World getAnotherWorld()
Returns a random other World (or this World if it is the only one).

Returns:
a random other World (or this World if it is the only one).

getAllWorlds

List<World> getAllWorlds()
Returns a List that contains all the Worlds in the Universe. Each call to this method returns a fresh List object that contains all the World objects known to this World independently from any other List objects in use at the same time. This allows the caller to safely iterate through this List without fear of it being concurrently modified by other Threads (and possibly generating a ConcurrentModification exception).

Returns:
a List that contains all the Worlds in this Universe.