org.jactr.core.module
Class AbstractModule

java.lang.Object
  extended by org.jactr.core.module.AbstractModule
All Implemented Interfaces:
IModule, IInitializable, IInstallable
Direct Known Subclasses:
AbstractAsynchronousModule, AbstractDeclarativeModule, DefaultDeclarativeLearningModule4, DefaultGoalModule6, DefaultImaginalModule6, DefaultProceduralLearningModule6, DefaultProceduralModule6, DefaultRandomModule, DefaultRetrievalModule6

public abstract class AbstractModule
extends java.lang.Object
implements IModule


Field Summary
static org.apache.commons.logging.Log LOGGER
          logger definition
 
Constructor Summary
AbstractModule(java.lang.String name)
           
 
Method Summary
static
<T> java.util.concurrent.Future<T>
delayedFuture(java.util.concurrent.Callable<T> caller, java.util.concurrent.Executor executor)
          create a future task and execute it on the exector
 void dispose()
          release any resources.
 java.util.concurrent.Executor getExecutor()
          default executor INLINE_EXECUTOR is used
 IModel getModel()
          return the model this module is installed into
 java.lang.String getName()
          the name of the module
static
<T> java.util.concurrent.Future<T>
immediateFuture(java.util.concurrent.Callable<T> caller)
          create a future task and execute it immediately using the INLINE_EXECUTOR
static
<T> java.util.concurrent.Future<T>
immediateReturn(T value)
           
abstract  void initialize()
          this will be called after all the modules have been installed permitting the module to attach listeners to other modules.
 void install(IModel model)
          called from the model during IModel.install(IModule).
 void uninstall(IModel model)
          remove the element from this model.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jactr.core.module.IModule
reset
 

Field Detail

LOGGER

public static final org.apache.commons.logging.Log LOGGER
logger definition

Constructor Detail

AbstractModule

public AbstractModule(java.lang.String name)
Method Detail

getExecutor

public java.util.concurrent.Executor getExecutor()
default executor INLINE_EXECUTOR is used

Returns:

dispose

public void dispose()
Description copied from interface: IModule
release any resources. this should only be called by the model during its own dispose method (assuming that this module is still installed) and should not result in the propogation of ANY events. The module should dispose of all its resources, including buffers

Specified by:
dispose in interface IModule

getModel

public IModel getModel()
Description copied from interface: IModule
return the model this module is installed into

Specified by:
getModel in interface IModule

getName

public java.lang.String getName()
Description copied from interface: IModule
the name of the module

Specified by:
getName in interface IModule
Returns:

install

public void install(IModel model)
Description copied from interface: IModule
called from the model during IModel.install(IModule). The module should handle any nondependent initialization here. Since no chunks will have been installed yet, the module should make not attempt to make reference to any until just before the model runs. Likewise, you should not install listeners into modules that this one is dependent upon until initialize() is called.

Specified by:
install in interface IModule
Specified by:
install in interface IInstallable
See Also:
IInstallable.install(org.jactr.core.model.IModel)

uninstall

public void uninstall(IModel model)
Description copied from interface: IInstallable
remove the element from this model. this is called after the model terminates

Specified by:
uninstall in interface IInstallable

initialize

public abstract void initialize()
Description copied from interface: IModule
this will be called after all the modules have been installed permitting the module to attach listeners to other modules. if you want to get access to chunks,types, or productions before the model runs, attach a model listener and do that during the modelStarted call

Specified by:
initialize in interface IModule
Specified by:
initialize in interface IInitializable

immediateReturn

public static <T> java.util.concurrent.Future<T> immediateReturn(T value)

immediateFuture

public static <T> java.util.concurrent.Future<T> immediateFuture(java.util.concurrent.Callable<T> caller)
create a future task and execute it immediately using the INLINE_EXECUTOR

Type Parameters:
T -
Parameters:
caller -
Returns:

delayedFuture

public static <T> java.util.concurrent.Future<T> delayedFuture(java.util.concurrent.Callable<T> caller,
                                                               java.util.concurrent.Executor executor)
create a future task and execute it on the exector

Type Parameters:
T -
Parameters:
caller -
executor -
Returns: