edu.memphis.ccrg.lida.episodicmemory.sdm
Class BasicTranslator

java.lang.Object
  extended by edu.memphis.ccrg.lida.episodicmemory.sdm.BasicTranslator
All Implemented Interfaces:
Translator

public class BasicTranslator
extends java.lang.Object
implements Translator

This is the class that translates from nodes to boolean vectors and vice- versa. The translation works by assigning a unique index to every node.

Author:
Javier Snaider

Constructor Summary
BasicTranslator()
          Default constructor.
BasicTranslator(int size, PerceptualAssociativeMemory pam)
          Constructor of the class.
 
Method Summary
 PerceptualAssociativeMemory getPam()
           
 int getSize()
           
 void setPam(PerceptualAssociativeMemory pam)
           
 void setSize(int size)
           
 NodeStructure translate(cern.colt.bitvector.BitVector data)
          Translates a bit vector into a node structure.
 cern.colt.bitvector.BitVector translate(NodeStructure structure)
          Translates a node structure into a bit vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTranslator

public BasicTranslator(int size,
                       PerceptualAssociativeMemory pam)
Constructor of the class.

Parameters:
size - the number of positions of the bit vector
pam - the PAM associated with this translator

BasicTranslator

public BasicTranslator()
Default constructor. The PAM and vectors' size must be set before to use this Translator.

Method Detail

translate

public NodeStructure translate(cern.colt.bitvector.BitVector data)
Translates a bit vector into a node structure. Since the getQuick method in the BitVector class is used, no preconditions are checked.

Specified by:
translate in interface Translator
Parameters:
data - the boolean vector to be translated
Returns:
a node structure representing the positions in the bit vector, each node has a unique ID
See Also:
BitVector

translate

public cern.colt.bitvector.BitVector translate(NodeStructure structure)
Translates a node structure into a bit vector. At this point only nodes are being translated, but links, and maybe activations must be also handled.

Specified by:
translate in interface Translator
Parameters:
structure - the node structure to be translated
Returns:
a bit vector representing the nodes in the node structure

getSize

public int getSize()
Returns:
the vectors' size

setSize

public void setSize(int size)
Parameters:
size - the vectors' size in the SparseDistributedMemory

getPam

public PerceptualAssociativeMemory getPam()
Returns:
the pam

setPam

public void setPam(PerceptualAssociativeMemory pam)
Parameters:
pam - the pam to set