Package mgui.neuro.components
Class AbstractNeuroComponent
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.models.networks.components.AbstractNetworkComponent
mgui.neuro.components.AbstractNeuroComponent
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<DynamicModelComponent>
,AttributeListener
,AttributeObject
,InterfaceObject
,NamedObject
,TreeObject
,CleanableObject
,DynamicModelComponent
,TimeStepListener
,Updateable
- Direct Known Subclasses:
AbstractCorticalConnection
,AbstractCorticalOutput
,AbstractCorticalRegion
,AbstractNeuron
,AbstractNeuronalComponent
,CompartmentalComponent
,CorticalRegion
public abstract class AbstractNeuroComponent extends AbstractNetworkComponent
Abstract generic class for neuro model components to inherit. Contains two lists, one for
events and one for connections. This class forces an implementation of clone()
by its
subclasses; as a general policy clones of model components should ensure that components
states are also preserved in a clone.
All subclasses of this class should add its parameters as Attribute
s. These
parameters should have their own get and set methods implemented. Primitives should be wrapped
by instances of arNumber
(java wrappers such as Integer
are fine too, but do not allow their
values to be dynamically changed...)
Variables (e.g., clock) should be declared as individual class members.
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description protected AttributeList
attributes
protected double
clock
protected java.util.ArrayList<DynamicModelComponent>
connections
protected java.util.ArrayList<DynamicModelEvent>
events
boolean
hasSubComponents
protected long
id
java.util.ArrayList<InterfaceNetworkComponentListener>
listeners
protected org.opensourcephysics.numerics.ODESolver
solver
boolean
updated
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description AbstractNeuroComponent()
-
Method Summary
Modifier and Type Method Description void
addConnection(DynamicModelComponent c)
void
addEvent(DynamicModelEvent e)
void
addListener(InterfaceNetworkComponentListener l)
void
addToEngine(DynamicModelEngine e)
void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.abstract java.lang.Object
clone()
int
compareTo(DynamicModelComponent c)
protected boolean
executeEvent(DynamicModelEvent e)
boolean
executeEvents(double step)
Executes any events in this component's event cue and clears the cue.protected void
fireListeners()
protected void
fireListeners(int code)
Attribute
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.java.util.ArrayList<DynamicModelComponent>
getConnections()
double
getDelay()
long
getID()
java.lang.String
getName()
Gets the name for this object.org.opensourcephysics.numerics.ODESolver
getODESolver()
void
getRate(double[] state, double[] rate)
java.lang.String
getSolver()
java.util.ArrayList<DynamicModelComponent>
getSubComponents()
Returns a list of the complete subcomponent tree.boolean
hasSubComponents()
Indicates whether this component has subcomponents.protected void
init()
void
removeConnection(DynamicModelComponent c)
void
removeListener(InterfaceNeuroComponentListener l)
void
reset()
void
resetClock()
void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.void
setDelay(double delay)
void
setID(long id)
void
setID(long id, boolean update)
void
setName(java.lang.String name)
Sets the name for this object.void
setODESolver(org.opensourcephysics.numerics.ODESolver solver)
void
setSolver()
void
setSolver(java.lang.String str)
void
timeElapsed(double time)
protected boolean
updateComponent()
protected boolean
updateFromClock()
Methods inherited from class mgui.models.networks.components.AbstractNetworkComponent
getAttributeValue
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, issueTreeNode, setTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mgui.interfaces.util.CleanableObject
clean
Methods inherited from interface mgui.interfaces.InterfaceObject
destroy, isDestroyed
Methods inherited from interface mgui.interfaces.trees.TreeObject
getTreeLabel, issueTreeNode, setTreeNode
-
Field Details
-
solver
protected org.opensourcephysics.numerics.ODESolver solver -
listeners
-
events
-
connections
-
clock
protected double clock -
attributes
-
id
protected long id -
hasSubComponents
public boolean hasSubComponents -
updated
public boolean updated
-
-
Constructor Details
-
AbstractNeuroComponent
public AbstractNeuroComponent()
-
-
Method Details
-
init
protected void init() -
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
- Overrides:
setName
in classAbstractInterfaceObject
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Overrides:
getName
in classAbstractInterfaceObject
- Returns:
-
setSolver
public void setSolver() -
setSolver
public void setSolver(java.lang.String str) -
getSolver
public java.lang.String getSolver() -
setODESolver
public void setODESolver(org.opensourcephysics.numerics.ODESolver solver) -
getODESolver
public org.opensourcephysics.numerics.ODESolver getODESolver() -
setDelay
public void setDelay(double delay) -
getDelay
public double getDelay() -
setID
public void setID(long id) -
setID
public void setID(long id, boolean update) -
getConnections
-
getID
public long getID() -
addListener
-
removeListener
-
fireListeners
protected void fireListeners() -
fireListeners
protected void fireListeners(int code) -
addEvent
-
addConnection
-
removeConnection
-
reset
public void reset() -
executeEvents
public boolean executeEvents(double step)Description copied from interface:DynamicModelComponent
Executes any events in this component's event cue and clears the cue.- Returns:
- true if successful, false if errors encountered
-
timeElapsed
public void timeElapsed(double time) -
resetClock
public void resetClock() -
executeEvent
- Throws:
NeuroException
-
updateFromClock
protected boolean updateFromClock() -
updateComponent
protected boolean updateComponent() -
getRate
public void getRate(double[] state, double[] rate) -
addToEngine
-
clone
public abstract java.lang.Object clone()- Specified by:
clone
in interfaceDynamicModelComponent
- Overrides:
clone
in classAbstractNetworkComponent
-
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Returns:
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Returns:
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute. -
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object. -
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated. -
compareTo
-
getSubComponents
Returns a list of the complete subcomponent tree. Subclasses containing subcomponents should override this and provide an enumeration of all subcomponents, also calling this method for each subcomponent to ensure a complete tree is returned. -
hasSubComponents
public boolean hasSubComponents()Indicates whether this component has subcomponents. Subclasses containing subcomponents should set the hasSubComponents flag to true.
-