|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.nengo.model.impl.NetworkImpl
public class NetworkImpl
Default implementation of Network.
Nested Class Summary | |
---|---|
class |
NetworkImpl.OriginWrapper
Wraps an Origin with a new name (for exposing outside Network). |
class |
NetworkImpl.TerminationWrapper
Wraps a Termination with a new name (for exposing outside Network). |
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable |
---|
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_NAME
|
Constructor Summary | |
---|---|
NetworkImpl()
|
Method Summary | |
---|---|
void |
addChangeListener(VisiblyMutable.Listener listener)
|
void |
addNode(Node node)
|
Projection |
addProjection(Origin origin,
Termination termination)
Connects an Origin to a Termination. |
void |
changed(VisiblyMutable.Event e)
Handles any changes/errors that may arise from objects within the network changing. |
Network |
clone()
|
void |
exposeOrigin(Origin origin,
java.lang.String name)
Declares the given Origin as available for connection outside the Network via getOrigins(). |
void |
exposeState(Probeable probeable,
java.lang.String stateName,
java.lang.String name)
Declares the given Probeable state as being available for Probing from outside this Network. |
void |
exposeTermination(Termination termination,
java.lang.String name)
Declares the given Termination as available for connection from outside the Network via getTerminations(). |
void |
fixMode()
|
java.lang.String |
getDocumentation()
|
java.lang.String |
getExposedOriginName(Origin insideOrigin)
Returns the name of the exposed origin given the inner origin. |
java.lang.String |
getExposedTerminationName(Termination insideTermination)
Returns the name of the exposed termination given the inner termination. |
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)
Metadata is non-critical information about the Network (eg UI layout) that the user doesn't access directly. |
SimulationMode |
getMode()
|
java.lang.String |
getName()
|
Node |
getNode(java.lang.String name)
|
java.util.ArrayList<Origin> |
getNodeOrigins()
Gathers all the origins of nodes contained in this network. |
Node[] |
getNodes()
|
java.util.ArrayList<Termination> |
getNodeTerminations()
Gathers all the terminations of nodes contained in this network. |
Origin |
getOrigin(java.lang.String name)
|
Origin[] |
getOrigins()
|
Projection[] |
getProjections()
|
Simulator |
getSimulator()
|
float |
getStepSize()
|
Termination |
getTermination(java.lang.String name)
|
Termination[] |
getTerminations()
|
void |
hideOrigin(java.lang.String name)
Undoes exposeOrigin(x, x, name). |
void |
hideState(java.lang.String name)
Undoes exposeState(x, x, name). |
void |
hideTermination(java.lang.String name)
Undoes exposeTermination(x, x, name). |
void |
killNeurons(float killrate)
Kills a certain percentage of neurons in the network (recursively including subnetworks). |
void |
killNeurons(float killrate,
boolean saveRelays)
Kills a certain percentage of neurons in the network (recursively including subnetworks). |
java.util.Properties |
listStates()
|
void |
removeChangeListener(VisiblyMutable.Listener listener)
|
void |
removeNode(java.lang.String name)
|
void |
removeProjection(Termination termination)
|
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 |
run(float startTime,
float endTime,
boolean topLevel)
Runs the model with the optional parameter topLevel. |
void |
setDocumentation(java.lang.String text)
|
void |
setMetaData(java.lang.String key,
java.lang.Object value)
|
void |
setMode(SimulationMode mode)
Sets the object to run in either the given mode or the closest mode that it supports (all ModeConfigurables must support SimulationMode.DEFAULT, and must default to this mode). |
protected void |
setMyMode(SimulationMode mode)
|
void |
setName(java.lang.String name)
|
void |
setSimulator(Simulator simulator)
|
void |
setStepSize(float stepSize)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_NAME
Constructor Detail |
---|
public NetworkImpl()
Method Detail |
---|
public void setSimulator(Simulator simulator)
setSimulator
in interface Network
simulator
- Simulator with which to run this Networkpublic Simulator getSimulator()
getSimulator
in interface Network
public void setStepSize(float stepSize)
stepSize
- New timestep size at which to simulate Network (some components of the network
may run with different step sizes, but information is exchanged between components with
this step size). Defaults to 0.001s.public float getStepSize()
public void addNode(Node node) throws StructuralException
addNode
in interface Network
node
- Node to add to the Network
StructuralException
- if the Network already contains a Node of the same nameNetwork.addNode(ca.nengo.model.Node)
public void killNeurons(float killrate)
killrate
- the percentage (0.0 to 1.0) of neurons to killpublic void killNeurons(float killrate, boolean saveRelays)
killrate
- the percentage (0.0 to 1.0) of neurons to killsaveRelays
- if true, exempt populations with only one node from the slaughterpublic void changed(VisiblyMutable.Event e) throws StructuralException
changed
in interface VisiblyMutable.Listener
e
- An object that has changed in some way (all properties
that influence the display of the object should be checked)
StructuralException
VisiblyMutable.Listener.changed(ca.nengo.util.VisiblyMutable.Event)
public java.util.ArrayList<Termination> getNodeTerminations()
public java.util.ArrayList<Origin> getNodeOrigins()
public Node[] getNodes()
getNodes
in interface Network
Network.getNodes()
public Node getNode(java.lang.String name) throws StructuralException
getNode
in interface Network
name
- Name of Node to remove
StructuralException
- if named Node does not exist in networkNetwork.getNode(java.lang.String)
public void removeNode(java.lang.String name) throws StructuralException
removeNode
in interface Network
name
- Name of Node to remove
StructuralException
- if named Node does not exist in networkNetwork.removeNode(java.lang.String)
public Projection addProjection(Origin origin, Termination termination) throws StructuralException
Network
addProjection
in interface Network
origin
- Origin (data source) of Projection.termination
- Termination (data destination) of Projection.
StructuralException
- if the given Origin and Termination have different dimensions,
or if there is already an Origin connected to the given Termination (note that an
Origin can project to multiple Terminations though).Network.addProjection(ca.nengo.model.Origin, ca.nengo.model.Termination)
public Projection[] getProjections()
getProjections
in interface Network
Network.getProjections()
public void removeProjection(Termination termination) throws StructuralException
removeProjection
in interface Network
termination
- Termination of Projection to remove
StructuralException
- if there exists no Projection between the specified
Origin and TerminationNetwork.removeProjection(ca.nengo.model.Termination)
public java.lang.String getName()
getName
in interface Node
Node.getName()
public void setName(java.lang.String name) throws StructuralException
setName
in interface Node
name
- New name of Network (must be unique within any networks of which this one
will be a part)
StructuralException
public void setMode(SimulationMode mode)
SimulationMode.ModeConfigurable
setMode
in interface SimulationMode.ModeConfigurable
mode
- SimulationMode in which it is desired that the object runs.SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
protected void setMyMode(SimulationMode mode)
public void fixMode()
public SimulationMode getMode()
getMode
in interface SimulationMode.ModeConfigurable
SimulationMode.ModeConfigurable.getMode()
public void run(float startTime, float endTime) throws SimulationException
Node
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 run(float startTime, float endTime, boolean topLevel) throws SimulationException
topLevel
- true if the network being run is the top level network, false if it is a subnetwork
SimulationException
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 TimeSeries getHistory(java.lang.String stateName) throws SimulationException
Probeable
getHistory
in interface Probeable
stateName
- A state variable name
SimulationException
- 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 exposeOrigin(Origin origin, java.lang.String name)
Network
exposeOrigin
in interface Network
origin
- An Origin within this Network that is to connect to something
outside this Networkname
- Name of the Origin as it will appear outside this NetworkNetwork.exposeOrigin(ca.nengo.model.Origin,
java.lang.String)
public void hideOrigin(java.lang.String name) throws StructuralException
Network
hideOrigin
in interface Network
name
- Name of Origin to unexpose.
StructuralException
Network.hideOrigin(java.lang.String)
public java.lang.String getExposedOriginName(Origin insideOrigin)
Network
getExposedOriginName
in interface Network
insideOrigin
- Origin inside the networkNetwork.getExposedOriginName(ca.nengo.model.Origin)
public Origin getOrigin(java.lang.String name) throws StructuralException
getOrigin
in interface Node
name
- Name of an Origin on this Node
StructuralException
- if the named Origin does not existNode.getOrigin(java.lang.String)
public Origin[] getOrigins()
getOrigins
in interface Node
Node.getOrigins()
public void exposeTermination(Termination termination, java.lang.String name)
Network
exposeTermination
in interface Network
termination
- A Termination within this Network that is to connect to something
outside this Networkname
- Name of the Termination as it will appear outside this NetworkNetwork.exposeTermination(ca.nengo.model.Termination, java.lang.String)
public void hideTermination(java.lang.String name)
Network
hideTermination
in interface Network
name
- Name of Termination to unexpose.Network.hideTermination(java.lang.String)
public java.lang.String getExposedTerminationName(Termination insideTermination)
Network
getExposedTerminationName
in interface Network
insideTermination
- Termination inside the networkNetwork.getExposedTerminationName(ca.nengo.model.Termination)
public Termination getTermination(java.lang.String name) throws StructuralException
getTermination
in interface Node
name
- Name of a Termination onto this Node
StructuralException
- if the named Termination does not existNode.getTermination(java.lang.String)
public Termination[] getTerminations()
getTerminations
in interface Node
Node.getTerminations()
public void exposeState(Probeable probeable, java.lang.String stateName, java.lang.String name) throws StructuralException
Network
exposeState
in interface Network
probeable
- A Probeable within this Network.stateName
- A state of the given Probeablename
- A new name with which to access this state via Network.getHistory
StructuralException
Network.exposeState(ca.nengo.model.Probeable, java.lang.String, java.lang.String)
public void hideState(java.lang.String name)
Network
hideState
in interface Network
name
- Name of state to unexpose.Network.hideState(java.lang.String)
public 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 java.lang.Object getMetaData(java.lang.String key)
Network
getMetaData
in interface Network
key
- Name of a metadata item
Network.getMetaData(java.lang.String)
public void setMetaData(java.lang.String key, java.lang.Object value)
setMetaData
in interface Network
key
- Name of a metadata itemvalue
- Value of the named metadata itemNetwork.setMetaData(java.lang.String, java.lang.Object)
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)
public Network clone() throws java.lang.CloneNotSupportedException
clone
in interface Node
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |