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

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

public class HardLocationImpl
extends java.lang.Object
implements HardLocation

Default implementation of HardLocation.

Author:
Javier Snaider

Constructor Summary
HardLocationImpl(cern.colt.bitvector.BitVector address)
           
HardLocationImpl(cern.colt.bitvector.BitVector address, int wordLength)
           
 
Method Summary
 cern.colt.bitvector.BitVector getAddress()
           
 byte[] getCounters()
          Returns the counters of this HardLocation Each HardLocation has wordSize counters.
 int getWriteCount()
           
 int hammingDistance(cern.colt.bitvector.BitVector vector)
          Returns the Hamming distance between vector and the address of this HardLocation
 int[] read(int[] buff)
          This method reads this HardLocation and sums the reading vector to int[] buffer.
 void setAddress(cern.colt.bitvector.BitVector address)
          Sets the address of this HardLocation in the vector Space
 void setCounters(byte[] newCounters)
          Sets the counters of this HardLocation Each HardLocation has wordSize counters.
 void write(cern.colt.bitvector.BitVector word)
          Writes BitVector word to this HardLocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HardLocationImpl

public HardLocationImpl(cern.colt.bitvector.BitVector address,
                        int wordLength)
Parameters:
address - BitVector
wordLength - int

HardLocationImpl

public HardLocationImpl(cern.colt.bitvector.BitVector address)
Parameters:
address - BitVector address of this HardLocation
Method Detail

getAddress

public cern.colt.bitvector.BitVector getAddress()
Specified by:
getAddress in interface HardLocation
Returns:
the address of this HardLocation

setAddress

public void setAddress(cern.colt.bitvector.BitVector address)
Description copied from interface: HardLocation
Sets the address of this HardLocation in the vector Space

Specified by:
setAddress in interface HardLocation
Parameters:
address - the address to set

getCounters

public byte[] getCounters()
Description copied from interface: HardLocation
Returns the counters of this HardLocation Each HardLocation has wordSize counters. Each counter is byte size. Couters are incremented or decremented when the memory is written.

Specified by:
getCounters in interface HardLocation
Returns:
the counters of this HardLocation

getWriteCount

public int getWriteCount()
Specified by:
getWriteCount in interface HardLocation
Returns:
the number of times that this HardLocation was written.

write

public void write(cern.colt.bitvector.BitVector word)
Description copied from interface: HardLocation
Writes BitVector word to this HardLocation. For each bit in word, the corresponding counter is incremented if the bit is 1 or decremented if the bit is 0.

Specified by:
write in interface HardLocation
Parameters:
word - word to be written

setCounters

public void setCounters(byte[] newCounters)
Description copied from interface: HardLocation
Sets the counters of this HardLocation Each HardLocation has wordSize counters. Each counter is byte size. Counters are incremented or decremented when the memory is written.

Specified by:
setCounters in interface HardLocation
Parameters:
newCounters - new counters

read

public int[] read(int[] buff)
Description copied from interface: HardLocation
This method reads this HardLocation and sums the reading vector to int[] buffer.

Specified by:
read in interface HardLocation
Parameters:
buff - buffer to be added to this hardlocation
Returns:
summed vector

hammingDistance

public int hammingDistance(cern.colt.bitvector.BitVector vector)
Description copied from interface: HardLocation
Returns the Hamming distance between vector and the address of this HardLocation

Specified by:
hammingDistance in interface HardLocation
Parameters:
vector - vector to compare with this hardlocation
Returns:
the Hamming distance.