The Physiologist's Friend Simulation API

ch.unizh.ini.friend.simulation
Class SimulationSetup

java.lang.Object
  extended by ch.unizh.ini.friend.simulation.SimulationSetup

public class SimulationSetup
extends Object

A collection of references to objects that together describe the current state of the simulation.

The collection of fidicial cells (cells that can monitored) is built by SimulationSetupFactory. These cells are entered into a HsshMap. You can get a particular cell by the key name it was stored under, using getOutputCell(java.lang.String), or you can get at the entire list with getOutputCells(). You can set the cell to monitor with setMonitoredCell(java.lang.String).

Version:
$Revision: 1.31 $
Author:
Christof Marti

Nested Class Summary
 class SimulationSetup.NoSuchCellException
          indicates we tried to monitor a nonexistent cell
 
Field Summary
protected  ServesOutput monitoredCell
          the monitored cell.
protected  Map monitors
          Monitors that can be configured to listen to a specific cell.
protected  Collection offGanglions
          the off-type ganglion cells
protected  Collection onGanglions
          the on-type ganglion cells
protected  Map outputCells
          The cells that can be monitored.
protected  ArrayList receptorShapes
          The shapes of the photoreceptors.
protected  List simulatedCells
          The cells that are simulated.
protected  SimulationTask simulation
          The simulation.
protected  String startingCellName
          The cell which is monitored first.
protected  Stimulus stimulus
          The stimulus.
 
Constructor Summary
SimulationSetup()
           
 
Method Summary
 AcceptsInput getMonitor(String key)
          returns a particlar monitor by its key.
 ServesOutput getMonitoredCell()
          returns the monitored cell
 Map getMonitors()
          Returns the monitors that are currently registered.
 String getName()
           
 Collection getOffGanglions()
          Return the retinal ganglion off-type cells
 Collection getOnGanglions()
          Return the retinal ganglion on-type cells
 Object getOutputCell(String key)
          returns a particlar output cell by its key.
 Map getOutputCells()
          Returns the cells that can be monitored (listened to).
 ArrayList getReceptorShapes()
          Returns the shapes of the photoreceptors.
 List getSimulatedCells()
          Returns the cells that are simulated
 SimulationTask getSimulation()
          Returns the current simulation instance.
 String getStartingCellName()
          Gets the starting cell name.
 Stimulus getStimulus()
          Returns the current stimulus instance.
 void putMonitor(String key, AcceptsInput monitor)
          put a an object into the monitors map.
 void putOutputCell(String key, Object cell)
          put a an object into the output cells map.
 void setMonitoredCell(ServesOutput cell)
          set the monitored cell in the simulation directly.
 void setMonitoredCell(String key)
          set the monitored cell in the simulation using the String key.
 void setMonitors(Map monitors)
          Sets the Map of monitors.
 void setName(String n)
           
 void setOffGanglions(Collection c)
           
 void setOnGanglions(Collection c)
           
 void setOutputCells(Map cells)
          Sets the cells that can be monitored (listened to).
 void setReceptorShapes(ArrayList receptorShapes)
          Sets the shapes of the photoreceptors.
 void setSimulatedCells(List cells)
          Sets the cells that are simulated
 void setSimulation(SimulationTask simulation)
          Sets the current simulation instance.
 void setStartingCellName(String startingCellName)
          Sets the starting cell Name.
 void setStimulus(Stimulus stimulus)
          Sets the current stimulus instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

simulation

protected SimulationTask simulation
The simulation.


stimulus

protected Stimulus stimulus
The stimulus.


simulatedCells

protected List simulatedCells
The cells that are simulated. This list is iterated over by a SimulationStep. It is an ArrayList.

See Also:
outputCells

outputCells

protected Map outputCells
The cells that can be monitored. We use tree map to keep entries sorted alphabetically for menu generation.

See Also:
see #setOutputCells

onGanglions

protected Collection onGanglions
the on-type ganglion cells


offGanglions

protected Collection offGanglions
the off-type ganglion cells


monitors

protected Map monitors
Monitors that can be configured to listen to a specific cell.


receptorShapes

protected ArrayList receptorShapes
The shapes of the photoreceptors.


monitoredCell

protected ServesOutput monitoredCell
the monitored cell.

See Also:
setMonitoredCell(java.lang.String)

startingCellName

protected String startingCellName
The cell which is monitored first.

Constructor Detail

SimulationSetup

public SimulationSetup()
Method Detail

getName

public String getName()
Returns:
the name; used for determining type of simulation

setName

public void setName(String n)
Parameters:
n - the name

getSimulation

public SimulationTask getSimulation()
Returns the current simulation instance.

Returns:
The simulation.

setSimulation

public void setSimulation(SimulationTask simulation)
Sets the current simulation instance.

Parameters:
simulation - The new simulation.

getStimulus

public Stimulus getStimulus()
Returns the current stimulus instance.

Returns:
The stimulus.

setStimulus

public void setStimulus(Stimulus stimulus)
Sets the current stimulus instance.

Parameters:
stimulus - The new stimulus.

getOutputCells

public Map getOutputCells()
Returns the cells that can be monitored (listened to).

Returns:
The cells.

setOutputCells

public void setOutputCells(Map cells)
Sets the cells that can be monitored (listened to).

Parameters:
cells - The cells.

getOutputCell

public Object getOutputCell(String key)
returns a particlar output cell by its key. Object must be cast to the appropriate type.

Parameters:
key - the key the cell was stored in the map by
Returns:
null if the cell doesn't exist in the map

getSimulatedCells

public List getSimulatedCells()
Returns the cells that are simulated

Returns:
The cells.

setSimulatedCells

public void setSimulatedCells(List cells)
Sets the cells that are simulated

Parameters:
cells - The cells.

getOnGanglions

public Collection getOnGanglions()
Return the retinal ganglion on-type cells

Returns:
list on retinal ganglion on-type

getOffGanglions

public Collection getOffGanglions()
Return the retinal ganglion off-type cells

Returns:
list off retinal ganglion on-type

setOnGanglions

public void setOnGanglions(Collection c)

setOffGanglions

public void setOffGanglions(Collection c)

putOutputCell

public void putOutputCell(String key,
                          Object cell)
put a an object into the output cells map.

Parameters:
key - the storage key
cell - the cell to store

getMonitors

public Map getMonitors()
Returns the monitors that are currently registered.

Returns:
The monitors.

setMonitors

public void setMonitors(Map monitors)
Sets the Map of monitors. Monitors are only used in SimulationSetup when monitored cell is being set, so that each monitor can have its monitored cell set. The monitors are not updated; they need to be added as updateables to the set of cells obtained from getOutputCells().

Parameters:
monitors - The monitors.

getMonitor

public AcceptsInput getMonitor(String key)
returns a particlar monitor by its key.

Parameters:
key - the key the monitor was stored in the map by
See Also:
setMonitors(java.util.Map)

putMonitor

public void putMonitor(String key,
                       AcceptsInput monitor)
put a an object into the monitors map.

Parameters:
key - the storage key
monitor - the monitor to store
See Also:
setMonitors(java.util.Map)

getReceptorShapes

public ArrayList getReceptorShapes()
Returns the shapes of the photoreceptors.

Returns:
The shapes.

setReceptorShapes

public void setReceptorShapes(ArrayList receptorShapes)
Sets the shapes of the photoreceptors.

Parameters:
receptorShapes - The shapes.

setMonitoredCell

public void setMonitoredCell(String key)
set the monitored cell in the simulation using the String key. This cell will be rendered audibly or visually (on the status line).

Parameters:
key - The key by which the cell was put into the collection of fiducial output cells.
Throws:
SimulationSetup.NoSuchCellException - if you try to monitor a cell that doesn't exist
See Also:
setMonitoredCell(ServesOutput)

setMonitoredCell

public void setMonitoredCell(ServesOutput cell)
set the monitored cell in the simulation directly. This cell will be rendered audibly by AudioOutput and visually in the ActivityMeter.

Parameters:
cell - The key by which the cell was put into the collection of fiducial output cells.
See Also:
setMonitoredCell(String)

getMonitoredCell

public ServesOutput getMonitoredCell()
returns the monitored cell

Returns:
the ServesOutput object to monitor

getStartingCellName

public String getStartingCellName()
Gets the starting cell name.

Returns:
String the starting cell name

setStartingCellName

public void setStartingCellName(String startingCellName)
Sets the starting cell Name.

Parameters:
startingCellName - The starting cell name to set

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