Nengo.ca

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
Direct Known Subclasses:
NetworkArrayImpl.ArrayOrigin

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(...).

See Also:
Serialized Form

Constructor Summary
BasicOrigin()
          Dummy default, necessary for object "ArrayOrigin" in jython code TODO: Still necessary?
BasicOrigin(Node node, java.lang.String name, int dimension, Units units)
           
 
Method Summary
 BasicOrigin clone()
           
 BasicOrigin clone(Ensemble e)
          Clone method that changes necessary parameters to point to a new parent, for use in cloning ensembles, etc.
 Configuration getConfiguration()
           
 int getDimensions()
           
 java.lang.String getName()
           
 Node getNode()
           
 Noise getNoise()
           
 boolean getRequiredOnCPU()
           
 Units getUnits()
           
 InstantaneousOutput getValues()
           
 void reset(boolean randomize)
           
 void setDimensions(int dim)
           
 void setName(java.lang.String name)
           
 void setNoise(Noise noise)
          Note that noise is only applied to RealOutput.
 void setRequiredOnCPU(boolean val)
           
 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()
Dummy default, necessary for object "ArrayOrigin" in jython code TODO: Still necessary?


BasicOrigin

public BasicOrigin(Node node,
                   java.lang.String name,
                   int dimension,
                   Units units)
Parameters:
node - The parent Node
name - Name of origin
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.

Specified by:
setValues in interface Origin
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)
Parameters:
dim - Origin dimensionality

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)
Parameters:
name - Origin name

getUnits

public Units getUnits()
Returns:
Units used by this origin

setUnits

public void setUnits(Units units)
Parameters:
units - Units used by this origin

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()

clone

public BasicOrigin clone()
                  throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Origin
Overrides:
clone in class java.lang.Object
Returns:
Valid clone
Throws:
java.lang.CloneNotSupportedException - if clone cannot be made

clone

public BasicOrigin clone(Ensemble e)
                  throws java.lang.CloneNotSupportedException
Description copied from interface: Origin
Clone method that changes necessary parameters to point to a new parent, for use in cloning ensembles, etc.

Specified by:
clone in interface Origin
Parameters:
e - New parent ensemble
Returns:
A clone of the origin for the new parent ensemble
Throws:
java.lang.CloneNotSupportedException - if clone cannot be made

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)

setRequiredOnCPU

public void setRequiredOnCPU(boolean val)
Specified by:
setRequiredOnCPU in interface Origin

getRequiredOnCPU

public boolean getRequiredOnCPU()
Specified by:
getRequiredOnCPU in interface Origin

Nengo.ca