gizmoball.board
Class Gizmo

java.lang.Object
  extended by gizmoball.board.Gizmo
Direct Known Subclasses:
Absorber, Ball, Bumper, ExtenderGizmo, RotatingGizmo

public abstract class Gizmo
extends java.lang.Object

This class represents a gizmo object, with methods to add triggers and call an action. Each gizmo has a shape object that can be accessed. The class is abstract so that subclasses can specify the action function themselves and determine the behavior of the gizmo.

Author:
Michal Wexler

Field Summary
protected  java.awt.Color color
           
protected  java.util.ArrayList<Gizmo> connections
           
protected  java.lang.String name
           
protected  java.util.ArrayList<Gizmo> reverseConnections
           
 
Constructor Summary
Gizmo()
           
 
Method Summary
 void action()
          executes the action that this gizmo.
 java.awt.Color getColor()
          returns the color of the gizmo.
 java.lang.String getName()
          returns the name of the gizmo.
 Shape getShape()
          returns the shape of the gizmo.
 java.util.List<Gizmo> getTriggeredGizmos()
          returns a list of gizmos that this gizmo triggers.
 java.util.List<Gizmo> getTriggeringGizmos()
          returns a list of gizmos that triggers this gizmo.
 void setColor(java.awt.Color color)
          sets the color of the gizmo to the color specified.
 void triggerConnections(Ball b)
          triggers all the gizmos that are connected to this gizmo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

color

protected java.awt.Color color

connections

protected java.util.ArrayList<Gizmo> connections

reverseConnections

protected java.util.ArrayList<Gizmo> reverseConnections
Constructor Detail

Gizmo

public Gizmo()
Method Detail

getName

public java.lang.String getName()
returns the name of the gizmo.

Returns:
name of the gizmo

setColor

public void setColor(java.awt.Color color)
sets the color of the gizmo to the color specified.

Parameters:
color - that the gizmo will have

getColor

public java.awt.Color getColor()
returns the color of the gizmo.

Returns:
color of the gizmo

getShape

public Shape getShape()
returns the shape of the gizmo.

Returns:
shape of the gizmo

getTriggeredGizmos

public java.util.List<Gizmo> getTriggeredGizmos()
returns a list of gizmos that this gizmo triggers.

Returns:
a list of gizmos that this gizmo triggers

getTriggeringGizmos

public java.util.List<Gizmo> getTriggeringGizmos()
returns a list of gizmos that triggers this gizmo.

Returns:
a list of gizmos that triggers this gizmo

triggerConnections

public void triggerConnections(Ball b)
triggers all the gizmos that are connected to this gizmo.

Parameters:
b - the balls that triggers this gizmo

action

public void action()
executes the action that this gizmo. Subclasses of Gizmo will override this method.