public abstract class AbstractEnsemble extends java.lang.Object implements Ensemble, Probeable, VisiblyMutable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
Constructor and Description |
---|
AbstractEnsemble(java.lang.String name,
Node[] nodes)
Note that setMode(SimulationMode.DEFAULT) is called at construction time.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(VisiblyMutable.Listener listener) |
Ensemble |
clone() |
void |
collectSpikes(boolean collect) |
static java.util.List<java.lang.String> |
findCommon1DOrigins(Node[] nodes) |
protected void |
fireVisibleChangeEvent()
Called by subclasses when properties have changed in such a way that the
display of the ensemble may need updating.
|
int |
getCollectSpikesRatio() |
java.lang.String |
getDocumentation() |
TimeSeries |
getHistory(java.lang.String stateName)
Note that the units of TimeSeries' for a given state do not change over time (ie at different
time steps).
|
java.lang.Object |
getMetadata(java.lang.String key) |
SimulationMode |
getMode()
Note that this reflects the latest mode requested of the Ensemble, and that individual
Neurons may run in different modes (see setMode).
|
java.lang.String |
getName() |
Node[] |
getNodes() |
Origin |
getOrigin(java.lang.String name) |
Origin[] |
getOrigins() |
SpikePattern |
getSpikePattern()
This method provides a means of efficiently storing the output of an
Ensemble if the component Nodes have Origins that produce SpikeOutput.
|
Termination |
getTermination(java.lang.String name) |
Termination[] |
getTerminations() |
boolean |
isCollectingSpikes() |
java.util.Properties |
listStates() |
void |
redefineNodes(Node[] nodes)
Replaces the set of nodes inside the Ensemble
|
void |
removeChangeListener(VisiblyMutable.Listener listener) |
Origin |
removeOrigin(java.lang.String name) |
Termination |
removeTermination(java.lang.String name) |
void |
reset(boolean randomize)
Resets each Node in this Ensemble.
|
void |
run(float startTime,
float endTime)
Runs each neuron in the Ensemble.
|
void |
setCollectSpikesRatio(int n) |
void |
setDocumentation(java.lang.String text) |
void |
setMetadata(java.lang.String key,
java.lang.Object value) |
void |
setMode(SimulationMode mode)
When this method is called, setMode(...) is called on each Node in the Ensemble.
|
void |
setName(java.lang.String name) |
void |
setSpikePattern(float[] spikes,
float endTime) |
void |
stopProbing(java.lang.String stateName) |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildren, notifyAboutDeletion, toScript
public AbstractEnsemble(java.lang.String name, Node[] nodes)
name
- Unique name of Ensemblenodes
- Nodes that Ensemble containspublic java.lang.Object getMetadata(java.lang.String key)
public void setMetadata(java.lang.String key, java.lang.Object value)
public void redefineNodes(Node[] nodes)
redefineNodes
in interface Ensemble
nodes
- New nodes to usepublic java.lang.String getName()
getName
in interface Node
Node.getName()
public void setName(java.lang.String name) throws StructuralException
setName
in interface Node
name
- The new nameStructuralException
- if name already exists?public Node[] getNodes()
getNodes
in interface Ensemble
Ensemble.getNodes()
public void setMode(SimulationMode mode)
setMode
in interface SimulationMode.ModeConfigurable
mode
- SimulationMode in which it is desired that the object runs.SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
public SimulationMode getMode()
getMode
in interface SimulationMode.ModeConfigurable
SimulationMode.ModeConfigurable.getMode()
public void run(float startTime, float endTime) throws SimulationException
run
in interface Node
startTime
- simulation time at which running starts (s)endTime
- simulation time at which running ends (s)SimulationException
- if a problem is encountered while trying to runNode.run(float, float)
public void reset(boolean randomize)
reset
in interface Resettable
randomize
- True indicates that the object should be reset to a
randomly selected initial state (the object must be aware of the
distribution from which to draw from). False indicates that the
object should be reset to a fixed initial state (which it must
also know). Some objects may not support randomization of the initial
state, in which case a fixed state will be used in either case.Resettable.reset(boolean)
public Origin getOrigin(java.lang.String name) throws StructuralException
getOrigin
in interface Node
name
- Name of an Origin on this NodeStructuralException
- if the named Origin does not existNode.getOrigin(java.lang.String)
public Termination getTermination(java.lang.String name) throws StructuralException
getTermination
in interface Node
name
- Name of a Termination onto this NodeStructuralException
- if the named Termination does not existNode.getTermination(java.lang.String)
public Origin removeOrigin(java.lang.String name) throws StructuralException
name
- Name of the Origin to remove from the ensembleStructuralException
- if named Origin does not existExpandableNode.removeTermination(java.lang.String)
public Termination removeTermination(java.lang.String name) throws StructuralException
name
- Name of the Termination to remove from the ensembleStructuralException
- if named Termination does not existExpandableNode.removeTermination(java.lang.String)
public Origin[] getOrigins()
getOrigins
in interface Node
Node.getOrigins()
public Termination[] getTerminations()
getTerminations
in interface Node
Node.getTerminations()
public void collectSpikes(boolean collect)
collectSpikes
in interface Ensemble
collect
- If true, the spike pattern is recorded in subsequent runs and
is available through getSpikePattern() (defaults to false)Ensemble.collectSpikes(boolean)
public boolean isCollectingSpikes()
isCollectingSpikes
in interface Ensemble
Ensemble.isCollectingSpikes()
public int getCollectSpikesRatio()
public void setCollectSpikesRatio(int n)
n
- Inverse of the proportion of nodes from which to collect spikespublic SpikePattern getSpikePattern()
Ensemble
getSpikePattern
in interface Ensemble
Ensemble.getSpikePattern()
public void setSpikePattern(float[] spikes, float endTime)
spikes
- The pattern of spikes (0.0f for not spiking, else? for spiking)endTime
- End time for the spike patternpublic TimeSeries getHistory(java.lang.String stateName) throws SimulationException
Probeable
getHistory
in interface Probeable
stateName
- A state variable nameSimulationException
- if the Probeable does not have the requested stateProbeable.getHistory(java.lang.String)
public java.util.Properties listStates()
listStates
in interface Probeable
Probeable.listStates()
public void stopProbing(java.lang.String stateName)
stopProbing
in interface Ensemble
public static java.util.List<java.lang.String> findCommon1DOrigins(Node[] nodes)
nodes
- A list of Nodespublic java.lang.String getDocumentation()
getDocumentation
in interface Node
Node.getDocumentation()
public void setDocumentation(java.lang.String text)
setDocumentation
in interface Node
text
- New user-specified documentation for the NodeNode.setDocumentation(java.lang.String)
public void addChangeListener(VisiblyMutable.Listener listener)
addChangeListener
in interface VisiblyMutable
listener
- Listener to addVisiblyMutable.addChangeListener(ca.nengo.util.VisiblyMutable.Listener)
public void removeChangeListener(VisiblyMutable.Listener listener)
removeChangeListener
in interface VisiblyMutable
listener
- Listener to removeVisiblyMutable.removeChangeListener(ca.nengo.util.VisiblyMutable.Listener)
protected void fireVisibleChangeEvent()