org.jactr.core.module.declarative
Interface IDeclarativeModule

All Superinterfaces:
IInitializable, IInstallable, IModule
All Known Subinterfaces:
IDeclarativeModule4, IDeclarativeModule5
All Known Implementing Classes:
AbstractDeclarativeModule, DefaultDeclarativeModule, DefaultDeclarativeModule6

public interface IDeclarativeModule
extends IModule

one of two specialized modules, this one handles all declarative memory operations for the model, in particular adding and retrieving of chunks, chunktypes all operation return values are wrapped in Future<> to better support backed concurrencies

Author:
developer
See Also:
Future

Method Summary
 java.util.concurrent.Future<IChunk> addChunk(IChunk chunk)
          add this chunk to the model and optionally check for duplicates so that it can be merged if necessary
 java.util.concurrent.Future<IChunkType> addChunkType(IChunkType chunkType)
          add the chunktype to the model.
 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 to later be inserted.
 java.util.concurrent.Future<IChunkType> createChunkType(IChunkType parent, java.lang.String name)
          create a new chunktype to be added after its symbolic contents have been set.
 void dispose(IChunk chunk)
          request that this chunk be disposed.
 java.util.concurrent.Future<java.util.Collection<IChunk>> findExactMatches(ChunkTypeRequest request, java.util.Comparator<IChunk> sorter, double activationThreshold, boolean bestOne)
          search DM for all the chunks that match pattern, sorting using sorter, that are above activationThreshold
 java.util.concurrent.Future<java.util.Collection<IChunk>> findPartialMatches(ChunkTypeRequest request, java.util.Comparator<IChunk> sorter, double activationThreshold, boolean bestOne)
          search DM for all the chunks that partially match
 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)
          return the named chunk, case insensitive but preserving
 java.util.concurrent.Future<java.util.Collection<IChunk>> getChunks()
          return all chunks.
 java.util.concurrent.Future<IChunkType> getChunkType(java.lang.String name)
          return the named chunktype.
 java.util.concurrent.Future<java.util.Collection<IChunkType>> getChunkTypes()
          return all the chunk types in this model
 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.
 long getNumberOfChunks()
          return the number of chunks in the model.
 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 removeListener(IDeclarativeModuleListener listener)
           
 boolean willEncode(IChunk chunk)
          because encoding might be async, we need a method to determine if a given chunk is scheduled for encoding
 
Methods inherited from interface org.jactr.core.module.IModule
dispose, getModel, getName, initialize, install, reset
 
Methods inherited from interface org.jactr.core.utils.IInstallable
uninstall
 

Method Detail

createChunkType

java.util.concurrent.Future<IChunkType> createChunkType(IChunkType parent,
                                                        java.lang.String name)
create a new chunktype to be added after its symbolic contents have been set. typically this will just delegate to the factory methods, but is provided here so that declarative modules can insert custom creators

Parameters:
parent - maybe null
name -
Returns:

addChunkType

java.util.concurrent.Future<IChunkType> addChunkType(IChunkType chunkType)
add the chunktype to the model. this chunktype should have been created by createChunkType(). It will call the IChunkType.encode() method, add this chunktype to the parent's list of children (if there is a parent) and then add it to the internal data stores

Parameters:
chunkType -
Returns:

getChunkType

java.util.concurrent.Future<IChunkType> getChunkType(java.lang.String name)
return the named chunktype. Case insensitive, but preserving

Parameters:
name -
Returns:

getChunkTypes

java.util.concurrent.Future<java.util.Collection<IChunkType>> getChunkTypes()
return all the chunk types in this model

Returns:

createChunk

java.util.concurrent.Future<IChunk> createChunk(IChunkType parent,
                                                java.lang.String name)
create a chunk to later be inserted.

Parameters:
parent - must not be null (duh)
name -
Returns:

dispose

void dispose(IChunk chunk)
request that this chunk be disposed.

Parameters:
chunk -

copyChunk

java.util.concurrent.Future<IChunk> copyChunk(IChunk sourceChunk)
return a copy of source chunk

Parameters:
sourceChunk -
Returns:

addChunk

java.util.concurrent.Future<IChunk> addChunk(IChunk chunk)
add this chunk to the model and optionally check for duplicates so that it can be merged if necessary

Parameters:
chunk -
checkForDuplicates -
Returns:
a future wrapper of the actual chunk reference that was installed. if the chunk was actually merged, the original chunk is returned

willEncode

boolean willEncode(IChunk chunk)
because encoding might be async, we need a method to determine if a given chunk is scheduled for encoding

Parameters:
chunk -
Returns:

getChunk

java.util.concurrent.Future<IChunk> getChunk(java.lang.String name)
return the named chunk, case insensitive but preserving

Parameters:
name -
Returns:

getChunks

java.util.concurrent.Future<java.util.Collection<IChunk>> getChunks()
return all chunks. This can be a very expensive operation

Returns:

getNumberOfChunks

long getNumberOfChunks()
return the number of chunks in the model. this might be an estimate

Returns:

findExactMatches

java.util.concurrent.Future<java.util.Collection<IChunk>> findExactMatches(ChunkTypeRequest request,
                                                                           java.util.Comparator<IChunk> sorter,
                                                                           double activationThreshold,
                                                                           boolean bestOne)
search DM for all the chunks that match pattern, sorting using sorter, that are above activationThreshold

Parameters:
request -
sorter - may be null
activationThreshold -
bestOne - find only best one
Returns:

findPartialMatches

java.util.concurrent.Future<java.util.Collection<IChunk>> findPartialMatches(ChunkTypeRequest request,
                                                                             java.util.Comparator<IChunk> sorter,
                                                                             double activationThreshold,
                                                                             boolean bestOne)
search DM for all the chunks that partially match

Parameters:
request -
sorter - may be null
activationThreshold -
bestOne - true if you only want the best one chunk
Returns:

getBusyChunk

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.

Returns:

getEmptyChunk

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.

Returns:

getErrorChunk

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.

Returns:

getFreeChunk

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.

Returns:

getFullChunk

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.

Returns:

getNewChunk

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.

Returns:

getRequestedChunk

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.

Returns:

getUnrequestedChunk

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.

Returns:

addListener

void addListener(IDeclarativeModuleListener listener,
                 java.util.concurrent.Executor executor)

removeListener

void removeListener(IDeclarativeModuleListener listener)