public abstract class AbstractActivationBuffer extends DefaultAdaptable implements IActivationBuffer, IParameterized
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTIVATION_PARAM
Comment for
ACTIVATION |
static java.lang.String |
GOAL_VALUE_PARAM
Comment for
GOAL_VALUE |
static java.lang.String |
STRICT_HARVESTING_PARAM |
AURAL, AURAL_LOCATION, GOAL, IMAGINAL, MOTOR, RETRIEVAL, VISUAL, VISUAL_LOCATION, VOCAL
Constructor and Description |
---|
AbstractActivationBuffer(java.lang.String name,
IModel model,
IModule module) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(IActivationBufferListener abl,
java.util.concurrent.Executor executor)
add a buffer listener
|
IChunk |
addSourceChunk(IChunk c)
add chunk to the buffer.
|
protected abstract IChunk |
addSourceChunkInternal(IChunk chunkToInsert)
return the source chunk that was actually inserted into the buffer (i.e.
|
void |
clear()
will call removeSourceChunkInternal for all the chunks and then recalculate
activation
|
protected java.util.Collection<IChunk> |
clearInternal()
called within the lock
|
IChunk |
contains(IChunk c)
returns the buffer's source chunk that is symbolically equal to c, or null
if none is available or symbolically equal.
|
IChunk |
containsExact(IChunk c) |
void |
dispose()
clean up resources, called by the module that created the buffer
|
double |
getActivation()
return the activation of the buffer
|
ISourceActivationSpreader |
getActivationSpreader() |
protected ACTREventDispatcher<IActivationBuffer,IActivationBufferListener> |
getEventDispatcher() |
double |
getG()
return the goal value of this buffer.
|
protected java.util.concurrent.locks.ReentrantReadWriteLock |
getLock() |
IModel |
getModel() |
IModule |
getModule()
return the module that controls this buffer
|
java.lang.String |
getName()
return the buffer's name
|
java.lang.String |
getParameter(java.lang.String parameter)
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.
|
IChunk |
getSourceChunk()
return a chunk from the buffer - the exact behavior is specified by the
particular buffer
|
protected abstract IChunk |
getSourceChunkInternal()
return the source chunk from the internal backing store
|
java.util.Collection<IChunk> |
getSourceChunks()
return all the chunks in the buffer
|
java.util.Collection<IChunk> |
getSourceChunks(java.util.Collection<IChunk> container) |
protected abstract java.util.Collection<IChunk> |
getSourceChunksInternal(java.util.Collection<IChunk> container) |
protected void |
grabReferences()
called once the model is started.
|
boolean |
handlesEncoding()
returns true if this buffer is responsible for handling the encoding of
chunks that are in it.
|
void |
initialize()
intialize this component
|
boolean |
isStrictHarvestingEnabled()
strict harvesting forces the removal of buffer content that is matched
against in the LHS, but not acted upon in the RHS.
|
void |
matched(IChunk chunk)
called from within an instantiation notifying the buffer that this chunk
has been matched in the production that is about to fire.
|
protected boolean |
matchedInternal(IChunk chunk)
return true if the matched event should be fired
|
void |
removeListener(IActivationBufferListener abl)
remove a buffer listener
|
void |
removeSourceChunk(IChunk c)
remove the chunk from the buffer.
|
protected abstract boolean |
removeSourceChunkInternal(IChunk chunkToRemove)
do the actual work of removing chunkToRemove from the buffer.
|
void |
setActivation(double activation)
Set the value of the spreading activation.
|
void |
setActivationSpreader(ISourceActivationSpreader spreader) |
void |
setG(double g)
set the goal value of this buffer..
|
void |
setParameter(java.lang.String parameter,
java.lang.String value)
Set the named parameter
|
void |
setStrictHarvestingEnabled(boolean enabled) |
java.lang.String |
toString() |
addAdapterFactory, getAdapter, removeAdapterFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAdapter
public static final java.lang.String ACTIVATION_PARAM
ACTIVATION
public static final java.lang.String GOAL_VALUE_PARAM
GOAL_VALUE
public static final java.lang.String STRICT_HARVESTING_PARAM
public void dispose()
IActivationBuffer
dispose
in interface IActivationBuffer
protected java.util.concurrent.locks.ReentrantReadWriteLock getLock()
public void matched(IChunk chunk)
IActivationBuffer
matched
in interface IActivationBuffer
protected boolean matchedInternal(IChunk chunk)
chunk
- public final void setActivation(double activation)
IActivationBuffer
setActivation
in interface IActivationBuffer
activation
- 0.0 to deactivatepublic final double getActivation()
IActivationBuffer
getActivation
in interface IActivationBuffer
public final void setG(double g)
IActivationBuffer
setG
in interface IActivationBuffer
g
- The new g valuepublic final double getG()
IActivationBuffer
getG
in interface IActivationBuffer
public final void setStrictHarvestingEnabled(boolean enabled)
public final boolean isStrictHarvestingEnabled()
IActivationBuffer
DefaultProceduralModule6
isStrictHarvestingEnabled
in interface IActivationBuffer
protected final ACTREventDispatcher<IActivationBuffer,IActivationBufferListener> getEventDispatcher()
public void clear()
clear
in interface IActivationBuffer
IActivationBuffer.clear()
protected java.util.Collection<IChunk> clearInternal()
public void setActivationSpreader(ISourceActivationSpreader spreader)
public ISourceActivationSpreader getActivationSpreader()
protected abstract IChunk addSourceChunkInternal(IChunk chunkToInsert)
chunkToInsert
- the chunk to be inserted, will never be null nor already in the
bufferpublic IChunk addSourceChunk(IChunk c)
addSourceChunk
in interface IActivationBuffer
c
- chunk to be addedIActivationBuffer.addSourceChunk(org.jactr.core.chunk.IChunk)
protected abstract boolean removeSourceChunkInternal(IChunk chunkToRemove)
chunkToRemove
- chunk that is in the buffer, never nullpublic void removeSourceChunk(IChunk c)
removeSourceChunk
in interface IActivationBuffer
IActivationBuffer.removeSourceChunk(org.jactr.core.chunk.IChunk)
public final IChunk getSourceChunk()
IActivationBuffer
getSourceChunk
in interface IActivationBuffer
protected abstract IChunk getSourceChunkInternal()
public final java.util.Collection<IChunk> getSourceChunks()
IActivationBuffer
getSourceChunks
in interface IActivationBuffer
public final java.util.Collection<IChunk> getSourceChunks(java.util.Collection<IChunk> container)
getSourceChunks
in interface IActivationBuffer
protected abstract java.util.Collection<IChunk> getSourceChunksInternal(java.util.Collection<IChunk> container)
public IChunk contains(IChunk c)
IActivationBuffer
#getSourceChunks()#contains(IChunk)
contains
in interface IActivationBuffer
IChunk.equalsSymbolic(IChunk)
public void addListener(IActivationBufferListener abl, java.util.concurrent.Executor executor)
IActivationBuffer
addListener
in interface IActivationBuffer
public void removeListener(IActivationBufferListener abl)
IActivationBuffer
removeListener
in interface IActivationBuffer
public java.lang.String getName()
IActivationBuffer
getName
in interface IActivationBuffer
public IModel getModel()
getModel
in interface IActivationBuffer
public boolean handlesEncoding()
IActivationBuffer
handlesEncoding
in interface IActivationBuffer
public IModule getModule()
IActivationBuffer
getModule
in interface IActivationBuffer
public java.util.Collection<java.lang.String> getSetableParameters()
IParameterized
getSetableParameters
in interface IParameterized
IParameterized.getSetableParameters()
public java.util.Collection<java.lang.String> getPossibleParameters()
IParameterized
getPossibleParameters
in interface IParameterized
IParameterized.getPossibleParameters()
public java.lang.String getParameter(java.lang.String parameter)
IParameterized
getParameter
in interface IParameterized
parameter
- IParameterized.getParameter(java.lang.String)
public void setParameter(java.lang.String parameter, java.lang.String value)
IParameterized
setParameter
in interface IParameterized
parameter
- value
- IParameterized.setParameter(java.lang.String,
String)
public void initialize()
IInitializable
initialize
in interface IInitializable
protected void grabReferences()
public java.lang.String toString()
toString
in class java.lang.Object