Class AddressRangeObjectMap<T>


  • public class AddressRangeObjectMap<T>
    extends java.lang.Object
    Associates objects with address ranges.
    • Constructor Detail

      • AddressRangeObjectMap

        public AddressRangeObjectMap()
        Constructs a new ObjectRangeMap
    • Method Detail

      • getAddressRangeIterator

        public AddressRangeIterator getAddressRangeIterator​(Address start,
                                                            Address end)
        Returns an AddressRangeIterator over all ranges that have associated objects within the given range. Object Ranges that overlap the beginning or end of the given range are included, but have thier start or end index adjusted to be in the given range.
        Parameters:
        start - the first Address in the range to find all index ranges that have associated values.
        end - the last Address(inclusive) in the range to find all index ranges that have associated values.
        Returns:
        an AddressRangeIterator over all ranges that have associated objects within the given range.
      • moveAddressRange

        public void moveAddressRange​(Address fromAddr,
                                     Address toAddr,
                                     long length,
                                     TaskMonitor monitor)
                              throws CancelledException
        Move all values within an address range to a new range.
        Parameters:
        fromAddr - the first address of the range to be moved.
        toAddr - the address where to the range is to be moved.
        length - the number of addresses to move.
        monitor - the task monitor.
        Throws:
        CancelledException - if the user canceled the operation via the task monitor.
        AddressOverflowException - if the length is such that a address wrap occurs
      • setObject

        public void setObject​(Address start,
                              Address end,
                              T object)
        Associates the given object with all indices in the given range. The object may be null, but an association is still established. Use the clearRange() method to remove associations.
        Parameters:
        start - the start of the range.
        end - the end (inclusive) of the range.
        object - the object to associate with the given range.
      • clearAll

        public void clearAll()
        Clears all objects from map
      • clearRange

        public void clearRange​(Address start,
                               Address end)
        Clears any object associations within the given range.
        Parameters:
        start - the first index in the range to be cleared.
        end - the last index in the range to be cleared.
      • contains

        public boolean contains​(Address address)
        Returns true if the associated address has an associated object even if the assocated object is null.
        Parameters:
        address - the index to check for an association.
        Returns:
        true if the associated index has an associated object even if the assocated object is null.
      • getObject

        public T getObject​(Address address)
        Returns the object associated with the given index or null if no object is associated with the given index. Note that null is a valid association so a null result could be either no association or an actual association of the index to null. Use the contains() method first if the distinction is important. If the contains() method returns true, the result is cached so the next call to getObject() will be fast.
        Parameters:
        address - the index at which to retrieve an assocated object.
        Returns:
        the object (which can be null) associated with the given index or null if no such association exists.
      • isEmpty

        public boolean isEmpty()
      • getAddressRangeContaining

        public AddressRange getAddressRangeContaining​(Address addr)
        Get the value or hole range containing the specified address
        Parameters:
        addr -