org.jactr.core.model.basic
Class BasicModel

java.lang.Object
  extended by org.jactr.core.model.basic.BasicModel
All Implemented Interfaces:
IModel, IInitializable, IMetaContainer, IParameterized

public class BasicModel
extends java.lang.Object
implements IModel


Field Summary
static java.lang.String AGE_PARAM
           
static java.lang.String CYCLE_SKIPPING_PARAM
           
static java.lang.String PERSISTENT_PARAM
           
 
Constructor Summary
BasicModel()
           
BasicModel(java.lang.String name)
           
 
Method Summary
 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)
           
 void dispatch(ModelEvent modelEvent)
           
 void dispatch(ParameterEvent modelEvent)
           
 void dispose()
          release all resources
 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.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.
 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()
           
 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(IInstrument installable)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CYCLE_SKIPPING_PARAM

public static final java.lang.String CYCLE_SKIPPING_PARAM
See Also:
Constant Field Values

PERSISTENT_PARAM

public static final java.lang.String PERSISTENT_PARAM
See Also:
Constant Field Values

AGE_PARAM

public static final java.lang.String AGE_PARAM
See Also:
Constant Field Values
Constructor Detail

BasicModel

public BasicModel()

BasicModel

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

setCycleProcessor

public void setCycleProcessor(ICycleProcessor processor)
Specified by:
setCycleProcessor in interface IModel

getCycleProcessor

public ICycleProcessor getCycleProcessor()
Specified by:
getCycleProcessor in interface IModel

dispose

public void dispose()
Description copied from interface: IModel
release all resources

Specified by:
dispose in interface IModel

addActivationBuffer

public void addActivationBuffer(IActivationBuffer buffer)
Description copied from interface: IModel
install a buffer into this model, usually called during a modules installation

Specified by:
addActivationBuffer in interface IModel

getActivationBuffer

public IActivationBuffer getActivationBuffer(java.lang.String name)
Description copied from interface: IModel
returned the named activation buffer. case sensitivity is up to the implementation

Specified by:
getActivationBuffer in interface IModel
Returns:

getActivationBuffers

public java.util.Collection<IActivationBuffer> getActivationBuffers()
Description copied from interface: IModel
return the installed activation buffers

Specified by:
getActivationBuffers in interface IModel

getActivationBuffers

public void getActivationBuffers(java.util.Collection<IActivationBuffer> container)
Specified by:
getActivationBuffers in interface IModel

getDeclarativeModule

public IDeclarativeModule getDeclarativeModule()
Description copied from interface: IModel
return the declarative module - this is the primary access point for declarative memory operations and controls

Specified by:
getDeclarativeModule in interface IModel
Returns:

getExtension

public IExtension getExtension(java.lang.Class<? extends IExtension> extensionClass)
Description copied from interface: IModel
return the extension that implements this interface. just getExtension(IExtension.class)

Specified by:
getExtension in interface IModel
Returns:

getExtensions

public java.util.Collection<IExtension> getExtensions()
Description copied from interface: IModel
return all the installed extensions

Specified by:
getExtensions in interface IModel
Returns:

getInstrument

public IInstrument getInstrument(java.lang.Class<? extends IInstrument> instrumentClass)
Specified by:
getInstrument in interface IModel
Returns:

getInstruments

public java.util.Collection<IInstrument> getInstruments()
Specified by:
getInstruments in interface IModel

getModule

public IModule getModule(java.lang.Class<? extends IModule> moduleClass)
Description copied from interface: IModel
get the module that is of class. effectively getInstallable(IModule.class);

Specified by:
getModule in interface IModel
Returns:
the module that implements Class, or null

getModules

public java.util.Collection<IModule> getModules()
Description copied from interface: IModel
get all the installed moduels

Specified by:
getModules in interface IModel
Returns:

getProceduralModule

public IProceduralModule getProceduralModule()
Description copied from interface: IModel
return the procedural module - this is the primary access point for procedural access and controls

Specified by:
getProceduralModule in interface IModel
Returns:

install

public void install(IModule module)
Description copied from interface: IModel
install an IModule into the model. if it is the declarative or procedural modules it will be installed as the models dec/proc module

Specified by:
install in interface IModel

install

public void install(IExtension extension)
Description copied from interface: IModel
install this extension

Specified by:
install in interface IModel

install

public void install(IInstrument instrument)
Description copied from interface: IModel
install some other installable element, attempting to install a module or an extention here will reroute it to the more specific methods.

Specified by:
install in interface IModel

uninstall

public void uninstall(IInstrument installable)
Specified by:
uninstall in interface IModel
See Also:
IModel.uninstall(org.jactr.instrument.IInstrument)

getParameter

public java.lang.String getParameter(java.lang.String key)
Description copied from interface: IParameterized
return parameter value - null if not defined.

Specified by:
getParameter in interface IParameterized
Parameters:
key - Description of the Parameter
Returns:
The parameter value

getPossibleParameters

public java.util.Collection<java.lang.String> getPossibleParameters()
Description copied from interface: IParameterized
Return all parameters that can be read

Specified by:
getPossibleParameters in interface IParameterized
Returns:
The possibleParameters value

getSetableParameters

public java.util.Collection<java.lang.String> getSetableParameters()
Description copied from interface: IParameterized
Return list of all parameters that can be set.

Specified by:
getSetableParameters in interface IParameterized
Returns:
The setableParameters value

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
Description copied from interface: IParameterized
Set the named parameter

Specified by:
setParameter in interface IParameterized

getMetaData

public java.lang.Object getMetaData(java.lang.String key)
Description copied from interface: IMetaContainer
Gets the MetaData attribute of the MetaContainer object

Specified by:
getMetaData in interface IMetaContainer
Parameters:
key - Description of Parameter
Returns:
The MetaData value

setMetaData

public void setMetaData(java.lang.String key,
                        java.lang.Object value)
Description copied from interface: IMetaContainer
Sets the MetaData attribute of the MetaContainer object

Specified by:
setMetaData in interface IMetaContainer
Parameters:
key - The new MetaData value
value - The new MetaData value

getMetaDataKeys

public java.util.Collection<java.lang.String> getMetaDataKeys()
Description copied from interface: IMetaContainer
return all the keys

Specified by:
getMetaDataKeys in interface IMetaContainer
Returns:

setAge

public void setAge(double age)

getAge

public double getAge()
Description copied from interface: IModel
age of the model used to shift the clock during runs

Specified by:
getAge in interface IModel
Returns:

setCycleSkippingEnabled

public void setCycleSkippingEnabled(boolean skipping)

isCycleSkippingEnabled

public boolean isCycleSkippingEnabled()

setPersistentExecutionEnabled

public void setPersistentExecutionEnabled(boolean persistent)

isPersistentExecutionEnabled

public boolean isPersistentExecutionEnabled()

getTimedEventQueue

public TimedEventQueue getTimedEventQueue()
Description copied from interface: IModel
the model must have a timed event queue. this queue keeps track of all internal model time-based changes (such as posting the results of a retrieval). Most productions output a few timed events

Specified by:
getTimedEventQueue in interface IModel

hasBeenInitialized

public boolean hasBeenInitialized()
Description copied from interface: IModel
has this models intiialize been called

Specified by:
hasBeenInitialized in interface IModel
Returns:

initialize

public void initialize()
                throws java.lang.Exception
initialize the model, calling initialize on buffers, and extensions in that order. this is called before the model starts to run Modules will have already been initialized, as they are initialized before extensions or instruments are installed..

Specified by:
initialize in interface IModel
Specified by:
initialize in interface IInitializable
Throws:
java.lang.Exception
See Also:
IModel.initialize()

addListener

public void addListener(IModelListener listener,
                        java.util.concurrent.Executor executor)
Specified by:
addListener in interface IModel

removeListener

public void removeListener(IModelListener listener)
Specified by:
removeListener in interface IModel

hasListeners

public boolean hasListeners()
Specified by:
hasListeners in interface IModel

dispatch

public void dispatch(ModelEvent modelEvent)
Specified by:
dispatch in interface IModel

addListener

public void addListener(IParameterListener listener,
                        java.util.concurrent.Executor executor)
Specified by:
addListener in interface IModel

removeListener

public void removeListener(IParameterListener listener)
Specified by:
removeListener in interface IModel

hasParameterListeners

public boolean hasParameterListeners()
Specified by:
hasParameterListeners in interface IModel

dispatch

public void dispatch(ParameterEvent modelEvent)
Specified by:
dispatch in interface IModel

getName

public java.lang.String getName()
Description copied from interface: IModel
everyone needs a name..

Specified by:
getName in interface IModel
Returns:

setName

public void setName(java.lang.String modelName)

getCycle

public long getCycle()
Specified by:
getCycle in interface IModel

setCycle

public void setCycle(long cycle)

toString

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