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)
          Constructs a new hard location with specified address
HardLocationImpl(cern.colt.bitvector.BitVector address, int wordLength)
          Constructs a new hard location with specified address and length.
 
Method Summary
 cern.colt.bitvector.BitVector getAddress()
          Gets address
 byte[] getCounters()
          Returns the counters of this HardLocation Each HardLocation has wordSize counters.
 int getWriteCount()
          Gets write count
 int hammingDistance(cern.colt.bitvector.BitVector vector)
          Returns the Hamming distance between a BitVector and the address of this HardLocation
 int[] read(int[] buff)
          Reads this HardLocation.
 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 specified BitVector 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)
Constructs a new hard location with specified address and length.

Parameters:
address - BitVector
wordLength - length of the words

HardLocationImpl

public HardLocationImpl(cern.colt.bitvector.BitVector address)
Constructs a new hard location with specified address

Parameters:
address - BitVector address of this HardLocation
Method Detail

getAddress

public cern.colt.bitvector.BitVector getAddress()
Description copied from interface: HardLocation
Gets address

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 BitVector 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. Counters 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()
Description copied from interface: HardLocation
Gets write count

Specified by:
getWriteCount in interface HardLocation
Returns:
the number of times that this HardLocation was written to.

write

public void write(cern.colt.bitvector.BitVector word)
Description copied from interface: HardLocation
Writes specified BitVector 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
Reads this HardLocation. The binary vector read from this hard location is added to the int[] buffer.

Specified by:
read in interface HardLocation
Parameters:
buff - an int[] buffer where the result of the read is added
Returns:
the updated int[] buffer

hammingDistance

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

Specified by:
hammingDistance in interface HardLocation
Parameters:
vector - BitVector to be compared with this HardLocation
Returns:
the Hamming distance.