Module openj9.dtfj

Class BaseMemoryRange

java.lang.Object
com.ibm.j9ddr.corereaders.memory.BaseMemoryRange
All Implemented Interfaces:
IMemoryRange, Comparable<IMemoryRange>
Direct Known Subclasses:
MemoryRange, ProtectedMemoryRange

public abstract class BaseMemoryRange extends Object implements IMemoryRange
Abstract base class containing common logic for IMemoryRange
  • 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 interface IMemoryRange
      Parameters:
      address - Address to test
      Returns:
      True if the memory range contains address, false otherwise.
    • compareTo

      public int compareTo(IMemoryRange o)
      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 all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

      The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

      Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

      Specified by:
      compareTo in interface Comparable<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

      public boolean isSubRange(IMemoryRange other)
      Specified by:
      isSubRange in interface IMemoryRange
      Returns:
      True if other models a memory range that sits entirely within this range
    • overlaps

      public boolean overlaps(IMemoryRange other)
      Specified by:
      overlaps in interface IMemoryRange
      Returns:
      True if other shares any addresses with this range.
    • getBaseAddress

      public final long getBaseAddress()
      Specified by:
      getBaseAddress in interface IMemoryRange
      Returns:
      Base address of this memory range
    • getSize

      public final long getSize()
      Specified by:
      getSize in interface IMemoryRange
      Returns:
      Size of this memory range, bytes
    • getTopAddress

      public final long getTopAddress()
      Specified by:
      getTopAddress in interface IMemoryRange
      Returns:
      Largest address in this memory range
    • isBacked

      public boolean isBacked()
      Specified by:
      isBacked in interface IMemoryRange