fi.utu.cs.asteroids
Class Decoration

java.lang.Object
  |
  +--fi.utu.cs.physics.Body
        |
        +--fi.utu.cs.physics.MomentaryBody
              |
              +--fi.utu.cs.asteroids.Decoration
All Implemented Interfaces:
Shapable
Direct Known Subclasses:
Debris, Spark

public abstract class Decoration
extends MomentaryBody
implements Shapable

An ethereal body which has a zero mass and finite lifetime.


Constructor Summary
protected Decoration(double r, double lt)
          Constructs a decoration with the radius r and the lifetime lt.
protected Decoration(double r, double lt, Point2 p)
          Constructs a decoration with the radius r, the lifetime lt and the position p.
protected Decoration(double r, double lt, Point2 p, Vector2 v)
          Constructs a decoration with the radius r, the lifetime lt, the position p and the velocity v.
protected Decoration(double r, double lt, Point2 p, Vector2 v, Vector2 a)
          Constructs a decoration with the radius r, the lifetime lt, the position p, the velocity v and the acceleration a.
 
Method Summary
abstract  java.awt.Color color()
          Returns a Color object that is used for drawing the outline.
 void die()
          Removes the body from the universe that owns it.
abstract  boolean isDrawn()
          Returns a boolean value indicating whether the outline of the shape is drawn or not.
abstract  boolean isFilled()
          Returns a boolean value indicating whether the shape is filled or not.
abstract  java.awt.Paint paint()
          Returns a Paint object that is used for filling the shape.
abstract  java.awt.Shape shape()
          Returns a Shape object that defines the appearance of the object.
abstract  java.awt.Stroke stroke()
          Returns a Stroke object that is used for drawing the outline.
 
Methods inherited from class fi.utu.cs.physics.MomentaryBody
advance, getLifetime, setLifetime
 
Methods inherited from class fi.utu.cs.physics.Body
elasticCollision, getAcceleration, getMass, getOwner, getPosition, getRadius, getVelocity, isColliding, isCorporeal, isOverlapping, setAcceleration, setAcceleration, setCorporeal, setEthereal, setMass, setOwner, setPosition, setPosition, setRadius, setVelocity, setVelocity, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Decoration

protected Decoration(double r,
                     double lt)
Constructs a decoration with the radius r and the lifetime lt. The decoration resides in the origin and has a zero velocity and a zero acceleration. The decoration has no owner.

Decoration

protected Decoration(double r,
                     double lt,
                     Point2 p)
Constructs a decoration with the radius r, the lifetime lt and the position p. The decoration has a zero velocity and a zero acceleration. The decoration has no owner.

Decoration

protected Decoration(double r,
                     double lt,
                     Point2 p,
                     Vector2 v)
Constructs a decoration with the radius r, the lifetime lt, the position p and the velocity v. The decoration has a zero acceleration. The decoration has no owner.

Decoration

protected Decoration(double r,
                     double lt,
                     Point2 p,
                     Vector2 v,
                     Vector2 a)
Constructs a decoration with the radius r, the lifetime lt, the position p, the velocity v and the acceleration a. The decoration has no owner.
Method Detail

die

public void die()
Removes the body from the universe that owns it.
Overrides:
die in class MomentaryBody

shape

public abstract java.awt.Shape shape()
Description copied from interface: Shapable
Returns a Shape object that defines the appearance of the object.
Specified by:
shape in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shape

isDrawn

public abstract boolean isDrawn()
Description copied from interface: Shapable
Returns a boolean value indicating whether the outline of the shape is drawn or not.
Specified by:
isDrawn in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shapable.stroke(), Shapable.color()

stroke

public abstract java.awt.Stroke stroke()
Description copied from interface: Shapable
Returns a Stroke object that is used for drawing the outline.
Specified by:
stroke in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shapable.isDrawn(), Stroke

color

public abstract java.awt.Color color()
Description copied from interface: Shapable
Returns a Color object that is used for drawing the outline.
Specified by:
color in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shapable.isDrawn(), Color

isFilled

public abstract boolean isFilled()
Description copied from interface: Shapable
Returns a boolean value indicating whether the shape is filled or not.
Specified by:
isFilled in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shapable.paint()

paint

public abstract java.awt.Paint paint()
Description copied from interface: Shapable
Returns a Paint object that is used for filling the shape.
Specified by:
paint in interface Shapable
Following copied from interface: fi.utu.cs.appearance.Shapable
See Also:
Shapable.isFilled(), Paint