org.jactr.core.module.declarative.six
Class DefaultDeclarativeModule6

java.lang.Object
  extended by org.jactr.core.module.AbstractModule
      extended by org.jactr.core.module.declarative.six.DefaultDeclarativeModule6
All Implemented Interfaces:
IDeclarativeModule5, IDeclarativeModule4, IDeclarativeModule, IModule, IInitializable, IInstallable, IParameterized

public class DefaultDeclarativeModule6
extends AbstractModule
implements IDeclarativeModule, IDeclarativeModule4, IDeclarativeModule5, IParameterized


Field Summary
 
Fields inherited from interface org.jactr.core.module.declarative.four.IDeclarativeModule4
ACTIVATION_NOISE, BASE_LEVEL_CONSTANT, PARTIAL_MATCHING, PERMANENT_ACTIVATION_NOISE
 
Fields inherited from interface org.jactr.core.module.declarative.five.IDeclarativeModule5
MAXIMUM_DIFFERENCE, MAXIMUM_SIMILARITY, MISMATCH_PENALTY
 
Constructor Summary
DefaultDeclarativeModule6()
           
 
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()
          release any resources.
 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
 double getActivationNoise()
           
 double getBaseLevelConstant()
           
 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.
 double getMaximumDifference()
           
 double getMaximumSimilarity()
           
 double getMismatchPenalty()
          return the activation penalty for mismatches this parameter only applies if partial matching is enabled
 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.
 double getPermanentActivationNoise()
           
 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.
 double getSimilarity(java.lang.Object one, java.lang.Object two)
           
 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()
          here we attach a buffer listener to all the buffers and catch the removal notifications to see if we should encode the chunk..
 boolean isPartialMatchingEnabled()
           
 void removeListener(IDeclarativeModuleListener listener)
           
 void setActivationNoise(double noise)
           
 void setBaseLevelConstant(double base)
           
 void setMaximumDifference(double maxDiff)
           
 void setMaximumSimilarity(double maxSim)
           
 void setMismatchPenalty(double mismatch)
          set the activation penalty for a mismatched slot value
 void setParameter(java.lang.String key, java.lang.String value)
          Set the named parameter
 void setPartialMatchingEnabled(boolean enable)
           
 void setPermanentActivationNoise(double noise)
           
 void setSimilarity(java.lang.Object one, java.lang.Object two, double sim)
           
 
Methods inherited from class org.jactr.core.module.AbstractModule
delayedFuture, getExecutor, getModel, getName, getSafeName, immediateFuture, immediateReturn, install, uninstall
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jactr.core.module.IModule
getModel, getName, install
 
Methods inherited from interface org.jactr.core.utils.IInstallable
uninstall
 
Methods inherited from interface org.jactr.core.module.IModule
getModel, getName, install
 
Methods inherited from interface org.jactr.core.utils.IInstallable
uninstall
 
Methods inherited from interface org.jactr.core.module.IModule
getModel, getName, install
 
Methods inherited from interface org.jactr.core.utils.IInstallable
uninstall
 

Constructor Detail

DefaultDeclarativeModule6

public DefaultDeclarativeModule6()
Method Detail

dispose

public void dispose()
Description copied from interface: IModule
release any resources. this should only be called by the model during its own dispose method (assuming that this module is still installed) and should not result in the propogation of ANY events. The module should dispose of all its resources, including buffers

Specified by:
dispose in interface IModule
Overrides:
dispose in class AbstractModule

getActivationNoise

public double getActivationNoise()
Specified by:
getActivationNoise in interface IDeclarativeModule4

getPermanentActivationNoise

public double getPermanentActivationNoise()
Specified by:
getPermanentActivationNoise in interface IDeclarativeModule4

isPartialMatchingEnabled

public boolean isPartialMatchingEnabled()
Specified by:
isPartialMatchingEnabled in interface IDeclarativeModule4

setActivationNoise

public void setActivationNoise(double noise)
Specified by:
setActivationNoise in interface IDeclarativeModule4

setPartialMatchingEnabled

public void setPartialMatchingEnabled(boolean enable)
Specified by:
setPartialMatchingEnabled in interface IDeclarativeModule4

setPermanentActivationNoise

public void setPermanentActivationNoise(double noise)
Specified by:
setPermanentActivationNoise in interface IDeclarativeModule4

getMismatchPenalty

public double getMismatchPenalty()
Description copied from interface: IDeclarativeModule4
return the activation penalty for mismatches this parameter only applies if partial matching is enabled

Specified by:
getMismatchPenalty in interface IDeclarativeModule5
Specified by:
getMismatchPenalty in interface IDeclarativeModule4
Returns:
The MismatchPenalty value

setMismatchPenalty

public void setMismatchPenalty(double mismatch)
Description copied from interface: IDeclarativeModule4
set the activation penalty for a mismatched slot value

Specified by:
setMismatchPenalty in interface IDeclarativeModule5
Specified by:
setMismatchPenalty in interface IDeclarativeModule4

getMaximumDifference

public double getMaximumDifference()
Specified by:
getMaximumDifference in interface IDeclarativeModule5

getMaximumSimilarity

public double getMaximumSimilarity()
Specified by:
getMaximumSimilarity in interface IDeclarativeModule5

setMaximumDifference

public void setMaximumDifference(double maxDiff)
Specified by:
setMaximumDifference in interface IDeclarativeModule5

setMaximumSimilarity

public void setMaximumSimilarity(double maxSim)
Specified by:
setMaximumSimilarity in interface IDeclarativeModule5

getBaseLevelConstant

public double getBaseLevelConstant()
Specified by:
getBaseLevelConstant in interface IDeclarativeModule4

setBaseLevelConstant

public void setBaseLevelConstant(double base)
Specified by:
setBaseLevelConstant in interface IDeclarativeModule4

getNumberOfChunks

public long getNumberOfChunks()
Description copied from interface: IDeclarativeModule
return the number of chunks in the model. this might be an estimate

Specified by:
getNumberOfChunks in interface IDeclarativeModule
Returns:

getSimilarity

public double getSimilarity(java.lang.Object one,
                            java.lang.Object two)
Specified by:
getSimilarity in interface IDeclarativeModule5

setSimilarity

public void setSimilarity(java.lang.Object one,
                          java.lang.Object two,
                          double sim)
Specified by:
setSimilarity in interface IDeclarativeModule5

getParameter

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

Specified by:
getParameter in interface IParameterized
Parameters:
key - Description of the Parameter
Returns:
The parameter value
See Also:
IParameterized.getParameter(java.lang.String)

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:
The possibleParameters value
See Also:
IParameterized.getPossibleParameters()

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:
The setableParameters value
See Also:
IParameterized.getSetableParameters()

setParameter

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

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

initialize

public 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..

Specified by:
initialize in interface IModule
Specified by:
initialize in interface IInitializable
Specified by:
initialize in class AbstractModule
See Also:
AbstractModule.initialize()

addChunk

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

Specified by:
addChunk in interface IDeclarativeModule
Returns:
a future wrapper of the actual chunk reference that was installed. if the chunk was actually merged, the original chunk is returned
See Also:
IDeclarativeModule.addChunk(org.jactr.core.chunk.IChunk)

addChunkType

public java.util.concurrent.Future<IChunkType> addChunkType(IChunkType chunkType)
Description copied from interface: IDeclarativeModule
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

Specified by:
addChunkType in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.addChunkType(org.jactr.core.chunktype.IChunkType)

createChunk

public java.util.concurrent.Future<IChunk> createChunk(IChunkType parent,
                                                       java.lang.String name)
Description copied from interface: IDeclarativeModule
create a chunk to later be inserted.

Specified by:
createChunk in interface IDeclarativeModule
Parameters:
parent - must not be null (duh)
Returns:
See Also:
IDeclarativeModule.createChunk(org.jactr.core.chunktype.IChunkType, java.lang.String)

createChunkType

public java.util.concurrent.Future<IChunkType> createChunkType(IChunkType parent,
                                                               java.lang.String name)
Description copied from interface: IDeclarativeModule
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

Specified by:
createChunkType in interface IDeclarativeModule
Parameters:
parent - maybe null
Returns:
See Also:
IDeclarativeModule.createChunkType(org.jactr.core.chunktype.IChunkType, java.lang.String)

copyChunk

public java.util.concurrent.Future<IChunk> copyChunk(IChunk sourceChunk)
Description copied from interface: IDeclarativeModule
return a copy of source chunk

Specified by:
copyChunk in interface IDeclarativeModule
Returns:

findExactMatches

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

Specified by:
findExactMatches in interface IDeclarativeModule
sorter - may be null
bestOne - find only best one
Returns:
See Also:
IDeclarativeModule.findExactMatches(ChunkTypeRequest, java.util.Comparator, double, boolean)

findPartialMatches

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

Specified by:
findPartialMatches in interface IDeclarativeModule
sorter - may be null
bestOne - true if you only want the best one chunk
Returns:
See Also:
IDeclarativeModule.findPartialMatches(ChunkTypeRequest, java.util.Comparator, double, boolean)

getChunk

public java.util.concurrent.Future<IChunk> getChunk(java.lang.String name)
Description copied from interface: IDeclarativeModule
return the named chunk, case insensitive but preserving

Specified by:
getChunk in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunk(java.lang.String)

getChunkType

public java.util.concurrent.Future<IChunkType> getChunkType(java.lang.String name)
Description copied from interface: IDeclarativeModule
return the named chunktype. Case insensitive, but preserving

Specified by:
getChunkType in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunkType(java.lang.String)

getChunkTypes

public java.util.concurrent.Future<java.util.Collection<IChunkType>> getChunkTypes()
Description copied from interface: IDeclarativeModule
return all the chunk types in this model

Specified by:
getChunkTypes in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunkTypes()

getChunks

public java.util.concurrent.Future<java.util.Collection<IChunk>> getChunks()
Description copied from interface: IDeclarativeModule
return all chunks. This can be a very expensive operation

Specified by:
getChunks in interface IDeclarativeModule
Returns:
See Also:
IDeclarativeModule.getChunks()

getBusyChunk

public IChunk getBusyChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getBusyChunk in interface IDeclarativeModule
Returns:

getEmptyChunk

public IChunk getEmptyChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getEmptyChunk in interface IDeclarativeModule
Returns:

getErrorChunk

public IChunk getErrorChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getErrorChunk in interface IDeclarativeModule
Returns:

getFreeChunk

public IChunk getFreeChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getFreeChunk in interface IDeclarativeModule
Returns:

getFullChunk

public IChunk getFullChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getFullChunk in interface IDeclarativeModule
Returns:

getNewChunk

public IChunk getNewChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getNewChunk in interface IDeclarativeModule
Returns:

getRequestedChunk

public IChunk getRequestedChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getRequestedChunk in interface IDeclarativeModule
Returns:

getUnrequestedChunk

public IChunk getUnrequestedChunk()
Description copied from interface: IDeclarativeModule
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.

Specified by:
getUnrequestedChunk in interface IDeclarativeModule
Returns:

addListener

public void addListener(IDeclarativeModuleListener listener,
                        java.util.concurrent.Executor executor)
Specified by:
addListener in interface IDeclarativeModule

removeListener

public void removeListener(IDeclarativeModuleListener listener)
Specified by:
removeListener in interface IDeclarativeModule