fixed source code links to go to repo.or.cz repository
[applet-bots.git] / src / appletbots / WorldObject.java
blobc458a6a86fa03f8a5e481248c2b73c9c17d2645a
1 /*
2 * Copyright (c) 2002 Erik Rasmussen - All Rights Reserverd
3 */
4 package appletbots;
6 import java.awt.*;
8 /**
9 * This is an abstract class representing an object in the world
11 * @author Erik Rasmussen
13 public abstract class WorldObject
15 /**
16 * The object's mass
18 protected double mass;
19 /**
20 * The object's maximum speed
22 protected double maxSpeed;
23 /**
24 * The object's radius
26 protected int size;
27 /**
28 * The object's color
30 protected Color color;
32 /**
33 * Creates a new WorldObject with the given parameters
35 * @param mass The object's mass
36 * @param maxSpeed The object's maximum speed
37 * @param size The object's radius
38 * @param color The object's color
40 public WorldObject(final double mass, final double maxSpeed, final int size, final Color color)
42 this.mass = mass;
43 this.maxSpeed = maxSpeed;
44 this.size = size;
45 this.color = color;
48 /**
49 * Returns the object's mass
51 * @return The object's mass
53 public final double getMass()
55 return mass;
58 /**
59 * Returns the object's maximum speed
61 * @return The object's maximum speed
63 public final double getMaxSpeed()
65 return maxSpeed;
68 /**
69 * Returns the object's radius
71 * @return The object's radius
73 public final int getSize()
75 return size;
78 /**
79 * Returns the object's color
81 * @return The object's color
83 public final Color getColor()
85 return color;
88 /**
89 * Informs the object that it has been in a collision
91 * @param object The object collided with
93 public void collidedWith(final WorldObject object)