public class DefaultDeclarativeModule extends AbstractDeclarativeModule implements IDeclarativeModule, IParameterized, IRemovableDeclarativeModule
DefaultSearchSystem
for the indexing
of chunks.IActivationBuffer.handlesEncoding()
.ISubsymbolicChunkFactory
). Custom IChunk
s should not be
required as they are simply wrappers to the theoretically relevant contents. IChunkConfigurator
.http://jactr.org/node/121
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,IChunk> |
_allChunks |
protected java.util.Map<java.lang.String,IChunkType> |
_allChunkTypes |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
_chunkLock |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
_chunkTypeLock |
protected IActivationBufferListener |
_encodeChunksOnRemove
used to encode chunks after removal
|
protected DefaultSearchSystem |
_searchSystem |
static java.lang.String |
CHUNK_CONFIGURATOR_PARAM |
static java.lang.String |
CHUNK_FACTORY_PARAM |
static java.lang.String |
CHUNK_NAMER_PARAM |
static java.lang.String |
CHUNK_TYPE_CONFIGURATOR_PARAM |
static java.lang.String |
CHUNK_TYPE_FACTORY_PARAM |
static java.lang.String |
CHUNK_TYPE_NAMER_PARAM |
static java.lang.String |
SUBSYMBOLIC_CHUNK_FACTORY_PARAM |
static java.lang.String |
SUBSYMBOLIC_CHUNK_TYPE_FACTORY_PARAM |
static java.lang.String |
SYMBOLIC_CHUNK_FACTORY_PARAM |
static java.lang.String |
SYMBOLIC_CHUNK_TYPE_FACTORY_PARAM |
_activationSorter, SUSPEND_DISPOSAL_KEY
Constructor and Description |
---|
DefaultDeclarativeModule() |
Modifier and Type | Method and Description |
---|---|
protected IChunk |
addChunkInternal(IChunk chunk,
java.util.Collection<IChunk> possibleMatches)
add the chunk to DM on the module's executor.
|
protected IChunkType |
addChunkTypeInternal(IChunkType chunkType)
create a callable that will do all the work of adding a chunktype to the
model and firing the appropriate events
|
void |
dispose()
release any resources.
|
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
|
protected java.util.Collection<IChunk> |
findExactMatchesInternal(ChunkTypeRequest pattern,
java.util.Comparator<IChunk> sorter,
IChunkFilter filter) |
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
|
protected java.util.Collection<IChunk> |
findPartialMatchesInternal(ChunkTypeRequest pattern,
java.util.Comparator<IChunk> sorter,
IChunkFilter filter) |
protected IChunk |
getChunkInternal(java.lang.String name) |
protected java.util.Collection<IChunk> |
getChunksInternal() |
protected IChunkType |
getChunkTypeInternal(java.lang.String name) |
protected java.util.Collection<IChunkType> |
getChunkTypesInternal() |
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
|
java.util.Collection<java.lang.String> |
getSetableParameters()
Return list of all parameters that can be set.
|
void |
initialize()
here we attach a buffer listener to all the buffers and catch the removal
notifications to see if we should encode the chunk..
|
void |
removeChunk(IChunk chunk)
merely remove the chunk from the internal DM store and the chunktype store.
|
protected void |
removeChunkInternal(IChunk chunk) |
void |
reset()
reset the module.
|
void |
setParameter(java.lang.String key,
java.lang.String value)
Set the named parameter
|
addChunk, addChunkType, addListener, configure, configure, copyChunk, copyChunk, copyChunkInternal, createChunk, createChunkInternal, createChunkType, createChunkType, createChunkTypeInternal, deferredEncode, deferredEncode, dispatch, dispose, disposeInternal, fireChunkAdded, fireChunkCreated, fireChunkDisposed, fireChunkRemoved, fireChunksMerged, fireChunkTypeAdded, fireChunkTypeCreated, fireChunkTypeDisposed, fireChunkTypesMerged, flush, getAssociativeLinkageSystem, getBusyChunk, getChunk, getChunkConfigurator, getChunkFactory, getChunkNamer, getChunks, getChunkType, getChunkTypeConfigurator, getChunkTypeFactory, getChunkTypeNamer, getChunkTypes, getEmptyChunk, getErrorChunk, getFreeChunk, getFullChunk, getNewChunk, getRequestedChunk, getSubsymbolicChunkFactory, getSubsymbolicChunkTypeFactory, getSymbolicChunkFactory, getSymbolicChunkTypeFactory, getUnrequestedChunk, hasListeners, install, isDisposalSuspended, merge, mergeChunksInternal, processPendingDisposals, processPendingEncodingAndDisposals, processPendingEncodings, removeListener, setAssociativeLinkageSystem, setChunkConfigurator, setChunkFactory, setChunkNamer, setChunkTypeConfigurator, setChunkTypeFactory, setChunkTypeNamer, setDisposalSuspended, setSubsymbolicChunkFactory, setSubsymbolicChunkTypeFactory, setSymbolicChunkFactory, setSymbolicChunkTypeFactory, uninstall, willEncode
createBuffers, delayedFuture, delayedFuture, getExecutor, getModel, getName, getSafeName, immediateFuture, immediateReturn, setExecutor
addAdapterFactory, getAdapter, removeAdapterFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChunk, addChunkType, addListener, copyChunk, copyChunk, createChunk, createChunkType, createChunkType, dispose, flush, getAssociativeLinkageSystem, getBusyChunk, getChunk, getChunks, getChunkType, getChunkTypes, getEmptyChunk, getErrorChunk, getFreeChunk, getFullChunk, getNewChunk, getRequestedChunk, getUnrequestedChunk, removeListener, setAssociativeLinkageSystem, willEncode
uninstall
getAdapter
public static final java.lang.String CHUNK_FACTORY_PARAM
public static final java.lang.String SYMBOLIC_CHUNK_FACTORY_PARAM
public static final java.lang.String SUBSYMBOLIC_CHUNK_FACTORY_PARAM
public static final java.lang.String CHUNK_TYPE_FACTORY_PARAM
public static final java.lang.String SYMBOLIC_CHUNK_TYPE_FACTORY_PARAM
public static final java.lang.String SUBSYMBOLIC_CHUNK_TYPE_FACTORY_PARAM
public static final java.lang.String CHUNK_NAMER_PARAM
public static final java.lang.String CHUNK_CONFIGURATOR_PARAM
public static final java.lang.String CHUNK_TYPE_NAMER_PARAM
public static final java.lang.String CHUNK_TYPE_CONFIGURATOR_PARAM
protected java.util.concurrent.locks.ReentrantReadWriteLock _chunkTypeLock
protected java.util.concurrent.locks.ReentrantReadWriteLock _chunkLock
protected DefaultSearchSystem _searchSystem
protected java.util.Map<java.lang.String,IChunk> _allChunks
protected java.util.Map<java.lang.String,IChunkType> _allChunkTypes
protected IActivationBufferListener _encodeChunksOnRemove
public void dispose()
IModule
dispose
in interface IModule
dispose
in class AbstractModule
protected IChunk addChunkInternal(IChunk chunk, java.util.Collection<IChunk> possibleMatches)
AbstractDeclarativeModule
addChunkInternal
in class AbstractDeclarativeModule
possibleMatches
- TODOpublic void removeChunk(IChunk chunk)
removeChunk
in interface IRemovableDeclarativeModule
chunk
- protected void removeChunkInternal(IChunk chunk)
protected IChunkType addChunkTypeInternal(IChunkType chunkType)
addChunkTypeInternal
in class AbstractDeclarativeModule
chunkType
- protected java.util.Collection<IChunk> findExactMatchesInternal(ChunkTypeRequest pattern, java.util.Comparator<IChunk> sorter, IChunkFilter filter)
protected java.util.Collection<IChunk> findPartialMatchesInternal(ChunkTypeRequest pattern, java.util.Comparator<IChunk> sorter, IChunkFilter filter)
protected IChunk getChunkInternal(java.lang.String name)
getChunkInternal
in class AbstractDeclarativeModule
protected IChunkType getChunkTypeInternal(java.lang.String name)
getChunkTypeInternal
in class AbstractDeclarativeModule
protected java.util.Collection<IChunkType> getChunkTypesInternal()
getChunkTypesInternal
in class AbstractDeclarativeModule
protected java.util.Collection<IChunk> getChunksInternal()
getChunksInternal
in class AbstractDeclarativeModule
public long getNumberOfChunks()
IDeclarativeModule
getNumberOfChunks
in interface IDeclarativeModule
public void initialize()
initialize
in interface IModule
initialize
in interface IInitializable
initialize
in class AbstractDeclarativeModule
AbstractModule.initialize()
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 nullIDeclarativeModule.findExactMatches(ChunkTypeRequest,
java.util.Comparator, IChunkFilter)
public 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
- TODOIDeclarativeModule.findPartialMatches(ChunkTypeRequest,
java.util.Comparator, IChunkFilter)
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