com.webkitchen.brainathlon.gameControl
Class AbstractCourse

java.lang.Object
  extended by com.webkitchen.brainathlon.gameControl.AbstractCourse
All Implemented Interfaces:
java.awt.event.WindowListener, java.util.EventListener
Direct Known Subclasses:
AbstractBandCourse, DualBandRatioCourse, SimpleDisplayCourse

public abstract class AbstractCourse
extends java.lang.Object
implements java.awt.event.WindowListener

Contains the generic logic for all Brainathlon courses


Nested Class Summary
protected  class AbstractCourse.AbstractPlayerMonitor
          AbstractPlayerMonitor monitors and scores a given Player's brainwave activity
 
Field Summary
protected  boolean announceCourse
           
protected  boolean courseOver
           
protected  CourseOverUI courseOverUI
           
protected  java.lang.String courseTitle
           
protected  AbstractCourseUI courseUI
           
protected  PlayerMonitorList playerMonitorList
           
protected  java.util.List<Player> players
           
protected  boolean running
           
protected  Range scoreRange
           
protected  boolean timedCourse
           
protected  int timeInCourse
           
protected  int timeLimit
           
protected  Player winner
           
 
Constructor Summary
AbstractCourse(java.util.List<Player> players)
           
 
Method Summary
protected  void attachAsListener(java.awt.Window window)
          Subclasses should all use this to listen for window events that we need to handle
protected abstract  void attachMonitors()
           
protected abstract  void createCoefficients(FilterDesigner designer)
           
protected  void designFilters()
          Designs IIR filter coefficients if they weren't specified in the configuration file
protected static void dumpCoefficients(java.lang.String name, double[] coef)
           
protected abstract  AbstractCourseUI getCourseUI()
           
 FinalScore getFinalScore()
           
 int getFinishTime()
           
abstract  PlayerMonitorList getPlayerMonitorList()
           
 Range getScoreRange()
           
 java.lang.String getTitle()
           
 Player getWinner()
           
protected abstract  boolean needCoeffients()
           
protected  void playerWon(Player player)
          Set the winner
 void start()
          Start the game, and do not return until the game is finished
 void stop()
           
protected  void tick()
          Called after timeInCourse is updated, subclasses should override to add timing-based game functionality
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

players

protected java.util.List<Player> players

winner

protected Player winner

running

protected boolean running

courseOver

protected boolean courseOver

timedCourse

protected boolean timedCourse

announceCourse

protected boolean announceCourse

timeInCourse

protected int timeInCourse

timeLimit

protected int timeLimit

playerMonitorList

protected PlayerMonitorList playerMonitorList

courseOverUI

protected CourseOverUI courseOverUI

courseUI

protected AbstractCourseUI courseUI

courseTitle

protected java.lang.String courseTitle

scoreRange

protected Range scoreRange
Constructor Detail

AbstractCourse

public AbstractCourse(java.util.List<Player> players)
Method Detail

getPlayerMonitorList

public abstract PlayerMonitorList getPlayerMonitorList()

attachMonitors

protected abstract void attachMonitors()

getCourseUI

protected abstract AbstractCourseUI getCourseUI()

needCoeffients

protected abstract boolean needCoeffients()

createCoefficients

protected abstract void createCoefficients(FilterDesigner designer)

designFilters

protected void designFilters()
Designs IIR filter coefficients if they weren't specified in the configuration file


start

public void start()
Start the game, and do not return until the game is finished


getScoreRange

public Range getScoreRange()

getFinalScore

public FinalScore getFinalScore()

getWinner

public Player getWinner()

getFinishTime

public int getFinishTime()

tick

protected void tick()
Called after timeInCourse is updated, subclasses should override to add timing-based game functionality


attachAsListener

protected void attachAsListener(java.awt.Window window)
Subclasses should all use this to listen for window events that we need to handle

Parameters:
window - the Window to listen to

playerWon

protected void playerWon(Player player)
Set the winner

Parameters:
player - the player who won

dumpCoefficients

protected static void dumpCoefficients(java.lang.String name,
                                       double[] coef)

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

stop

public void stop()

getTitle

public java.lang.String getTitle()