org.jactr.core.module.declarative.basic
Class AbstractDeclarativeModule

java.lang.Object
  extended by org.jactr.core.module.AbstractModule
      extended by org.jactr.core.module.declarative.basic.AbstractDeclarativeModule
All Implemented Interfaces:
IDeclarativeModule, IModule, IInitializable, IInstallable
Direct Known Subclasses:
DefaultDeclarativeModule

public abstract class AbstractDeclarativeModule
extends AbstractModule
implements IDeclarativeModule

Author:
harrison

Constructor Summary
AbstractDeclarativeModule(java.lang.String name)
           
 
Method Summary
 java.util.concurrent.Future<IChunk> addChunk(IChunk chunk)
          add chunk to DM.
 java.util.concurrent.Future<IChunkType> addChunkType(IChunkType chunkType)
          add chunktype to DM, delegated to addChunkTypeInternal(IChunkType) on AbstractModule.getExecutor()
 void addListener(IDeclarativeModuleListener listener, java.util.concurrent.Executor executor)
           
 java.util.concurrent.Future<IChunk> copyChunk(IChunk sourceChunk)
          return a copy of source chunk
 java.util.concurrent.Future<IChunk> createChunk(IChunkType parent, java.lang.String name)
          create a chunk by delegating to createChunkInternal(IChunkType, String) on AbstractModule.getExecutor()
 java.util.concurrent.Future<IChunkType> createChunkType(IChunkType parent, java.lang.String name)
          create chunktype, delegates to createChunkTypeInternal(IChunkType, String) on AbstractModule.getExecutor()
 IChunk getBusyChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 java.util.concurrent.Future<IChunk> getChunk(java.lang.String name)
          delegated
 java.util.concurrent.Future<java.util.Collection<IChunk>> getChunks()
          return all chunks.
 java.util.concurrent.Future<IChunkType> getChunkType(java.lang.String name)
          delegated
 java.util.concurrent.Future<java.util.Collection<IChunkType>> getChunkTypes()
          delegated
 IChunk getEmptyChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getErrorChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getFreeChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getFullChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getNewChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getRequestedChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 IChunk getUnrequestedChunk()
          snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.
 void initialize()
          this will be called after all the modules have been installed permitting the module to attach listeners to other modules.
 void removeListener(IDeclarativeModuleListener listener)
           
 
Methods inherited from class org.jactr.core.module.AbstractModule
delayedFuture, dispose, getExecutor, getModel, getName, immediateFuture, immediateReturn, install, uninstall
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jactr.core.module.declarative.IDeclarativeModule
dispose, findExactMatches, findPartialMatches, getNumberOfChunks, willEncode
 
Methods inherited from interface org.jactr.core.module.IModule
dispose, getModel, getName, install, reset
 
Methods inherited from interface org.jactr.core.utils.IInstallable
uninstall
 

Constructor Detail

AbstractDeclarativeModule

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

initialize

public 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
Specified by:
initialize in class AbstractModule

addListener

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

removeListener

public void removeListener(IDeclarativeModuleListener listener)
Specified by:
removeListener in interface IDeclarativeModule

getBusyChunk

public IChunk getBusyChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getBusyChunk in interface IDeclarativeModule
Returns:

getEmptyChunk

public IChunk getEmptyChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getEmptyChunk in interface IDeclarativeModule
Returns:

getErrorChunk

public IChunk getErrorChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getErrorChunk in interface IDeclarativeModule
Returns:

getFreeChunk

public IChunk getFreeChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getFreeChunk in interface IDeclarativeModule
Returns:

getFullChunk

public IChunk getFullChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getFullChunk in interface IDeclarativeModule
Returns:

getNewChunk

public IChunk getNewChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getNewChunk in interface IDeclarativeModule
Returns:

getRequestedChunk

public IChunk getRequestedChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getRequestedChunk in interface IDeclarativeModule
Returns:

getUnrequestedChunk

public IChunk getUnrequestedChunk()
Description copied from interface: IDeclarativeModule
snag the busy chunk.

Note : this should not be called by the declarative memory module if the retrieval will access the future methods as it might result in deadlock.

Specified by:
getUnrequestedChunk in interface IDeclarativeModule
Returns:

createChunk

public java.util.concurrent.Future<IChunk> createChunk(IChunkType parent,
                                                       java.lang.String name)
create a chunk by delegating to createChunkInternal(IChunkType, String) on AbstractModule.getExecutor()

Specified by:
createChunk in interface IDeclarativeModule
Parameters:
parent -
name -
Returns:
See Also:
IDeclarativeModule.createChunk(org.jactr.core.chunktype.IChunkType, java.lang.String)

addChunk

public java.util.concurrent.Future<IChunk> addChunk(IChunk chunk)
add chunk to DM. merely delegates to addChunkInternal(IChunk) on AbstractModule.getExecutor()

Specified by:
addChunk in interface IDeclarativeModule
Parameters:
chunk -
Returns:
See Also:
IDeclarativeModule.addChunk(org.jactr.core.chunk.IChunk)

copyChunk

public java.util.concurrent.Future<IChunk> copyChunk(IChunk sourceChunk)
Description copied from interface: IDeclarativeModule
return a copy of source chunk

Specified by:
copyChunk in interface IDeclarativeModule
Returns:

getChunk

public java.util.concurrent.Future<IChunk> getChunk(java.lang.String name)
delegated

Specified by:
getChunk in interface IDeclarativeModule
Parameters:
name -
Returns:
See Also:
IDeclarativeModule.getChunk(java.lang.String)

getChunks

public java.util.concurrent.Future<java.util.Collection<IChunk>> getChunks()
Description copied from interface: IDeclarativeModule
return all chunks. This can be a very expensive operation

Specified by:
getChunks in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunks()

createChunkType

public java.util.concurrent.Future<IChunkType> createChunkType(IChunkType parent,
                                                               java.lang.String name)
create chunktype, delegates to createChunkTypeInternal(IChunkType, String) on AbstractModule.getExecutor()

Specified by:
createChunkType in interface IDeclarativeModule
Parameters:
parent -
name -
Returns:
See Also:
IDeclarativeModule.createChunkType(org.jactr.core.chunktype.IChunkType, java.lang.String)

addChunkType

public java.util.concurrent.Future<IChunkType> addChunkType(IChunkType chunkType)
add chunktype to DM, delegated to addChunkTypeInternal(IChunkType) on AbstractModule.getExecutor()

Specified by:
addChunkType in interface IDeclarativeModule
Parameters:
chunkType -
Returns:
See Also:
IDeclarativeModule.addChunkType(org.jactr.core.chunktype.IChunkType)

getChunkType

public java.util.concurrent.Future<IChunkType> getChunkType(java.lang.String name)
delegated

Specified by:
getChunkType in interface IDeclarativeModule
Parameters:
name -
Returns:
See Also:
IDeclarativeModule.getChunkType(java.lang.String)

getChunkTypes

public java.util.concurrent.Future<java.util.Collection<IChunkType>> getChunkTypes()
delegated

Specified by:
getChunkTypes in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunkTypes()