Nengo.ca

ca.nengo.model.impl
Class PassthroughNode

java.lang.Object
  extended by ca.nengo.model.impl.PassthroughNode
All Implemented Interfaces:
Node, Resettable, SimulationMode.ModeConfigurable, VisiblyMutable, java.io.Serializable, java.lang.Cloneable

public class PassthroughNode
extends java.lang.Object
implements Node

A Node that passes values through unaltered.

This can be useful if an input to a Network is actually routed to multiple destinations, but you want to handle this connectivity within the Network rather than expose multiple terminations.

See Also:
Serialized Form

Nested Class Summary
static class PassthroughNode.PassthroughTermination
          Termination that receives input unaltered.
 
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent
 
Field Summary
static java.lang.String ORIGIN
          Default name for an origin
static java.lang.String TERMINATION
          Default name for a termination
 
Constructor Summary
PassthroughNode(java.lang.String name, int dimension)
          Constructor for a simple passthrough with single input.
PassthroughNode(java.lang.String name, int dimension, java.util.Map<java.lang.String,float[][]> termDefinitions)
          Constructor for a summing junction with multiple inputs.
 
Method Summary
 void addChangeListener(VisiblyMutable.Listener listener)
           
 Node clone()
           
 Node[] getChildren()
           
 java.lang.String getDocumentation()
           
 SimulationMode getMode()
           
 java.lang.String getName()
           
 Origin getOrigin(java.lang.String name)
           
 Origin[] getOrigins()
           
 Termination getTermination(java.lang.String name)
           
 Termination[] getTerminations()
           
 void removeChangeListener(VisiblyMutable.Listener listener)
           
 void reset(boolean randomize)
           
 void run(float startTime, float endTime)
          Runs the Node (including all its components), updating internal state and outputs as needed.
 void setDocumentation(java.lang.String text)
           
 void setMode(SimulationMode mode)
          Does nothing (only DEFAULT mode is supported).
 void setName(java.lang.String name)
           
 java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TERMINATION

public static final java.lang.String TERMINATION
Default name for a termination

See Also:
Constant Field Values

ORIGIN

public static final java.lang.String ORIGIN
Default name for an origin

See Also:
Constant Field Values
Constructor Detail

PassthroughNode

public PassthroughNode(java.lang.String name,
                       int dimension)
Constructor for a simple passthrough with single input.

Parameters:
name - Node name
dimension - Dimension of data passing through

PassthroughNode

public PassthroughNode(java.lang.String name,
                       int dimension,
                       java.util.Map<java.lang.String,float[][]> termDefinitions)
Constructor for a summing junction with multiple inputs.

Parameters:
name - Node name
dimension - Dimension of data passing through
termDefinitions - Name of each Termination (TERMINATION is used for the single-input case) and associated transform
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface Node
Returns:
Name of Node (must be unique in a Network)
See Also:
Node.getName()

setName

public void setName(java.lang.String name)
             throws StructuralException
Specified by:
setName in interface Node
Parameters:
name - The new name
Throws:
StructuralException - if name already exists?

getOrigin

public Origin getOrigin(java.lang.String name)
                 throws StructuralException
Specified by:
getOrigin in interface Node
Parameters:
name - Name of an Origin on this Node
Returns:
The named Origin if it exists
Throws:
StructuralException - if the named Origin does not exist
See Also:
Node.getOrigin(java.lang.String)

getOrigins

public Origin[] getOrigins()
Specified by:
getOrigins in interface Node
Returns:
Sets of ouput channels (eg spiking outputs, gap junctional outputs, etc.)
See Also:
Node.getOrigins()

getTermination

public Termination getTermination(java.lang.String name)
                           throws StructuralException
Specified by:
getTermination in interface Node
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)

getTerminations

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

run

public void run(float startTime,
                float endTime)
         throws SimulationException
Description copied from interface: Node
Runs the Node (including all its components), updating internal state and outputs as needed. Runs should be short (eg 1ms), because inputs can not be changed during a run, and outputs will only be communicated to other Nodes after a run.

Specified by:
run in interface Node
Parameters:
startTime - simulation time at which running starts (s)
endTime - simulation time at which running ends (s)
Throws:
SimulationException - if a problem is encountered while trying to run
See Also:
Node.run(float, float)

reset

public void reset(boolean randomize)
Specified by:
reset in interface Resettable
Parameters:
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.
See Also:
Resettable.reset(boolean)

getMode

public SimulationMode getMode()
Specified by:
getMode in interface SimulationMode.ModeConfigurable
Returns:
The SimulationMode in which the object is running
See Also:
SimulationMode.ModeConfigurable.getMode()

setMode

public void setMode(SimulationMode mode)
Does nothing (only DEFAULT mode is supported).

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

getDocumentation

public java.lang.String getDocumentation()
Specified by:
getDocumentation in interface Node
Returns:
User-specified documentation for the Node, if any
See Also:
Node.getDocumentation()

setDocumentation

public void setDocumentation(java.lang.String text)
Specified by:
setDocumentation in interface Node
Parameters:
text - New user-specified documentation for the Node
See Also:
Node.setDocumentation(java.lang.String)

addChangeListener

public void addChangeListener(VisiblyMutable.Listener listener)
Specified by:
addChangeListener in interface VisiblyMutable
Parameters:
listener - Listener to add
See Also:
VisiblyMutable.addChangeListener(ca.nengo.util.VisiblyMutable.Listener)

removeChangeListener

public void removeChangeListener(VisiblyMutable.Listener listener)
Specified by:
removeChangeListener in interface VisiblyMutable
Parameters:
listener - Listener to remove
See Also:
VisiblyMutable.removeChangeListener(ca.nengo.util.VisiblyMutable.Listener)

clone

public Node clone()
           throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Node
Overrides:
clone in class java.lang.Object
Returns:
An independent copy of the Node
Throws:
java.lang.CloneNotSupportedException - if clone can't be made

getChildren

public Node[] getChildren()
Specified by:
getChildren in interface Node

toScript

public java.lang.String toScript(java.util.HashMap<java.lang.String,java.lang.Object> scriptData)
                          throws ScriptGenException
Specified by:
toScript in interface Node
Parameters:
scriptData - Map of class parent and prefix data for generating python script
Returns:
Python script for generating the node
Throws:
ScriptGenException - if the node cannot be generated in script

Nengo.ca