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, Ryan J. McCall

Constructor Summary
BasicTranslator()
          Default constructor.
BasicTranslator(int size, PerceptualAssociativeMemory pam)
          Constructs a new translator with specified attributes.
 
Method Summary
 PerceptualAssociativeMemory getPam()
          Gets Pam
 int getSize()
          Gets size
 void setPam(PerceptualAssociativeMemory pam)
          Sets Pam
 void setSize(int s)
          Sets size
 NodeStructure translate(cern.colt.bitvector.BitVector data)
          Translates a BitVector into a NodeStructure.
 cern.colt.bitvector.BitVector translate(NodeStructure ns)
          Translates a NodeStructure into a BitVector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTranslator

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


BasicTranslator

public BasicTranslator(int size,
                       PerceptualAssociativeMemory pam)
Constructs a new translator with specified attributes.

Parameters:
size - the number of positions of the bit vector
pam - the PerceptualAssociativeMemory associated with this translator
Method Detail

translate

public NodeStructure translate(cern.colt.bitvector.BitVector data)
Translates a BitVector into a NodeStructure. Since the method BitVector.getQuick(int) is used, no preconditions are checked.

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

translate

public cern.colt.bitvector.BitVector translate(NodeStructure ns)
Translates a NodeStructure into a BitVector. Currently only nodes are translated, but links, and maybe activations must be also handled.

Specified by:
translate in interface Translator
Parameters:
ns - the NodeStructure to be translated
Returns:
a BitVector representing the Node objects in the NodeStructure

getSize

public int getSize()
Gets size

Returns:
the vector's size

setSize

public void setSize(int s)
Sets size

Parameters:
s - the vector's size in the SparseDistributedMemory

getPam

public PerceptualAssociativeMemory getPam()
Gets Pam

Returns:
the PerceptualAssociativeMemory

setPam

public void setPam(PerceptualAssociativeMemory pam)
Sets Pam

Parameters:
pam - the PerceptualAssociativeMemory to set