ca.nengo.model.impl
Class BasicOrigin

java.lang.Object
  extended by ca.nengo.model.impl.BasicOrigin
All Implemented Interfaces:
Configurable, Noise.Noisy, Origin, Resettable, java.io.Serializable, java.lang.Cloneable

public class BasicOrigin
extends java.lang.Object
implements Origin, Noise.Noisy, Resettable, Configurable

A generic implementation of Origin. Nodes that contain an Origin of this type should call one of the setValues() methods with every Node.run(...).

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
BasicOrigin(Node node, java.lang.String name, int dimension, Units units)
           
 
Method Summary
 Origin clone()
           
 Configuration getConfiguration()
           
 int getDimensions()
           
 java.lang.String getName()
           
 Node getNode()
           
 Noise getNoise()
           
 Units getUnits()
           
 InstantaneousOutput getValues()
           
 void reset(boolean randomize)
           
 void setDimensions(int dim)
           
 void setName(java.lang.String name)
           
 void setNode(Node node)
           
 void setNoise(Noise noise)
          Note that noise is only applied to RealOutput.
 void setUnits(Units units)
           
 void setValues(float startTime, float endTime, float[] values)
          This method is normally called by the Node that contains this Origin, to set the input that is read by other nodes from getValues().
 void setValues(InstantaneousOutput values)
          This method is normally called by the Node that contains this Origin, to set the input that is read by other nodes from getValues().
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicOrigin

public BasicOrigin(Node node,
                   java.lang.String name,
                   int dimension,
                   Units units)
Parameters:
node - The parent Node
dimension - Dimension of output of this Origin
units - The output units
Method Detail

getConfiguration

public Configuration getConfiguration()
Specified by:
getConfiguration in interface Configurable
Returns:
This Configurable's Configuration data
See Also:
Configurable.getConfiguration()

setValues

public void setValues(float startTime,
                      float endTime,
                      float[] values)
This method is normally called by the Node that contains this Origin, to set the input that is read by other nodes from getValues(). If the Noise model has been set, noise is applied to the given values.

Parameters:
startTime - Start time of step for which outputs are being defined
endTime - End time of step for which outputs are being defined
values - Values underlying RealOutput that is to be output by this Origin in subsequent calls to getValues()

setValues

public void setValues(InstantaneousOutput values)
This method is normally called by the Node that contains this Origin, to set the input that is read by other nodes from getValues(). No noise is applied to the given values.

Parameters:
values - Values to be output by this Origin in subsequent calls to getValues()

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface Origin
Returns:
Dimensionality of information coming from this Origin (eg number of axons, or dimension of decoded function of variables represented by the Ensemble)
See Also:
Origin.getDimensions()

setDimensions

public void setDimensions(int dim)

getName

public java.lang.String getName()
Specified by:
getName in interface Origin
Returns:
Name of this Origin (unique in the scope of a source of Origins, eg a Neuron or Ensemble)
See Also:
Origin.getName()

setName

public void setName(java.lang.String name)

getUnits

public Units getUnits()

setUnits

public void setUnits(Units units)

getValues

public InstantaneousOutput getValues()
                              throws SimulationException
Specified by:
getValues in interface Origin
Returns:
Instantaneous output from this Origin.
Throws:
SimulationException - if there is any problem retrieving values
See Also:
Origin.getValues()

getNoise

public Noise getNoise()
Specified by:
getNoise in interface Noise.Noisy
Returns:
Noise with which the object is to be corrupted
See Also:
Noise.Noisy.getNoise()

setNoise

public void setNoise(Noise noise)
Note that noise is only applied to RealOutput.

Specified by:
setNoise in interface Noise.Noisy
Parameters:
noise - New noise model
See Also:
Noise.Noisy.setNoise(ca.nengo.model.Noise)

getNode

public Node getNode()
Specified by:
getNode in interface Origin
Returns:
The Node to which the Origin belongs
See Also:
Origin.getNode()

setNode

public void setNode(Node node)

clone

public Origin clone()
             throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Origin
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

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)