/** * Defines a region of the given parent Memory by defining an offset and capacity that are within * the boundaries of the parent. * * @param memory the parent Memory * @param memOffsetBytes the starting offset in bytes of this region with respect to the start of * the parent memory. * @param capacityBytes the capacity in bytes of this region. * @param memReq a MemoryRequest object */ public MemoryRegion( Memory memory, long memOffsetBytes, long capacityBytes, MemoryRequest memReq) { assertBounds(memOffsetBytes, capacityBytes, memory.getCapacity()); mem_ = memory; memOffsetBytes_ = memOffsetBytes; capacityBytes_ = capacityBytes; memReq_ = memReq; }
@Test public void testGetCapacity() { int returnedCapacity = memory.getCapacity(); assertEquals(memoryCapacityDuringTest, returnedCapacity); }
public void reassign(long memOffsetBytes, long capacityBytes) { assertBounds(memOffsetBytes, capacityBytes, mem_.getCapacity()); memOffsetBytes_ = memOffsetBytes; capacityBytes_ = capacityBytes; }