appletbots
Class WorldObject

java.lang.Object
  extended by appletbots.WorldObject
Direct Known Subclasses:
Agent, Ball, CarriableObject

public abstract class WorldObject
extends java.lang.Object

This is an abstract class representing an object in the world

Author:
Erik Rasmussen

Field Summary
protected  java.awt.Color color
          The object's color
protected  double mass
          The object's mass
protected  double maxSpeed
          The object's maximum speed
protected  int size
          The object's radius
 
Constructor Summary
WorldObject(double mass, double maxSpeed, int size, java.awt.Color color)
          Creates a new WorldObject with the given parameters
 
Method Summary
 void collidedWith(WorldObject object)
          Informs the object that it has been in a collision
 java.awt.Color getColor()
          Returns the object's color
 double getMass()
          Returns the object's mass
 double getMaxSpeed()
          Returns the object's maximum speed
 int getSize()
          Returns the object's radius
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mass

protected double mass
The object's mass


maxSpeed

protected double maxSpeed
The object's maximum speed


size

protected int size
The object's radius


color

protected java.awt.Color color
The object's color

Constructor Detail

WorldObject

public WorldObject(double mass,
                   double maxSpeed,
                   int size,
                   java.awt.Color color)
Creates a new WorldObject with the given parameters

Parameters:
mass - The object's mass
maxSpeed - The object's maximum speed
size - The object's radius
color - The object's color
Method Detail

getMass

public final double getMass()
Returns the object's mass

Returns:
The object's mass

getMaxSpeed

public final double getMaxSpeed()
Returns the object's maximum speed

Returns:
The object's maximum speed

getSize

public final int getSize()
Returns the object's radius

Returns:
The object's radius

getColor

public final java.awt.Color getColor()
Returns the object's color

Returns:
The object's color

collidedWith

public void collidedWith(WorldObject object)
Informs the object that it has been in a collision

Parameters:
object - The object collided with