@Test public void testMergeRanges() { AbstractMemory sut = new MockMemory(ByteOrder.BIG_ENDIAN); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x10000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x60000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x50000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x30000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x20000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x70000, 0x10000)); sut.addMemorySource(new MockMemorySource(new byte[] { 0x0 }, 0, 0x80000, 0x10000)); long[][] result = sut.buildRangeTable(); assertEquals(7, result.length); int mergedRecords = sut.mergeRangeTable(result); assertEquals(2, mergedRecords); assertEquals(0x10000, result[0][0]); assertEquals(0x30000, result[0][1]); assertEquals(0x50000, result[1][0]); assertEquals(0x40000, result[1][1]); }
public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { if (RECORDING_CACHE_STATS) { IMemorySource wrappedSource = new CountingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { memorySources.addMemorySource(source); } } rangeTable = null; }
AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { if (RECORDING_CACHE_STATS) { IMemorySource wrappedSource = new CountingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { memorySources.addMemorySource(source); } } rangeTable = null; } }
AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { if (RECORDING_CACHE_STATS) { IMemorySource wrappedSource = new CountingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { memorySources.addMemorySource(source); } } rangeTable = null; } protected  AbstractMemory(ByteOrder byteOrder); }
AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { if (RECORDING_CACHE_STATS) { IMemorySource wrappedSource = new CountingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { memorySources.addMemorySource(source); } } rangeTable = null; } protected  AbstractMemory(ByteOrder byteOrder); byte getByteAt(long address); int getBytesAt(long address, byte[] buffer); int getBytesAt(final long address, byte[] buffer, final int offset,final int length); int getIntAt(long address); long getLongAt(long address); short getShortAt(long address); void addMemorySource(IMemorySource source); void removeMemorySource(IMemorySource source); void addMemorySources(Collection<? extends IMemorySource> memorySources); List<IMemoryRange> getMemoryRanges(); ByteOrder getByteOrder(); boolean isShared(long address); boolean isExecutable(long address); boolean isReadOnly(long address); Properties getProperties(long address); }
AbstractMemory extends SearchableMemory implements IMemory { public void addMemorySource(IMemorySource source) { logger.logp(FINEST,"AbstractMemory","addMemorySource","Added memory range {0}-{1}",new Object[]{Long.toHexString(source.getBaseAddress()), Long.toHexString(source.getTopAddress()) }); if (GLOBAL_CACHE_ENABLED) { IMemorySource wrappedSource = new CachingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { if (RECORDING_CACHE_STATS) { IMemorySource wrappedSource = new CountingMemorySource(source); decoratorMappingTable.put(source, wrappedSource); memorySources.addMemorySource(wrappedSource); } else { memorySources.addMemorySource(source); } } rangeTable = null; } protected  AbstractMemory(ByteOrder byteOrder); byte getByteAt(long address); int getBytesAt(long address, byte[] buffer); int getBytesAt(final long address, byte[] buffer, final int offset,final int length); int getIntAt(long address); long getLongAt(long address); short getShortAt(long address); void addMemorySource(IMemorySource source); void removeMemorySource(IMemorySource source); void addMemorySources(Collection<? extends IMemorySource> memorySources); List<IMemoryRange> getMemoryRanges(); ByteOrder getByteOrder(); boolean isShared(long address); boolean isExecutable(long address); boolean isReadOnly(long address); Properties getProperties(long address);  }