java.lang.Object
com.ibm.j9ddr.corereaders.memory.BaseMemoryRange
- All Implemented Interfaces:
IMemoryRange
,Comparable<IMemoryRange>
- Direct Known Subclasses:
MemoryRange
,ProtectedMemoryRange
Abstract base class containing common logic for IMemoryRange
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares this object with the specified object for order.boolean
contains
(long address) Checks whether an address is present in this memory rangefinal long
final long
getSize()
final long
boolean
isBacked()
boolean
isSubRange
(IMemoryRange other) boolean
overlaps
(IMemoryRange other) Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface com.ibm.j9ddr.corereaders.memory.IMemoryRange
getAddressSpaceId, getName, isExecutable, isReadOnly, isShared
-
Field Details
-
baseAddress
protected final long baseAddress -
size
protected final long size
-
-
Constructor Details
-
BaseMemoryRange
protected BaseMemoryRange(long baseAddress, long size)
-
-
Method Details
-
contains
public boolean contains(long address) Description copied from interface:IMemoryRange
Checks whether an address is present in this memory range- Specified by:
contains
in interfaceIMemoryRange
- Parameters:
address
- Address to test- Returns:
- True if the memory range contains address, false otherwise.
-
compareTo
Description copied from interface:java.lang.Comparable
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.The implementor must ensure
signum
(x.compareTo(y)) == -signum(y.compareTo(x))
for allx
andy
. (This implies thatx.compareTo(y)
must throw an exception if and only ify.compareTo(x)
throws an exception.)The implementor must also ensure that the relation is transitive:
(x.compareTo(y) > 0 && y.compareTo(z) > 0)
impliesx.compareTo(z) > 0
.Finally, the implementor must ensure that
x.compareTo(y)==0
implies thatsignum(x.compareTo(z)) == signum(y.compareTo(z))
, for allz
.- Specified by:
compareTo
in interfaceComparable<IMemoryRange>
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
isSubRange
- Specified by:
isSubRange
in interfaceIMemoryRange
- Parameters:
other
-- Returns:
- True if other models a memory range that sits entirely within this range
-
overlaps
- Specified by:
overlaps
in interfaceIMemoryRange
- Parameters:
other
-- Returns:
- True if other shares any addresses with this range.
-
getBaseAddress
public final long getBaseAddress()- Specified by:
getBaseAddress
in interfaceIMemoryRange
- Returns:
- Base address of this memory range
-
getSize
public final long getSize()- Specified by:
getSize
in interfaceIMemoryRange
- Returns:
- Size of this memory range, bytes
-
getTopAddress
public final long getTopAddress()- Specified by:
getTopAddress
in interfaceIMemoryRange
- Returns:
- Largest address in this memory range
-
isBacked
public boolean isBacked()- Specified by:
isBacked
in interfaceIMemoryRange
-