initial commit
[applet-bots.git] / src / appletbots / CarriableObject.java
blob8ef4088b70a111d88078a84aced4293c549cc7fa
1 /*
2 * Copyright (c) 2002 Erik Rasmussen - All Rights Reserved
3 */
4 package appletbots;
6 import java.awt.*;
8 /**
9 * This class represents an object that can be picked up in the appletbots
10 * world.
12 * @author Erik Rasmussen
14 public abstract class CarriableObject extends WorldObject
16 /**
17 * The agent carrying the object
19 private CarrierAgent carriedBy;
21 /**
22 * Creates a new CarriableObject with the given parameters
24 * @param mass The object's mass
25 * @param maxSpeed The object's maximum speed
26 * @param size The object's radius
27 * @param color The object's color
29 public CarriableObject(final double mass, final double maxSpeed, final int size, final Color color)
31 super(mass, maxSpeed, size, color);
34 /**
35 * Returns whether or not the object is being carried
37 * @return Whether or not the object is being carried
39 public boolean isCarried()
41 return carriedBy != null;
44 /**
45 * Informs the object about who is carrying it
47 * @param carriedBy The agent carrying the object
49 public void setCarriedBy(final CarrierAgent carriedBy)
51 this.carriedBy = carriedBy;
54 /**
55 * Returns the agent carrying the object
57 * @return The agent carrying the object
59 public CarrierAgent getCarriedBy()
61 return carriedBy;