com.webkitchen.brainathlon.gameComponents
Class Player

java.lang.Object
  extended by com.webkitchen.brainathlon.gameComponents.Player
All Implemented Interfaces:
IRawSampleListener, IChannelSampleGenerator, java.util.EventListener

public class Player
extends java.lang.Object
implements IRawSampleListener, IChannelSampleGenerator

A person playing the game


Constructor Summary
Player(int playerNumber, PlayerData playerData)
          Creates a new player with the given number, name, channels and midi instrument selection
Player(int playerNumber, java.lang.String firstName, int[] channels, java.lang.Integer instrument)
          Creates a new player with the given number, name, channels and midi instrument selection
 
Method Summary
 void addSampleListener(IChannelSampleListener listener)
          Attach listener to receive notification/copies of all new Samples
 int[] getChannels()
           
 java.lang.String getFirstName()
           
 java.lang.Integer getInstrument()
           
 int getPlayerNumber()
           
 void receiveSample(RawSample rawSample)
          Receive the raw sample, and pass it's value along to our listeners
 void removeAllSampleListeners()
          Remove all listeners from our notification list
 void removeSampleListener(IChannelSampleListener listener)
          Remove listener from our notification list
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(int playerNumber,
              PlayerData playerData)
Creates a new player with the given number, name, channels and midi instrument selection

Parameters:
playerNumber - 1 or 2
playerData - contains the player's name, channels and midi instrument selection

Player

public Player(int playerNumber,
              java.lang.String firstName,
              int[] channels,
              java.lang.Integer instrument)
Creates a new player with the given number, name, channels and midi instrument selection

Parameters:
playerNumber - 1 or 2
firstName - the player's first name
channels - the channels that the player is hooked up to
instrument - the midi instrument number that the player selected
Method Detail

getPlayerNumber

public int getPlayerNumber()

getFirstName

public java.lang.String getFirstName()

getChannels

public int[] getChannels()

getInstrument

public java.lang.Integer getInstrument()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

receiveSample

public void receiveSample(RawSample rawSample)
Receive the raw sample, and pass it's value along to our listeners

Specified by:
receiveSample in interface IRawSampleListener
Parameters:
rawSample - our latest EEG raw sample

addSampleListener

public void addSampleListener(IChannelSampleListener listener)
Attach listener to receive notification/copies of all new Samples

Specified by:
addSampleListener in interface IChannelSampleGenerator
Parameters:
listener - the observer who wants to receive Samples

removeSampleListener

public void removeSampleListener(IChannelSampleListener listener)
Remove listener from our notification list

Specified by:
removeSampleListener in interface IChannelSampleGenerator
Parameters:
listener - the observer to remove

removeAllSampleListeners

public void removeAllSampleListeners()
Remove all listeners from our notification list

Specified by:
removeAllSampleListeners in interface IChannelSampleGenerator