Class Memory

java.lang.Object
  extended byMemory

public class Memory
extends java.lang.Object

Class Memory has static utility methods for allocating, clearing, and dumping an Object-valued memory array.


Constructor Summary
Memory()
           
 
Method Summary
static java.lang.Object[] allocate(int size)
          Allocate an Object-valued memory array of the given size.
static void clear(java.lang.Object[] mem)
          Set all elements of the given memory to null.
static void dump(java.lang.Object[] mem, int numElems)
          Dump the given number of elements in the given memory to stdout.
static void dump(java.lang.Object[] mem, int startElem, int endElem)
          Dump the given memory to stdout, from the given startElem to endElem indices, inclusive.
static void dump(java.lang.Object[] mem, int startElem, int endElem, int indent)
          Same as dump(Object[], int, int), but with indent of locations.
static void dumpRelative(java.lang.Object[] mem, int startElem, int endElem)
          Dump the given memory to stdout, from the given startElem to endElem indices, inclusive.
static void dumpRelative(java.lang.Object[] mem, int startElem, int endElem, int indent)
          Same as dumpRelative, but with indent of locations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Memory

public Memory()
Method Detail

allocate

public static java.lang.Object[] allocate(int size)
Allocate an Object-valued memory array of the given size.


clear

public static void clear(java.lang.Object[] mem)
Set all elements of the given memory to null.


dump

public static void dump(java.lang.Object[] mem,
                        int numElems)
Dump the given number of elements in the given memory to stdout. The dump starts at memory location 0. The dump of each element is started on a separate line, prefixed with "Location n: ", for n = the index of that location. The number of lines dumped per element is dependent on the toString method for the type of element being dumped.


dump

public static void dump(java.lang.Object[] mem,
                        int startElem,
                        int endElem)
Dump the given memory to stdout, from the given startElem to endElem indices, inclusive. Note that in the "Location n: " dump prefixes, the value of n is an absolute address relative to overall location 0. Cf. dumpRelative.


dumpRelative

public static void dumpRelative(java.lang.Object[] mem,
                                int startElem,
                                int endElem)
Dump the given memory to stdout, from the given startElem to endElem indices, inclusive. The difference between this method and the other three-argument version of dump is that here the "Location n: " prefixes start at 0, so this dump is relative to the given startElem beginning at 0 instead of its absolute value.


dump

public static void dump(java.lang.Object[] mem,
                        int startElem,
                        int endElem,
                        int indent)
Same as dump(Object[], int, int), but with indent of locations.


dumpRelative

public static void dumpRelative(java.lang.Object[] mem,
                                int startElem,
                                int endElem,
                                int indent)
Same as dumpRelative, but with indent of locations.