Breakout Problem Set Javadocs

breakout
Class BasicPaddle

java.lang.Object
  extended bybreakout.BasicPaddle
All Implemented Interfaces:
BreakoutComponent, java.util.EventListener, java.awt.event.MouseMotionListener, Paddle

public class BasicPaddle
extends java.lang.Object
implements Paddle, java.awt.event.MouseMotionListener

A basic implementation of the Paddle interface.


Field Summary
protected  Board board
          The Board containing this BasicPaddle
protected  int eastmost
          Rightmost point able to be occupied by this BasicPaddle.
protected  java.awt.Point location
          The location of this BasicPaddle.
protected  java.awt.Dimension size
          The size of this BasicPaddle.
protected  int westmost
          Leftmost point able to be occupied by this BasicPaddle.
 
Constructor Summary
BasicPaddle(Board b)
          Creates a BasicPaddle of a default size and location, belonging to a specified Board.
 
Method Summary
 java.awt.Point getLocation()
          Gets the current location of this BasicPaddle.
 java.awt.Shape getShape()
          Gets the java.awt.Shape of this BasicPaddle.
 java.awt.Dimension getSize()
          Gets the size of this BasicPaddle.
 boolean hit(BreakoutComponent bc)
          Called by a Rebounding BreakoutComponent when it has detected an intersection with this BasicPaddle.
 void mouseDragged(java.awt.event.MouseEvent me)
          (unused)
 void mouseMoved(java.awt.event.MouseEvent me)
          Listens to mouse movements, and sets the x-coordinate of the BasicPaddle accordingly.
 void paint(java.awt.Graphics g)
          Paints the BasicPaddle.
 void setLocation(java.awt.Point p)
          Inactive.
 void update()
          Called by World every tick; does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

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


location

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


board

protected Board board
The Board containing this BasicPaddle


westmost

protected final int westmost
Leftmost point able to be occupied by this BasicPaddle.


eastmost

protected final int eastmost
Rightmost point able to be occupied by this BasicPaddle.

Constructor Detail

BasicPaddle

public BasicPaddle(Board b)
Creates a BasicPaddle of a default size and location, belonging to a specified Board.

Parameters:
b - the Board object of which this BasicPaddle is a member.
Method Detail

setLocation

public void setLocation(java.awt.Point p)
Inactive. BasicPaddle manages its own location.

Specified by:
setLocation in interface BreakoutComponent

getLocation

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

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

getSize

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

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

update

public void update()
Called by World every tick; 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 BasicPaddle.

Specified by:
hit in interface BreakoutComponent
Parameters:
bc - the Rebounding/BreakoutComponent object that detected the hit.
Returns:
false -- a BasicPaddle doesn't die when hit.

getShape

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

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

paint

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

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

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
(unused)

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
Listens to mouse movements, and sets the x-coordinate of the BasicPaddle accordingly. Keeps the BasicPaddle between this.westmost and this.eastmost.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

Breakout Problem Set Javadocs