org.jactr.core.buffer
Class AbstractActivationBuffer

java.lang.Object
  extended by org.jactr.core.buffer.AbstractActivationBuffer
All Implemented Interfaces:
IActivationBuffer, IInitializable, IParameterized
Direct Known Subclasses:
AbstractActivationBuffer6

public abstract class AbstractActivationBuffer
extends java.lang.Object
implements IActivationBuffer, IParameterized

basic implementation of an activation buffer that handles the spreading of activation to chunks. this is thread safe.

Author:
developer

Field Summary
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
           
 
Fields inherited from interface org.jactr.core.buffer.IActivationBuffer
AURAL, AURAL_LOCATION, GOAL, IMAGINAL, MOTOR, RETRIEVAL, VISUAL, VISUAL_LOCATION, VOCAL
 
Constructor Summary
AbstractActivationBuffer(java.lang.String name, IModel model, IModule module)
           
 
Method Summary
 void addListener(IActivationBufferListener abl, java.util.concurrent.Executor executor)
          add a buffer listener
 IChunk addSourceChunk(IChunk c)
          add chunk to the buffer.
 void clear()
          will call removeSourceChunkInternal for all the chunks and then recalculate activation
 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.
 void dispose()
          clean up resources, called by the module that created the buffer
 double getActivation()
          return the activation of the buffer
 IActivationSpreader getActivationSpreader()
           
 double getG()
          return the goal value of this buffer.
 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
 java.util.Collection<IChunk> getSourceChunks()
          return all the chunks in the buffer
 java.util.Collection<IChunk> getSourceChunks(java.util.Collection<IChunk> container)
           
 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.
 void removeListener(IActivationBufferListener abl)
          remove a buffer listener
 void removeSourceChunk(IChunk c)
          remove the chunk from the buffer.
 void setActivation(double activation)
          Set the value of the spreading activation.
 void setActivationSpreader(IActivationSpreader 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()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVATION_PARAM

public static final java.lang.String ACTIVATION_PARAM
Comment for ACTIVATION

See Also:
Constant Field Values

GOAL_VALUE_PARAM

public static final java.lang.String GOAL_VALUE_PARAM
Comment for GOAL_VALUE

See Also:
Constant Field Values

STRICT_HARVESTING_PARAM

public static final java.lang.String STRICT_HARVESTING_PARAM
See Also:
Constant Field Values
Constructor Detail

AbstractActivationBuffer

public AbstractActivationBuffer(java.lang.String name,
                                IModel model,
                                IModule module)
Method Detail

dispose

public void dispose()
Description copied from interface: IActivationBuffer
clean up resources, called by the module that created the buffer

Specified by:
dispose in interface IActivationBuffer

matched

public void matched(IChunk chunk)
Description copied from interface: IActivationBuffer
called from within an instantiation notifying the buffer that this chunk has been matched in the production that is about to fire.

Specified by:
matched in interface IActivationBuffer

setActivation

public final void setActivation(double activation)
Description copied from interface: IActivationBuffer
Set the value of the spreading activation. The source chunk will have this value applied to it and propogated to its contained chunks (contained the source chunk?s slots). Note: the specific behavior of this is not fully defined. Multiple capacity buffers might not implement an all or nothing contract and instead might distribute activation across chunks equally or by some other means.

Specified by:
setActivation in interface IActivationBuffer
Parameters:
activation - 0.0 to deactivate

getActivation

public final double getActivation()
Description copied from interface: IActivationBuffer
return the activation of the buffer

Specified by:
getActivation in interface IActivationBuffer
Returns:
The activation value

setG

public final void setG(double g)
Description copied from interface: IActivationBuffer
set the goal value of this buffer.. only used for the goal buffer at present

Specified by:
setG in interface IActivationBuffer
Parameters:
g - The new g value

getG

public final double getG()
Description copied from interface: IActivationBuffer
return the goal value of this buffer.

Specified by:
getG in interface IActivationBuffer
Returns:
The g value

setStrictHarvestingEnabled

public final void setStrictHarvestingEnabled(boolean enabled)

isStrictHarvestingEnabled

public final boolean isStrictHarvestingEnabled()
Description copied from interface: IActivationBuffer
strict harvesting forces the removal of buffer content that is matched against in the LHS, but not acted upon in the RHS. The buffer is not actually responsible for enforcing strict harvesting. see DefaultProceduralModule6

Specified by:
isStrictHarvestingEnabled in interface IActivationBuffer
Returns:

clear

public void clear()
will call removeSourceChunkInternal for all the chunks and then recalculate activation

Specified by:
clear in interface IActivationBuffer
See Also:
IActivationBuffer.clear()

setActivationSpreader

public void setActivationSpreader(IActivationSpreader spreader)

getActivationSpreader

public IActivationSpreader getActivationSpreader()

addSourceChunk

public IChunk addSourceChunk(IChunk c)
add chunk to the buffer. if addSourceChunkInternal(IChunk) returns not null, activation is spread and an event is fired

Specified by:
addSourceChunk in interface IActivationBuffer
Parameters:
c - chunk to be added
Returns:
the actual chunk added (in case a copy was made)
See Also:
IActivationBuffer.addSourceChunk(org.jactr.core.chunk.IChunk)

removeSourceChunk

public void removeSourceChunk(IChunk c)
remove the chunk from the buffer. if removeSourceChunkInternal(IChunk) returns true activation is reset and event fired

Specified by:
removeSourceChunk in interface IActivationBuffer
See Also:
IActivationBuffer.removeSourceChunk(org.jactr.core.chunk.IChunk)

getSourceChunk

public final IChunk getSourceChunk()
Description copied from interface: IActivationBuffer
return a chunk from the buffer - the exact behavior is specified by the particular buffer

Specified by:
getSourceChunk in interface IActivationBuffer

getSourceChunks

public final java.util.Collection<IChunk> getSourceChunks()
Description copied from interface: IActivationBuffer
return all the chunks in the buffer

Specified by:
getSourceChunks in interface IActivationBuffer

getSourceChunks

public final java.util.Collection<IChunk> getSourceChunks(java.util.Collection<IChunk> container)
Specified by:
getSourceChunks in interface IActivationBuffer

contains

public IChunk contains(IChunk c)
Description copied from interface: IActivationBuffer
returns the buffer's source chunk that is symbolically equal to c, or null if none is available or symbolically equal. For exact equality, use #getSourceChunks()#contains(IChunk)

Specified by:
contains in interface IActivationBuffer
See Also:
IChunk.equalsSymbolic(IChunk)

addListener

public void addListener(IActivationBufferListener abl,
                        java.util.concurrent.Executor executor)
Description copied from interface: IActivationBuffer
add a buffer listener

Specified by:
addListener in interface IActivationBuffer

removeListener

public void removeListener(IActivationBufferListener abl)
Description copied from interface: IActivationBuffer
remove a buffer listener

Specified by:
removeListener in interface IActivationBuffer

getName

public java.lang.String getName()
Description copied from interface: IActivationBuffer
return the buffer's name

Specified by:
getName in interface IActivationBuffer
Returns:
The name value

getModel

public IModel getModel()
Specified by:
getModel in interface IActivationBuffer

handlesEncoding

public boolean handlesEncoding()
Description copied from interface: IActivationBuffer
returns true if this buffer is responsible for handling the encoding of chunks that are in it. otherwise, the model will encode at removeSourceChunk

Specified by:
handlesEncoding in interface IActivationBuffer
Returns:

getModule

public IModule getModule()
Description copied from interface: IActivationBuffer
return the module that controls this buffer

Specified by:
getModule in interface IActivationBuffer
Returns:

getSetableParameters

public java.util.Collection<java.lang.String> getSetableParameters()
Description copied from interface: IParameterized
Return list of all parameters that can be set.

Specified by:
getSetableParameters in interface IParameterized
Returns:
See Also:
IParameterized.getSetableParameters()

getPossibleParameters

public java.util.Collection<java.lang.String> getPossibleParameters()
Description copied from interface: IParameterized
Return all parameters that can be read

Specified by:
getPossibleParameters in interface IParameterized
Returns:
See Also:
IParameterized.getPossibleParameters()

getParameter

public java.lang.String getParameter(java.lang.String parameter)
Description copied from interface: IParameterized
return parameter value - null if not defined.

Specified by:
getParameter in interface IParameterized
Parameters:
parameter -
Returns:
See Also:
IParameterized.getParameter(java.lang.String)

setParameter

public void setParameter(java.lang.String parameter,
                         java.lang.String value)
Description copied from interface: IParameterized
Set the named parameter

Specified by:
setParameter in interface IParameterized
Parameters:
parameter -
value -
See Also:
IParameterized.setParameter(java.lang.String, String)

initialize

public void initialize()
Description copied from interface: IInitializable
intialize this component

Specified by:
initialize in interface IInitializable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object