|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcomponent.BitMemory
public class BitMemory
Generic implementation of a bit addressable memory.
Note: it would be a mistake (in many ways) to try to read or write fields wider than 32 bits in a single operation.
All read operations return 0 bits if a selected region is outside the BitMemory. Write operations are no-ops in those situations. (For both, this is on a bit-by-bit basis.)
Constructor Summary | |
---|---|
BitMemory(int size)
Construct a bit memory of size bits. |
Method Summary | |
---|---|
java.lang.String |
dump()
Verbose version of what an overridden toString() usually does. |
boolean |
equals(java.lang.Object o)
Needed for BitMemory's to be insertable into a HashSet. |
int |
getSize()
Returns the size of this BitMemory, measured in bits. |
int |
hashCode()
Needed for BitMemory's to be insertable into a HashSet. |
static void |
main(java.lang.String[] args)
Test code/driver for this class; used for debugging BitMemory implementation only. |
int |
read(int start,
int len)
The memory bits at positions start,...,start+len-1 are put into the low order bits of the result. |
void |
write(BitMemory data,
int start)
Copy all the bits of the data BitMemory into this one, starting at offset start. |
void |
write(int val,
int start,
int len)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitMemory(int size)
Method Detail |
---|
public void write(int val, int start, int len)
public void write(BitMemory data, int start)
public int read(int start, int len)
If a bit position is out of range for this BitMemory, a 0 bit is substituted into the result.
len must be in the range 0..32 for correct operation.
public int getSize()
public java.lang.String dump()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |