gizmoball.board
Class Absorber

java.lang.Object
  extended by gizmoball.board.Gizmo
      extended by gizmoball.board.Absorber

public class Absorber
extends Gizmo

This class represents an absorber gizmo that extends the abstract gizmo class. When a ball hits an Absorber object, the absorber absorbs the ball and shoots it from its right side.

Author:
Michal Wexler

Field Summary
 
Fields inherited from class gizmoball.board.Gizmo
color, connections, name, reverseConnections
 
Constructor Summary
Absorber(java.lang.String name, java.awt.Color color, Polygon poly, Vect launchVelocity, GizmoBoard board)
          Constructs a new Absorber gizmo.
 
Method Summary
 void absorbBall(Ball b)
          absorbs a ball
 void action()
          executes the action of the Absorber which is to shoot balls that are absorbed in it.
 java.util.List<Ball> getBalls()
          returns the balls that the absorbers have.
 Polygon getShape()
          returns the shape of the absorber.
 void triggerConnections(Ball b)
          overrides the triggerConnection of Gizmo
 
Methods inherited from class gizmoball.board.Gizmo
getColor, getName, getTriggeredGizmos, getTriggeringGizmos, setColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Absorber

public Absorber(java.lang.String name,
                java.awt.Color color,
                Polygon poly,
                Vect launchVelocity,
                GizmoBoard board)
Constructs a new Absorber gizmo.

Parameters:
name - the name of the absorber
color - the color of the absorber
poly - the shape of the absorber
launchVelocity - velocity of a ball when launched
board - the board the absorber is being added to
Method Detail

getShape

public Polygon getShape()
returns the shape of the absorber.

Overrides:
getShape in class Gizmo
Returns:
the shape of the absorber

getBalls

public java.util.List<Ball> getBalls()
returns the balls that the absorbers have.

Returns:
the balls that the absorbers have

absorbBall

public void absorbBall(Ball b)
absorbs a ball

Parameters:
b - ball

triggerConnections

public void triggerConnections(Ball b)
overrides the triggerConnection of Gizmo

Overrides:
triggerConnections in class Gizmo
Parameters:
b - ball

action

public void action()
executes the action of the Absorber which is to shoot balls that are absorbed in it.

Overrides:
action in class Gizmo