public class DelegatedDeclarativeModule extends java.lang.Object implements IDeclarativeModule, IParameterized
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
_deferredParameters |
protected IDeclarativeModule |
_delegate |
protected IModel |
_model |
static java.lang.String |
DECLARATIVE_DELEGATE_PARAM |
Constructor and Description |
---|
DelegatedDeclarativeModule() |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<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.CompletableFuture<IChunkType> |
addChunkType(IChunkType chunkType)
add the chunktype to the model.
|
void |
addListener(IDeclarativeModuleListener listener,
java.util.concurrent.Executor executor) |
java.util.concurrent.CompletableFuture<IChunk> |
copyChunk(IChunk sourceChunk)
return a copy of source chunk
|
java.util.concurrent.CompletableFuture<IChunk> |
copyChunk(IChunk sourceChunk,
boolean copySubsymbolics) |
java.util.concurrent.CompletableFuture<IChunk> |
createChunk(IChunkType parent,
java.lang.String name)
create a chunk to later be inserted.
|
java.util.concurrent.CompletableFuture<IChunkType> |
createChunkType(java.util.Collection<IChunkType> parents,
java.lang.String name)
create a new chunktype to be added after its symbolic contents have been
set.
|
java.util.concurrent.CompletableFuture<IChunkType> |
createChunkType(IChunkType parent,
java.lang.String name) |
void |
dispose()
release any resources.
|
void |
dispose(IChunk chunk)
request that this chunk be disposed.
|
java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> |
findExactMatches(ChunkTypeRequest request,
java.util.Comparator<IChunk> sorter,
IChunkFilter filter)
search DM for all the chunks that match pattern, sorting using sorter, that
are above activationThreshold
|
java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> |
findPartialMatches(ChunkTypeRequest request,
java.util.Comparator<IChunk> sorter,
IChunkFilter filter)
search DM for all the chunks that partially match
|
void |
flush()
force all pending deferred operations to execute (dispose, encode, etc)
|
java.lang.Object |
getAdapter(java.lang.Class adapterClass) |
IAssociativeLinkageSystem |
getAssociativeLinkageSystem()
code responsible for the setting up and maintaining of associative links,
may be null.
|
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.CompletableFuture<IChunk> |
getChunk(java.lang.String name)
return the named chunk, case insensitive but preserving
|
java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> |
getChunks()
return all chunks.
|
java.util.concurrent.CompletableFuture<IChunkType> |
getChunkType(java.lang.String name)
return the named chunktype.
|
java.util.concurrent.CompletableFuture<java.util.Collection<IChunkType>> |
getChunkTypes()
return all the chunk types in this model
|
IDeclarativeModule |
getDelegate() |
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. |
IModel |
getModel()
return the model this module is installed into
|
java.lang.String |
getName()
the name of the module
|
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.
|
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
|
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. |
java.util.Collection<java.lang.String> |
getSetableParameters()
Return list of all parameters that can be set.
|
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 |
install(IModel model)
called from the model during IModel.install(IModule).
|
void |
removeListener(IDeclarativeModuleListener listener) |
void |
reset()
reset the module.
|
void |
setAssociativeLinkageSystem(IAssociativeLinkageSystem linkageSystem)
the code responsible for linking memories.
|
void |
setParameter(java.lang.String key,
java.lang.String value)
Set the named parameter
|
void |
uninstall(IModel model)
remove the element from this model.
|
boolean |
willEncode(IChunk chunk)
because encoding might be async, we need a method to determine if a given
chunk is scheduled for encoding
|
protected IDeclarativeModule _delegate
protected IModel _model
protected java.util.Map<java.lang.String,java.lang.String> _deferredParameters
public static final java.lang.String DECLARATIVE_DELEGATE_PARAM
public IDeclarativeModule getDelegate()
public void install(IModel model)
IModule
install
in interface IModule
install
in interface IInstallable
IInstallable.install(org.jactr.core.model.IModel)
public void initialize()
IModule
initialize
in interface IModule
initialize
in interface IInitializable
public java.lang.String getName()
IModule
public IModel getModel()
IModule
public void dispose()
IModule
public void reset()
IModule
public void uninstall(IModel model)
IInstallable
uninstall
in interface IInstallable
public java.lang.Object getAdapter(java.lang.Class adapterClass)
getAdapter
in interface IAdaptable
public void setParameter(java.lang.String key, java.lang.String value)
IParameterized
setParameter
in interface IParameterized
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 java.util.concurrent.CompletableFuture<IChunkType> createChunkType(IChunkType parent, java.lang.String name)
createChunkType
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunkType> createChunkType(java.util.Collection<IChunkType> parents, java.lang.String name)
IDeclarativeModule
createChunkType
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunkType> addChunkType(IChunkType chunkType)
IDeclarativeModule
addChunkType
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunkType> getChunkType(java.lang.String name)
IDeclarativeModule
getChunkType
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<java.util.Collection<IChunkType>> getChunkTypes()
IDeclarativeModule
getChunkTypes
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunk> createChunk(IChunkType parent, java.lang.String name)
IDeclarativeModule
createChunk
in interface IDeclarativeModule
parent
- must not be null (duh)public void dispose(IChunk chunk)
IDeclarativeModule
dispose
in interface IDeclarativeModule
public IAssociativeLinkageSystem getAssociativeLinkageSystem()
IDeclarativeModule
getAssociativeLinkageSystem
in interface IDeclarativeModule
public void setAssociativeLinkageSystem(IAssociativeLinkageSystem linkageSystem)
IDeclarativeModule
setAssociativeLinkageSystem
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunk> copyChunk(IChunk sourceChunk)
IDeclarativeModule
copyChunk
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunk> copyChunk(IChunk sourceChunk, boolean copySubsymbolics)
copyChunk
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunk> addChunk(IChunk chunk)
IDeclarativeModule
addChunk
in interface IDeclarativeModule
public boolean willEncode(IChunk chunk)
IDeclarativeModule
willEncode
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<IChunk> getChunk(java.lang.String name)
IDeclarativeModule
getChunk
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> getChunks()
IDeclarativeModule
getChunks
in interface IDeclarativeModule
public long getNumberOfChunks()
IDeclarativeModule
getNumberOfChunks
in interface IDeclarativeModule
public java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> findExactMatches(ChunkTypeRequest request, java.util.Comparator<IChunk> sorter, IChunkFilter filter)
IDeclarativeModule
findExactMatches
in interface IDeclarativeModule
sorter
- sort order, may be nullfilter
- filter function, may be nullpublic java.util.concurrent.CompletableFuture<java.util.Collection<IChunk>> findPartialMatches(ChunkTypeRequest request, java.util.Comparator<IChunk> sorter, IChunkFilter filter)
IDeclarativeModule
findPartialMatches
in interface IDeclarativeModule
sorter
- may be nullfilter
- TODOpublic IChunk getBusyChunk()
IDeclarativeModule
getBusyChunk
in interface IDeclarativeModule
public IChunk getEmptyChunk()
IDeclarativeModule
getEmptyChunk
in interface IDeclarativeModule
public IChunk getErrorChunk()
IDeclarativeModule
getErrorChunk
in interface IDeclarativeModule
public IChunk getFreeChunk()
IDeclarativeModule
getFreeChunk
in interface IDeclarativeModule
public IChunk getFullChunk()
IDeclarativeModule
getFullChunk
in interface IDeclarativeModule
public IChunk getNewChunk()
IDeclarativeModule
getNewChunk
in interface IDeclarativeModule
public IChunk getRequestedChunk()
IDeclarativeModule
getRequestedChunk
in interface IDeclarativeModule
public IChunk getUnrequestedChunk()
IDeclarativeModule
getUnrequestedChunk
in interface IDeclarativeModule
public void addListener(IDeclarativeModuleListener listener, java.util.concurrent.Executor executor)
addListener
in interface IDeclarativeModule
public void removeListener(IDeclarativeModuleListener listener)
removeListener
in interface IDeclarativeModule
public void flush()
IDeclarativeModule
flush
in interface IDeclarativeModule