public class Brain
extends java.lang.Object
implements java.lang.Runnable, java.io.Serializable
Module
: general interface for all components (modules)
DhanModule
: the dHAN module, implements the `Module' interface
PatternInputModule
: the input module, implements the `Module'
interface
Modifier and Type | Field and Description |
---|---|
protected javax.swing.event.EventListenerList |
changeListeners
Listeners to be notified of module changes.
|
double |
clusterSearchTimeInterval
Time interval for searching for active clusters.
|
java.io.File |
dataDirectory |
java.io.File |
dataInputDirectory |
java.io.File |
dataOutputDirectory |
static java.text.DateFormat |
DATE_FORMAT |
static java.io.File |
DEFAULT_DATA_DIRECTORY |
static java.io.File |
DEFAULT_DATA_INPUT_DIRECTORY |
static java.io.File |
DEFAULT_DATA_OUTPUT_DIRECTORY |
static java.io.File |
RESOURCES_DIRECTORY |
static java.lang.String |
VERSION |
Constructor and Description |
---|
Brain() |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener listener) |
void |
addLogger(java.lang.Object object,
java.lang.reflect.AccessibleObject accessibleObject,
java.io.File file) |
void |
addLogger(java.lang.Object object,
java.lang.String fieldOrMethod)
User friendly version of method
addLogger . |
void |
addModule(Module module)
Adds a module to this brain.
|
void |
calculateSimulationStatistics()
Calculates statistics for data analysis.
|
void |
closeLoggers() |
static Brain |
createDefaultGrosBrain() |
static Brain |
createDefaultLinkerhandBrain() |
void |
exportGraphvizGraph(java.io.File gvFile) |
void |
exportGraphvizGraph(java.io.File gvFile,
double lowerLinkBound,
double upperLinkBound) |
double |
getLogInterval() |
java.util.Set<Module> |
getModules()
Get modules of brain.
|
Module[] |
getModules(java.lang.Class<?> clas) |
static Module[] |
getModules(java.lang.Class<?> clas,
Module[] modules)
Get modules of given class (or subclasses) from given modules.
|
int |
getSimulationSleepDelay()
Returns getGlobalTimeDelayMillis.
|
double |
getTime()
Returns the time for Online Monitoring Purposes
|
double |
getTimeDelta()
Returns the timeDelta for Online Monitoring Purposes
|
long |
getTimeStepNumber()
Returns the timeStepNumber for Online Monitoring Purposes
|
boolean |
hasModule(Module module) |
boolean |
isSuspended()
Tests whether the simulation is suspended.
|
static Brain |
load(java.io.File file)
Deserializes brain (and its modules) from the given file.
|
static Module |
loadModule(java.lang.reflect.Constructor<?> constructor,
java.lang.Object[] arguments)
Loads a module to the system given the concrete constructor and all of its arguments.
|
static void |
main(java.lang.String[] args)
Main routine to start the Brain simulation program.
|
protected void |
notifyStateChanged(javax.swing.event.ChangeEvent event) |
void |
performLogging() |
void |
performOneTimeStep(double timeDelta) |
void |
printGraphvizGraphs()
Prints default Graphviz files for the current network.
|
void |
printLogFileHeaders() |
void |
printModuleSetup() |
void |
removeChangeListener(javax.swing.event.ChangeListener listener) |
void |
removeLogger(java.lang.Object object) |
void |
removeLogger(java.lang.Object object,
java.lang.reflect.Field field) |
void |
removeModule(Module module)
Removes a module from this brain.
|
void |
resume()
Resumes the current simulation.
|
void |
run()
The global dynamics.
|
static void |
save(Brain brain,
java.io.File file)
Serializes the given brain object (and its modules) to the given file.
|
void |
save(java.io.File file)
Serializes the current brain (and its modules) to the given file.
|
void |
setDataOutputDirectory(java.io.File file) |
void |
setLogInterval(double logInterval) |
void |
setSimulationSleepDelay(int simulationSleepDelay)
Sets simulationSleepDelay.
|
void |
setTime(double time)
Sets the time member variable.
|
void |
setTimeDelta(double timeDelta)
Sets the timeDelta member variable.
|
void |
setTimeDeltaAndDuration(double timeDelta,
double duration)
Sets the timeDelta member variable.
|
void |
setTimeStepNumber(long timeStepNumber)
Sets the timeStepNumber member variable.
|
void |
suspend()
Suspends the current simulation.
|
java.lang.String |
toString()
Basic toString method.
|
public final transient java.io.File dataDirectory
public final transient java.io.File dataInputDirectory
public transient java.io.File dataOutputDirectory
public static final java.text.DateFormat DATE_FORMAT
public static final java.io.File DEFAULT_DATA_DIRECTORY
public static final java.io.File DEFAULT_DATA_INPUT_DIRECTORY
public static java.io.File DEFAULT_DATA_OUTPUT_DIRECTORY
public static final java.io.File RESOURCES_DIRECTORY
public static final java.lang.String VERSION
protected transient javax.swing.event.EventListenerList changeListeners
readObject
and writeObject
.public double clusterSearchTimeInterval
public static Brain createDefaultGrosBrain() throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static Brain createDefaultLinkerhandBrain()
public static void main(java.lang.String[] args)
args
- Arguments for the program. Use --help to get a list.public void printModuleSetup()
public void printGraphvizGraphs()
public void run()
run
in interface java.lang.Runnable
public void performOneTimeStep(double timeDelta)
public double getLogInterval()
public void setLogInterval(double logInterval)
public void performLogging()
public void setDataOutputDirectory(java.io.File file)
public void printLogFileHeaders()
public void addLogger(java.lang.Object object, java.lang.reflect.AccessibleObject accessibleObject, java.io.File file)
public void addLogger(java.lang.Object object, java.lang.String fieldOrMethod)
addLogger
.
The accessible object (field, method, …) will be search for given a
string. First fields, than methods.
The filename will be created automatically according to the observed
object and the accessible object, viz. the method or field to observe.object
- fieldOrMethod
- public void removeLogger(java.lang.Object object)
public void removeLogger(java.lang.Object object, java.lang.reflect.Field field)
public void closeLoggers()
public void addChangeListener(javax.swing.event.ChangeListener listener)
public void removeChangeListener(javax.swing.event.ChangeListener listener)
protected void notifyStateChanged(javax.swing.event.ChangeEvent event)
public boolean hasModule(Module module)
public void addModule(Module module)
module
- Module to add.public void removeModule(Module module)
module
- Module to remove.public Module[] getModules(java.lang.Class<?> clas)
public static Module[] getModules(java.lang.Class<?> clas, Module[] modules)
clas
- Class to filter the modules for.modules
- Modules to search for instances.public java.util.Set<Module> getModules()
public long getTimeStepNumber()
public void setTimeStepNumber(long timeStepNumber)
timeStepNumber
- public double getTimeDelta()
public void setTimeDelta(double timeDelta)
timeDelta
- public void setTimeDeltaAndDuration(double timeDelta, double duration)
timeDelta
- public double getTime()
public static Module loadModule(java.lang.reflect.Constructor<?> constructor, java.lang.Object[] arguments) throws java.lang.IllegalArgumentException
constructor
- Constructor of the module class to create the module instance from.arguments
- Arguments for the given constructor.java.lang.IllegalArgumentException
public void setTime(double time)
time
- Time of the simulation.public boolean isSuspended()
public void suspend()
public void resume()
public java.lang.String toString()
toString
in class java.lang.Object
public void save(java.io.File file)
public static void save(Brain brain, java.io.File file)
brain
- Object of class Brain to serialize.file
- File to write the serialization to.public static Brain load(java.io.File file) throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
java.io.IOException
public void calculateSimulationStatistics()
public int getSimulationSleepDelay()
simulationSleepDelay
public void setSimulationSleepDelay(int simulationSleepDelay)
simulationSleepDelay
- - Number of milliseconds the program has to sleep in every
loop in oder to delay execution of small and fast systems. *simulationSleepDelay
public void exportGraphvizGraph(java.io.File gvFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void exportGraphvizGraph(java.io.File gvFile, double lowerLinkBound, double upperLinkBound) throws java.io.FileNotFoundException
java.io.FileNotFoundException