2 * Copyright (c) 2002 Erik Rasmussen - All Rights Reserved
9 * This class represents an object that can be picked up in the appletbots
12 * @author Erik Rasmussen
14 public abstract class CarriableObject
extends WorldObject
17 * The agent carrying the object
19 private CarrierAgent carriedBy
;
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
);
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;
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
;
55 * Returns the agent carrying the object
57 * @return The agent carrying the object
59 public CarrierAgent
getCarriedBy()