Breakout Problem Set Javadocs

breakout
Class BasicBrick

java.lang.Object
  extended bybreakout.BasicBrick
All Implemented Interfaces:
BreakoutComponent, Brick
Direct Known Subclasses:
ConfettiBrick, HitpointsBrick, PurpleBrick, RoundBrick

public class BasicBrick
extends java.lang.Object
implements Brick

A basic implementation of the Brick interface.


Field Summary
protected  java.awt.Point location
          The location of this BasicBrick.
protected  java.awt.Dimension size
          The size of this BasicBrick.
 
Constructor Summary
BasicBrick(int width, int height)
          Creates a new BasicBrick of the specified dimensions.
 
Method Summary
 java.awt.Point getLocation()
          Gets the location of this BasicBrick.
 java.awt.Shape getShape()
          Gets the java.awt.Shape of this BasicBrick.
 java.awt.Dimension getSize()
          Gets the size of this BasicBrick.
 boolean hit(BreakoutComponent bc)
          Called by a Rebounding BreakoutComponent when it has detected an intersection with this BasicBrick.
 void paint(java.awt.Graphics g)
          Paints the BasicBrick.
 void setLocation(java.awt.Point p)
          Sets the location of this BasicBrick.
 void update()
          Called by World every tick; by default does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

protected java.awt.Point location
The location of this BasicBrick.


size

protected java.awt.Dimension size
The size of this BasicBrick.

Constructor Detail

BasicBrick

public BasicBrick(int width,
                  int height)
Creates a new BasicBrick of the specified dimensions.

Parameters:
width - The intended width of the BasicBrick.
height - The intended height of the BasicBrick.
Method Detail

setLocation

public void setLocation(java.awt.Point p)
Sets the location of this BasicBrick.

Specified by:
setLocation in interface BreakoutComponent
Parameters:
p - a Point object representing the intended location of this BasicBrick.

getLocation

public java.awt.Point getLocation()
Gets the location of this BasicBrick.

Specified by:
getLocation in interface BreakoutComponent
Returns:
a new Point object representing the location of this BasicBrick.

getSize

public java.awt.Dimension getSize()
Gets the size of this BasicBrick.

Specified by:
getSize in interface BreakoutComponent
Returns:
a new Dimension object representing the size of this BasicBrick.

update

public void update()
Called by World every tick; by default does nothing.

Specified by:
update in interface BreakoutComponent

hit

public boolean hit(BreakoutComponent bc)
Called by a Rebounding BreakoutComponent when it has detected an intersection with this BasicBrick.

Specified by:
hit in interface BreakoutComponent
Parameters:
bc - the Rebounding/BreakoutComponent object that detected the intersection.
Returns:
true -- a BasicBrick dies when it is hit.

getShape

public java.awt.Shape getShape()
Gets the java.awt.Shape of this BasicBrick.

Specified by:
getShape in interface BreakoutComponent
Returns:
a new Shape label at the same location and of the same size/shape as this BasicBrick.

paint

public void paint(java.awt.Graphics g)
Paints the BasicBrick.

Specified by:
paint in interface BreakoutComponent
Parameters:
g - Graphics object for this ball's coordinate frame(ie, already located where we are).
See Also:
BoardPanel

Breakout Problem Set Javadocs