brain
Class ModuleAdapter

java.lang.Object
  extended by brain.ModuleAdapter
All Implemented Interfaces:
Module, java.io.Serializable
Direct Known Subclasses:
ModuleDhan, ModuleInput, ModuleRelisi

public abstract class ModuleAdapter
extends java.lang.Object
implements Module, java.io.Serializable

This class provides default implementations for the Module interface. Standard behaviors like the get, set, add, remove methods are defined here. This class also provides basic graph calculation. The developer need only subclass this class and implement calculateOneTimeStep and define its own important methods.

See Also:
Serialized Form

Field Summary
protected  java.util.List<java.lang.Double> activities
          Array with the activities of the individual neurons.
protected  java.util.Map<Module,double[][]> afferentModules
          HashMap with string-identifiers and inter-modular link matrices.
protected  javax.swing.event.EventListenerList changeListeners
          Listeners to be notified of module changes.
protected  java.util.Set<java.util.Set<java.lang.Integer>> cliques
          The calculated cliques for this graph.
protected  double elapsedTime
          The time elapsed for this module.
protected  long elapsedTimeSteps
          The number of time steps elapsed for this module.
protected  java.util.Map<Module,java.lang.String> forwardModules
          HashMap with string-identifiers and identifier of the receiving port of the target module.
protected  java.util.HashMap<java.lang.String,java.lang.Double> receptors
          HashMap with string-identifiers encoding the open ports for the individual receptors.
 
Constructor Summary
ModuleAdapter()
           
 
Method Summary
 void addAfferentModule(Module module)
          Adds a module to the HashMap `afferentModules'.
 void addChangeListener(javax.swing.event.ChangeListener listener)
           
 void addForwardModule(Module module, java.lang.String whichPort)
          Adds a module to the HashMap `forwardModules'.
 void addReceptor(java.lang.String receptorType, double addValue)
          Adds contribution `addValue' to the specified receptor field, returning `false' if specified receptor does not exist.
protected abstract  void calculateOneTimeStep(double timeDelta)
          calculates one time step of the simulation calculation This method has to be implemented by subclasses.
 java.util.List<java.util.List<java.lang.Double>> cliqueGraph()
          returns the clique graph of the graph as an adjacency matrix
 java.util.Set<java.util.Set<java.lang.Integer>> cliques()
          Returns the cliques of the graph.
 void createTGFGraph(java.io.File tgfFile)
          http://en.wikipedia.org/wiki/Trivial_Graph_Format
 int[] degreeDistribution()
          Returns the degree distribution of the graph.
 java.util.List<java.lang.Double> getActivities()
          Returns the activities levels.
 double getActivity(int i)
          Returns the activities level of a given center.
 double[][] getAfferentLinks(Module module)
          Returns the array which holds the backward links to a given module
 Module[] getAfferentModules()
          Returns all backward module names as an ArrayList of Strings.
 double getElapsedTime()
          returns the time elapsed
 long getElapsedTimeSteps()
          returns the number of time steps elapsed
 Module[] getForwardModules()
          Returns all forward module names as an ArrayList of Strings.
 double getReceptor(java.lang.String receptorType)
          Returns the value of the specified receptor field.
 java.util.Map<java.lang.String,java.lang.Double> getReceptors()
          Returns receptors of a module
 boolean hasAfferentModule(Module module)
           
 boolean hasForwardModule(Module module)
           
 java.util.List<java.util.Set<java.lang.Integer>> neighbors()
          returns all the neighbors for all the vertices
 int[] nodeDegrees()
          Returns the degrees of the vertices.
protected  void notifyStateChanged(javax.swing.event.ChangeEvent event)
           
 void performOneTimeStep(double timeDelta)
          performs one time step of the simulation calculation
 void removeAfferentModule(Module module)
          Removes a module from the HashMap `afferentModules'.
 void removeAfferentModules()
          Removes all modules from the HashMap `afferentModules'.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
           
 void removeForwardModule(Module module)
          Removes a particular forward module from the HashMap of forward modules.
 void removeForwardModules()
          Remove all forward modules from the HashMap of forward modules.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface brain.Module
addBias, getBias, getLink, getName, getSize, reset, setLink
 

Field Detail

changeListeners

protected javax.swing.event.EventListenerList changeListeners
Listeners to be notified of module changes.


forwardModules

protected java.util.Map<Module,java.lang.String> forwardModules
HashMap with string-identifiers and identifier of the receiving port of the target module.

The geometry of the forward connection, specific to the `ModuleDhan' module. The receiving port (receptors for the neuromodulator) is given by the second argument of `forwardModules'.


afferentModules

protected java.util.Map<Module,double[][]> afferentModules
HashMap with string-identifiers and inter-modular link matrices.

The geometry of the backward connection, is a all-to-all adaptive connection.


activities

protected java.util.List<java.lang.Double> activities
Array with the activities of the individual neurons.


receptors

protected java.util.HashMap<java.lang.String,java.lang.Double> receptors
HashMap with string-identifiers encoding the open ports for the individual receptors.

The receptors are targeted by the diffusive module signals of other (or this) modules, via the respective forward connection, stored in the respective `forwardModules'.
The allowed types of receptors, the cues of the HashMap, are stored in `auxMyReceptorsAllowedValues'.


elapsedTimeSteps

protected long elapsedTimeSteps
The number of time steps elapsed for this module.


elapsedTime

protected double elapsedTime
The time elapsed for this module.


cliques

protected java.util.Set<java.util.Set<java.lang.Integer>> cliques
The calculated cliques for this graph.

Constructor Detail

ModuleAdapter

public ModuleAdapter()
Method Detail

getElapsedTimeSteps

public long getElapsedTimeSteps()
returns the number of time steps elapsed

Specified by:
getElapsedTimeSteps in interface Module

getElapsedTime

public double getElapsedTime()
returns the time elapsed

Specified by:
getElapsedTime in interface Module

performOneTimeStep

public final void performOneTimeStep(double timeDelta)
performs one time step of the simulation calculation

Specified by:
performOneTimeStep in interface Module

calculateOneTimeStep

protected abstract void calculateOneTimeStep(double timeDelta)
calculates one time step of the simulation calculation This method has to be implemented by subclasses.

Parameters:
timeDelta -

getActivities

public java.util.List<java.lang.Double> getActivities()
Returns the activities levels.

Specified by:
getActivities in interface Module

getActivity

public double getActivity(int i)
Returns the activities level of a given center.

Specified by:
getActivity in interface Module

addAfferentModule

public void addAfferentModule(Module module)
Adds a module to the HashMap `afferentModules'.

Specified by:
addAfferentModule in interface Module
Parameters:
module - - the module to which this module connects

getAfferentModules

public Module[] getAfferentModules()
Returns all backward module names as an ArrayList of Strings.

Specified by:
getAfferentModules in interface Module

removeAfferentModule

public void removeAfferentModule(Module module)
Description copied from interface: Module
Removes a module from the HashMap `afferentModules'.

Specified by:
removeAfferentModule in interface Module

removeAfferentModules

public void removeAfferentModules()
Description copied from interface: Module
Removes all modules from the HashMap `afferentModules'.

Specified by:
removeAfferentModules in interface Module

hasAfferentModule

public boolean hasAfferentModule(Module module)
Specified by:
hasAfferentModule in interface Module

getAfferentLinks

public double[][] getAfferentLinks(Module module)
Description copied from interface: Module
Returns the array which holds the backward links to a given module

Specified by:
getAfferentLinks in interface Module

addForwardModule

public void addForwardModule(Module module,
                             java.lang.String whichPort)
Description copied from interface: Module
Adds a module to the HashMap `forwardModules'.

Specified by:
addForwardModule in interface Module

getForwardModules

public Module[] getForwardModules()
Returns all forward module names as an ArrayList of Strings.

--class ModuleDhan--

Specified by:
getForwardModules in interface Module

removeForwardModule

public void removeForwardModule(Module module)
Removes a particular forward module from the HashMap of forward modules.

--class ModuleDhan--

Specified by:
removeForwardModule in interface Module
Parameters:
module - name of module to remove

removeForwardModules

public void removeForwardModules()
Remove all forward modules from the HashMap of forward modules.

--class ModuleDhan--

Specified by:
removeForwardModules in interface Module

hasForwardModule

public boolean hasForwardModule(Module module)
Specified by:
hasForwardModule in interface Module

addReceptor

public void addReceptor(java.lang.String receptorType,
                        double addValue)
Adds contribution `addValue' to the specified receptor field, returning `false' if specified receptor does not exist.

Specified by:
addReceptor in interface Module

getReceptor

public double getReceptor(java.lang.String receptorType)
Returns the value of the specified receptor field.

Specified by:
getReceptor in interface Module

getReceptors

public java.util.Map<java.lang.String,java.lang.Double> getReceptors()
Description copied from interface: Module
Returns receptors of a module

Specified by:
getReceptors in interface Module

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Specified by:
addChangeListener in interface Module

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Specified by:
removeChangeListener in interface Module

notifyStateChanged

protected void notifyStateChanged(javax.swing.event.ChangeEvent event)

nodeDegrees

public int[] nodeDegrees()
Returns the degrees of the vertices.

Specified by:
nodeDegrees in interface Module

degreeDistribution

public int[] degreeDistribution()
Returns the degree distribution of the graph.

Specified by:
degreeDistribution in interface Module

cliques

public java.util.Set<java.util.Set<java.lang.Integer>> cliques()
Returns the cliques of the graph.

Specified by:
cliques in interface Module

neighbors

public java.util.List<java.util.Set<java.lang.Integer>> neighbors()
returns all the neighbors for all the vertices

Returns:
neighbors

cliqueGraph

public java.util.List<java.util.List<java.lang.Double>> cliqueGraph()
returns the clique graph of the graph as an adjacency matrix

Specified by:
cliqueGraph in interface Module

createTGFGraph

public void createTGFGraph(java.io.File tgfFile)
                    throws java.io.FileNotFoundException
http://en.wikipedia.org/wiki/Trivial_Graph_Format

Specified by:
createTGFGraph in interface Module
Parameters:
tgfFile -
Throws:
java.io.FileNotFoundException