Package ghidra.program.util

# Interface RangeMapAdapter

All Known Implementing Classes:
  `DatabaseRangeMapAdapter`, `InMemoryRangeMapAdapter`

public interface RangeMapAdapter

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkWritableState()`
  Verify that adapter is in a writable state (i.e., valid transaction has been started).
  `void`
  `clearAll()`
  Clears all values.
  `void`
  `clearRange(Address start, Address end)`
  Clears all associated values in the given range.
  `AddressRangeIterator`
  `getAddressRangeIterator()`
  Returns an `IndexRangeIterator` over all stored values.
  `AddressRangeIterator`
  `getAddressRangeIterator(Address start, Address end)`
  Returns an `IndexRangeIterator` over all stored values in the given range.
  `byte[]`
  `getValue(Address address)`
  Returns the byte array that has been associated with the given index.
  `AddressRange`
  `getValueRangeContaining(Address addr)`
  Returns the bounding address-range containing addr and the the same value throughout.
  `void`
  `invalidate()`
  Notification that something has changed that may affect internal caching
  `boolean`
  `isEmpty()`
  Returns true if this storage has no associated values for any address
  `void`
  `moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)`
  Move all values within an address range to a new range.
  `void`
  `set(Address start, Address end, byte[] bytes)`
  Associates the given byte array with all indexes in the given range.
  `void`
  `setLanguage(LanguageTranslator translator, Register mapReg, TaskMonitor monitor)`
  Update table name and values to reflect new base register

- ## Method Details

  - ### getValue

    byte[] getValue(Address address)
    Returns the byte array that has been associated with the given index.
    Parameters:
      `address` - the address at which to retrieve a byte array.
    Returns:
      the byte array that has been associated with the given index or null if no such association exists.

  - ### moveAddressRange

    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.

  - ### set

    void set(Address start, Address end, byte[] bytes)
    Associates the given byte array with all indexes in the given range. Any existing values will be over written.
    Parameters:
      `start` - the first address in the range.
      `end` - the last Address(inclusive) in the range.
      `bytes` - the bytes to associate with the range.

  - ### getAddressRangeIterator

    AddressRangeIterator getAddressRangeIterator(Address start, Address end)
    Returns an `IndexRangeIterator` over all stored values in the given range. If the given range intersects an actual stored range either at the beginning or end, the iterator will return those ranges truncated to fit within the given range.
    Parameters:
      `start` - the first Address in the range.
      `end` - the last Address (inclusive) index in the range.
    Returns:
      an `IndexRangeIterator` over all stored values.

  - ### getAddressRangeIterator

    AddressRangeIterator getAddressRangeIterator()
    Returns an `IndexRangeIterator` over all stored values.
    Returns:
      an `IndexRangeIterator` over all stored values.

  - ### clearRange

    void clearRange(Address start, Address end)
    Clears all associated values in the given range.
    Parameters:
      `start` - the first address in the range to clear.
      `end` - the end address in the range to clear.

  - ### clearAll

    void clearAll()
    Clears all values.

  - ### isEmpty

    boolean isEmpty()
    Returns true if this storage has no associated values for any address
    Returns:
      true if this storage has no associated values for any address

  - ### setLanguage

    void setLanguage(LanguageTranslator translator, Register mapReg, TaskMonitor monitor) throws CancelledException
    Update table name and values to reflect new base register
    Parameters:
      `translator` -
      `mapReg` -
      `monitor` -
    Throws:
      `CancelledException`

  - ### getValueRangeContaining

    AddressRange getValueRangeContaining(Address addr)
    Returns the bounding address-range containing addr and the the same value throughout. This range will be limited by any value change associated with the base register.
    Parameters:
      `addr` - the containing address
    Returns:
      single value address-range containing addr

  - ### checkWritableState

    void checkWritableState()
    Verify that adapter is in a writable state (i.e., valid transaction has been started).
    Throws:
      `IllegalStateException` - if not in a writable state

  - ### invalidate

    void invalidate()
    Notification that something has changed that may affect internal caching