ca.nengo.model.impl
Class EnsembleImpl

java.lang.Object
  extended by ca.nengo.model.impl.AbstractEnsemble
      extended by ca.nengo.model.impl.EnsembleImpl
All Implemented Interfaces:
Ensemble, ExpandableNode, Node, Probeable, Resettable, SimulationMode.ModeConfigurable, VisiblyMutable, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
PlasticEnsembleImpl

public class EnsembleImpl
extends AbstractEnsemble
implements ExpandableNode

Default implementation of Ensemble.

Origins or Terminations can be set up on Nodes before they are grouped into an Ensemble. After Nodes are added to an Ensemble, no Origins or Terminations should be added to them directly. Terminations can be added with EnsembleImpl.addTermination(...) If a Termination is added directly to a Node after the Node is added to the Ensemble, the Termination will not appear in Ensemble.getTerminations()

TODO: test

Author:
Bryan Tripp
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
 
Field Summary
protected  ExpandableNode[] myExpandableNodes
           
protected  java.util.Map<java.lang.String,Termination> myExpandedTerminations
           
protected  java.util.LinkedList<Termination> OrderedTerminations
           
 
Fields inherited from class ca.nengo.model.impl.AbstractEnsemble
myNodes, myTerminations
 
Constructor Summary
EnsembleImpl(java.lang.String name, Node[] nodes)
           
EnsembleImpl(java.lang.String name, NodeFactory factory, int n)
           
 
Method Summary
 Termination addTermination(java.lang.String name, float[][] weights, float tauPSC, boolean modulatory)
          Adds a new Termination onto this Node.
 Ensemble clone()
           
 int getDimension()
           
 Termination getTermination(java.lang.String name)
           
 Termination[] getTerminations()
           
 void removeTermination(java.lang.String name)
           
 void setMode(SimulationMode mode)
          This Ensemble does not support SimulationMode.DIRECT.
 
Methods inherited from class ca.nengo.model.impl.AbstractEnsemble
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getHistory, getMode, getName, getNodes, getOrigin, getOrigins, getSpikePattern, isCollectingSpikes, listStates, redefineNodes, removeChangeListener, reset, run, setCollectSpikesRatio, setDocumentation, setName, setSpikePattern
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.nengo.model.Node
getDocumentation, getName, getOrigin, getOrigins, run, setDocumentation, setName
 
Methods inherited from interface ca.nengo.model.Resettable
reset
 
Methods inherited from interface ca.nengo.model.SimulationMode.ModeConfigurable
getMode
 
Methods inherited from interface ca.nengo.util.VisiblyMutable
addChangeListener, removeChangeListener
 

Field Detail

myExpandableNodes

protected ExpandableNode[] myExpandableNodes

myExpandedTerminations

protected java.util.Map<java.lang.String,Termination> myExpandedTerminations

OrderedTerminations

protected java.util.LinkedList<Termination> OrderedTerminations
Constructor Detail

EnsembleImpl

public EnsembleImpl(java.lang.String name,
                    Node[] nodes)
             throws StructuralException
Parameters:
name - Name of Ensemble
nodes - Nodes that make up the Ensemble
Throws:
StructuralException - if the given Nodes contain Terminations with the same name but different dimensions

EnsembleImpl

public EnsembleImpl(java.lang.String name,
                    NodeFactory factory,
                    int n)
             throws StructuralException
Throws:
StructuralException
Method Detail

getTerminations

public Termination[] getTerminations()
Specified by:
getTerminations in interface Node
Overrides:
getTerminations in class AbstractEnsemble
Returns:
Sets of input channels (these have the same dimension as corresponding Origins to which they are connected).
See Also:
Node.getTerminations()

setMode

public void setMode(SimulationMode mode)
This Ensemble does not support SimulationMode.DIRECT.

Specified by:
setMode in interface SimulationMode.ModeConfigurable
Overrides:
setMode in class AbstractEnsemble
Parameters:
mode - SimulationMode in which it is desired that the object runs.
See Also:
SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)

addTermination

public Termination addTermination(java.lang.String name,
                                  float[][] weights,
                                  float tauPSC,
                                  boolean modulatory)
                           throws StructuralException
Description copied from interface: ExpandableNode
Adds a new Termination onto this Node.

Specified by:
addTermination in interface ExpandableNode
Parameters:
weights - Each row is used as a 1 by m matrix of weights in a new termination on the nth expandable node
name - Unique name for the Termination (in the scope of this Node)
tauPSC - Time constant with which incoming signals are filtered. (All Terminations have this property, but it may have slightly different interpretations per implementation.)
modulatory - If true, inputs to the Termination are not summed with other inputs (they only have modulatory effects, eg on plasticity, which must be defined elsewhere).
Returns:
resulting Termination
Throws:
StructuralException - if length of weights doesn't equal getDimension(), or if there are different numbers of weights given in different rows.
See Also:
ExpandableNode.addTermination(java.lang.String, float[][], float, boolean)

removeTermination

public void removeTermination(java.lang.String name)
                       throws StructuralException
Specified by:
removeTermination in interface ExpandableNode
Parameters:
name - Name of Termination to remove.
Throws:
StructuralException
See Also:
ExpandableNode.removeTermination(java.lang.String)

getDimension

public int getDimension()
Specified by:
getDimension in interface ExpandableNode
Returns:
Output dimension of Terminations onto this Node
See Also:
ExpandableNode.getDimension()

getTermination

public Termination getTermination(java.lang.String name)
                           throws StructuralException
Specified by:
getTermination in interface Node
Overrides:
getTermination in class AbstractEnsemble
Parameters:
name - Name of a Termination onto this Node
Returns:
The named Termination if it exists
Throws:
StructuralException - if the named Termination does not exist
See Also:
Node.getTermination(java.lang.String)

clone

public Ensemble clone()
               throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Node
Overrides:
clone in class AbstractEnsemble
Returns:
An independent copy of the Node
Throws:
java.lang.CloneNotSupportedException