The Physiologist's Friend Simulation API

ch.unizh.ini.friend.record
Class SimulationReporter

java.lang.Object
  extended by ch.unizh.ini.friend.simulation.AbstractAcceptsInput
      extended by ch.unizh.ini.friend.simulation.AbstractMonitor
          extended by ch.unizh.ini.friend.record.SimulationReporter
All Implemented Interfaces:
SpikeEventSource, SpikeReporter, AcceptsInput, Updateable, Serializable

public class SimulationReporter
extends AbstractMonitor
implements SpikeReporter

Generates a SpikeEvent when it detects that the simulation's monitored cell has made a spike. An instance of this class is constructed in the SimulationSetupFactory for each simulation type (color, luminance, etc.) FriendGUI sets the monitored cell based on the user's menu choice of cell, and when recording is activated, it adds listeners for the appropriate monitor. #see SpikeReporter

Version:
$Revision: 1.3 $
Author:
$Author: tobi $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ch.unizh.ini.friend.simulation.AbstractAcceptsInput
inputs
 
Constructor Summary
SimulationReporter(SimulationSetup setup)
          Creates a new instance of SpikeEventMonitor
 
Method Summary
 void addSpikeListener(SpikeListener listener)
          add a listener for all spikes.
 void clearSpikeListeners()
          remove all listeners
 void compute(float dt)
          Computes the new state of this component of the simulation.
 Collection getSpikeListeners()
           
 boolean isReporting()
           
 void removeSpikeListener(SpikeListener listener)
          removes a listener
 void startReporting()
          starts acquisition of spikes and generation of SpikeEvent's.
 void stopReporting()
          removes all spike event listeners, ends thread after first stopping microphone acquisition.
 
Methods inherited from class ch.unizh.ini.friend.simulation.AbstractMonitor
getInput, getInputs, setInput, setInputs, update
 
Methods inherited from class ch.unizh.ini.friend.simulation.AbstractAcceptsInput
averageInputs, cloneObject, connectOneToAll, connectOneToOne, getCollectionInstance, integrateInputs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulationReporter

public SimulationReporter(SimulationSetup setup)
Creates a new instance of SpikeEventMonitor

Method Detail

compute

public void compute(float dt)
Computes the new state of this component of the simulation.

Specified by:
compute in interface Updateable
Parameters:
dt - The time that has passed since the last invocation.

addSpikeListener

public void addSpikeListener(SpikeListener listener)
add a listener for all spikes. Listeners are called when a spike occurs and are passed a SpikeEvent.

Specified by:
addSpikeListener in interface SpikeEventSource
Parameters:
listener - the listener

clearSpikeListeners

public void clearSpikeListeners()
remove all listeners

Specified by:
clearSpikeListeners in interface SpikeEventSource

getSpikeListeners

public Collection getSpikeListeners()
Specified by:
getSpikeListeners in interface SpikeEventSource
Returns:
the Collection of listeners

removeSpikeListener

public void removeSpikeListener(SpikeListener listener)
removes a listener

Specified by:
removeSpikeListener in interface SpikeEventSource
Parameters:
listener - to remove

startReporting

public void startReporting()
starts acquisition of spikes and generation of SpikeEvent's. If source is not available it does nothing.

Specified by:
startReporting in interface SpikeReporter

stopReporting

public void stopReporting()
removes all spike event listeners, ends thread after first stopping microphone acquisition. This ends generation of SpikeEvent's

Specified by:
stopReporting in interface SpikeReporter

isReporting

public boolean isReporting()
Specified by:
isReporting in interface SpikeReporter
Returns:
whether reporting is enabled

http://www.ini.unizh.ch/~tobi/friend