public class BasicModel extends DefaultAdaptable implements IModel
Modifier and Type | Field and Description |
---|---|
protected double |
_age |
protected CachedMap<java.lang.String,IActivationBuffer> |
_buffers |
protected long |
_cycle |
protected ICycleProcessor |
_cycleProcessor |
protected boolean |
_cycleSkippingEnabled |
protected IDeclarativeModule |
_declarativeModule |
protected ACTREventDispatcher<IModel,IModelListener> |
_eventDispatcher |
protected CachedCollection<IExtension> |
_extensions |
protected CachedCollection<IInstrument> |
_installedInstruments |
protected boolean |
_isInitialized |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
_lock |
protected java.util.Map<java.lang.String,java.lang.Object> |
_metaData |
protected CachedCollection<IModule> |
_modules |
protected boolean |
_modulesInitialized |
protected java.lang.String |
_name |
protected ACTREventDispatcher<IParameterized,IParameterListener> |
_parameterEventDispatcher |
protected java.util.Map<java.lang.String,java.lang.Object> |
_parameterMap |
protected boolean |
_persistentExecution |
protected IProceduralModule |
_proceduralModule |
protected TimedEventQueue |
_timedEventQueue |
static java.lang.String |
AGE_PARAM |
static java.lang.String |
CYCLE_SKIPPING_PARAM |
static java.lang.String |
PERSISTENT_PARAM |
Constructor and Description |
---|
BasicModel() |
BasicModel(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
addActivationBuffer(IActivationBuffer buffer)
install a buffer into this model, usually called during a modules
installation
|
void |
addListener(IModelListener listener,
java.util.concurrent.Executor executor) |
void |
addListener(IParameterListener listener,
java.util.concurrent.Executor executor) |
protected ICycleProcessor |
createCycleProcessor() |
void |
dispatch(ModelEvent modelEvent) |
void |
dispatch(ParameterEvent modelEvent) |
void |
dispose()
release all resources
|
protected void |
fireParameterEvent(java.lang.String parameterName,
java.lang.Object oldValue,
java.lang.Object newValue) |
IActivationBuffer |
getActivationBuffer(java.lang.String name)
returned the named activation buffer.
|
java.util.Collection<IActivationBuffer> |
getActivationBuffers()
return the installed activation buffers
|
void |
getActivationBuffers(java.util.Collection<IActivationBuffer> container) |
double |
getAge()
age of the model used to shift the clock during runs
|
long |
getCycle() |
ICycleProcessor |
getCycleProcessor() |
IDeclarativeModule |
getDeclarativeModule()
return the declarative module - this is the primary access point for
declarative memory operations and controls
|
IExtension |
getExtension(java.lang.Class<? extends IExtension> extensionClass)
return the extension that implements this interface.
|
java.util.Collection<IExtension> |
getExtensions()
return all the installed extensions
|
IInstrument |
getInstrument(java.lang.Class<? extends IInstrument> instrumentClass) |
java.util.Collection<IInstrument> |
getInstruments() |
java.util.concurrent.locks.ReentrantReadWriteLock |
getLock() |
java.lang.Object |
getMetaData(java.lang.String key)
Gets the MetaData attribute of the MetaContainer object
|
java.util.Collection<java.lang.String> |
getMetaDataKeys()
return all the keys
|
IModule |
getModule(java.lang.Class<? extends IModule> moduleClass)
get the module that is of class.
|
java.util.Collection<IModule> |
getModules()
get all the installed moduels
|
java.lang.String |
getName()
everyone needs a name..
|
java.lang.String |
getParameter(java.lang.String key)
return parameter value - null if not defined.
|
java.util.Collection<java.lang.String> |
getPossibleParameters()
Return all parameters that can be read
|
IProceduralModule |
getProceduralModule()
return the procedural module - this is the primary access point for
procedural access and controls
|
java.util.Collection<java.lang.String> |
getSetableParameters()
Return list of all parameters that can be set.
|
TimedEventQueue |
getTimedEventQueue()
the model must have a timed event queue.
|
boolean |
hasBeenInitialized()
has this models intiialize been called
|
boolean |
hasListeners() |
boolean |
hasParameterListeners() |
void |
initialize()
initialize the model, calling initialize on buffers, and extensions in that
order.
|
protected void |
initializeModules() |
void |
install(IExtension extension)
install this extension
|
void |
install(IInstrument instrument)
install some other installable element, attempting to install a module or
an extention here will reroute it to the more specific methods.
|
void |
install(IModule module)
install an IModule into the model.
|
boolean |
isCycleSkippingEnabled() |
boolean |
isPersistentExecutionEnabled() |
protected boolean |
modulesAreInitialized() |
void |
removeListener(IModelListener listener) |
void |
removeListener(IParameterListener listener) |
void |
setAge(double age) |
void |
setCycle(long cycle) |
void |
setCycleProcessor(ICycleProcessor processor) |
void |
setCycleSkippingEnabled(boolean skipping) |
void |
setMetaData(java.lang.String key,
java.lang.Object value)
Sets the MetaData attribute of the MetaContainer object
|
void |
setName(java.lang.String modelName) |
void |
setParameter(java.lang.String key,
java.lang.String value)
Set the named parameter
|
void |
setPersistentExecutionEnabled(boolean persistent) |
java.lang.String |
toString() |
void |
uninstall(IExtension extension) |
void |
uninstall(IInstrument installable) |
addAdapterFactory, getAdapter, removeAdapterFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAdapter
public static final java.lang.String CYCLE_SKIPPING_PARAM
public static final java.lang.String PERSISTENT_PARAM
public static final java.lang.String AGE_PARAM
protected boolean _isInitialized
protected TimedEventQueue _timedEventQueue
protected IDeclarativeModule _declarativeModule
protected IProceduralModule _proceduralModule
protected CachedMap<java.lang.String,IActivationBuffer> _buffers
protected CachedCollection<IModule> _modules
protected CachedCollection<IExtension> _extensions
protected CachedCollection<IInstrument> _installedInstruments
protected boolean _cycleSkippingEnabled
protected boolean _persistentExecution
protected java.util.concurrent.locks.ReentrantReadWriteLock _lock
protected ACTREventDispatcher<IModel,IModelListener> _eventDispatcher
protected ACTREventDispatcher<IParameterized,IParameterListener> _parameterEventDispatcher
protected java.util.Map<java.lang.String,java.lang.Object> _metaData
protected java.util.Map<java.lang.String,java.lang.Object> _parameterMap
protected java.lang.String _name
protected boolean _modulesInitialized
protected long _cycle
protected double _age
protected ICycleProcessor _cycleProcessor
public BasicModel()
public BasicModel(java.lang.String name)
public void setCycleProcessor(ICycleProcessor processor)
setCycleProcessor
in interface IModel
public ICycleProcessor getCycleProcessor()
getCycleProcessor
in interface IModel
protected ICycleProcessor createCycleProcessor()
public void dispose()
IModel
public java.util.concurrent.locks.ReentrantReadWriteLock getLock()
public void addActivationBuffer(IActivationBuffer buffer)
IModel
addActivationBuffer
in interface IModel
public IActivationBuffer getActivationBuffer(java.lang.String name)
IModel
getActivationBuffer
in interface IModel
public java.util.Collection<IActivationBuffer> getActivationBuffers()
IModel
getActivationBuffers
in interface IModel
public void getActivationBuffers(java.util.Collection<IActivationBuffer> container)
getActivationBuffers
in interface IModel
public IDeclarativeModule getDeclarativeModule()
IModel
getDeclarativeModule
in interface IModel
public IExtension getExtension(java.lang.Class<? extends IExtension> extensionClass)
IModel
getExtension
in interface IModel
public java.util.Collection<IExtension> getExtensions()
IModel
getExtensions
in interface IModel
public IInstrument getInstrument(java.lang.Class<? extends IInstrument> instrumentClass)
getInstrument
in interface IModel
public java.util.Collection<IInstrument> getInstruments()
getInstruments
in interface IModel
public IModule getModule(java.lang.Class<? extends IModule> moduleClass)
IModel
public java.util.Collection<IModule> getModules()
IModel
getModules
in interface IModel
public IProceduralModule getProceduralModule()
IModel
getProceduralModule
in interface IModel
public void install(IModule module)
IModel
public void install(IExtension extension)
IModel
public void install(IInstrument instrument)
IModel
public void uninstall(IInstrument installable)
uninstall
in interface IModel
IModel.uninstall(org.jactr.instrument.IInstrument)
public void uninstall(IExtension extension)
public java.lang.String getParameter(java.lang.String key)
IParameterized
getParameter
in interface IParameterized
key
- Description of the Parameterpublic java.util.Collection<java.lang.String> getPossibleParameters()
IParameterized
getPossibleParameters
in interface IParameterized
public java.util.Collection<java.lang.String> getSetableParameters()
IParameterized
getSetableParameters
in interface IParameterized
public void setParameter(java.lang.String key, java.lang.String value)
IParameterized
setParameter
in interface IParameterized
public java.lang.Object getMetaData(java.lang.String key)
IMetaContainer
getMetaData
in interface IMetaContainer
key
- Description of Parameterpublic void setMetaData(java.lang.String key, java.lang.Object value)
IMetaContainer
setMetaData
in interface IMetaContainer
key
- The new MetaData valuevalue
- The new MetaData valuepublic java.util.Collection<java.lang.String> getMetaDataKeys()
IMetaContainer
getMetaDataKeys
in interface IMetaContainer
public void setAge(double age)
public double getAge()
IModel
public void setCycleSkippingEnabled(boolean skipping)
public boolean isCycleSkippingEnabled()
public void setPersistentExecutionEnabled(boolean persistent)
public boolean isPersistentExecutionEnabled()
public TimedEventQueue getTimedEventQueue()
IModel
getTimedEventQueue
in interface IModel
public boolean hasBeenInitialized()
IModel
hasBeenInitialized
in interface IModel
public void initialize() throws java.lang.Exception
initialize
in interface IModel
initialize
in interface IInitializable
java.lang.Exception
IModel.initialize()
protected boolean modulesAreInitialized()
protected void initializeModules()
public void addListener(IModelListener listener, java.util.concurrent.Executor executor)
addListener
in interface IModel
public void removeListener(IModelListener listener)
removeListener
in interface IModel
public boolean hasListeners()
hasListeners
in interface IModel
public void dispatch(ModelEvent modelEvent)
public void addListener(IParameterListener listener, java.util.concurrent.Executor executor)
addListener
in interface IModel
public void removeListener(IParameterListener listener)
removeListener
in interface IModel
public boolean hasParameterListeners()
hasParameterListeners
in interface IModel
public void dispatch(ParameterEvent modelEvent)
protected void fireParameterEvent(java.lang.String parameterName, java.lang.Object oldValue, java.lang.Object newValue)
public java.lang.String getName()
IModel
public void setName(java.lang.String modelName)
public void setCycle(long cycle)
public java.lang.String toString()
toString
in class java.lang.Object