Class MoveableObject

java.lang.Object
  extended by BoxedBallsObject
      extended by MoveableObject
Direct Known Subclasses:
Ball, Ball2

public class MoveableObject
extends BoxedBallsObject

Parent class for all moveable objects. It inherits the properties of BoxedBallsObject. All moveable objects have a mass and a velocity


Constructor Summary
MoveableObject()
           
MoveableObject(String s, Color c, double m, double vx, double vy)
          creates a moveable object
 
Method Summary
 Color getColor()
          method getColor() overwrides getColor in BoxedBallsObject.
 double getMass()
           
 double getXVelocity()
           
 double getYVelocity()
           
 void setMass(double newMass)
           
 void setVelocity(double newXVelocity, double newYVelocity)
           
 
Methods inherited from class BoxedBallsObject
getName, setColor, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveableObject

public MoveableObject()

MoveableObject

public MoveableObject(String s,
                      Color c,
                      double m,
                      double vx,
                      double vy)
creates a moveable object

Parameters:
s - name of class type string
c - color of class type color
m - mass of primitive type double
v - velocity of primitive type double
Method Detail

setVelocity

public void setVelocity(double newXVelocity,
                        double newYVelocity)

setMass

public void setMass(double newMass)

getXVelocity

public double getXVelocity()

getYVelocity

public double getYVelocity()

getMass

public double getMass()

getColor

public Color getColor()
method getColor() overwrides getColor in BoxedBallsObject. It will be overwridden again in Ball so that the color can be used as input for method draw().

Overrides:
getColor in class BoxedBallsObject