Class DBTraceObjectValueMapAddressSetView

java.lang.Object
ghidra.util.AbstractAddressSetView
ghidra.trace.database.target.DBTraceObjectValueMapAddressSetView
All Implemented Interfaces:
AddressSetView, Iterable<AddressRange>

public class DBTraceObjectValueMapAddressSetView extends AbstractAddressSetView
  • Constructor Details

    • DBTraceObjectValueMapAddressSetView

      public DBTraceObjectValueMapAddressSetView(AddressFactory factory, ReadWriteLock lock, SpatialMap<ValueShape,DBTraceObjectValueData,TraceObjectValueQuery> map, Predicate<? super DBTraceObjectValueData> predicate)
      An address set view that unions all addresses where an entry satisfying the given predicate exists.

      The caller may reduce the map given to this view. Reduction is preferable to using a predicate, where possible, because reduction benefits from the index.

      Parameters:
      factory - the trace's address factory
      lock - the lock on the database
      map - the map
      predicate - a predicate to further filter entries
  • Method Details

    • contains

      public boolean contains(Address addr)
      Description copied from interface: AddressSetView
      Test if the address is contained within this set.
      Parameters:
      addr - address to test.
      Returns:
      true if addr exists in the set, false otherwise.
    • contains

      public boolean contains(Address start, Address end)
      Description copied from interface: AddressSetView
      Test if the given address range is contained in this set.

      The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      contains in interface AddressSetView
      Overrides:
      contains in class AbstractAddressSetView
      Parameters:
      start - the first address in the range.
      end - the last address in the range.
      Returns:
      true if entire range is contained within the set, false otherwise.
    • contains

      public boolean contains(AddressSetView rangeSet)
      Description copied from interface: AddressSetView
      Test if the given address set is a subset of this set.
      Specified by:
      contains in interface AddressSetView
      Overrides:
      contains in class AbstractAddressSetView
      Parameters:
      rangeSet - the set to test.
      Returns:
      true if the entire set is contained within this set, false otherwise.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface AddressSetView
      Overrides:
      isEmpty in class AbstractAddressSetView
      Returns:
      true if this set is empty.
    • getMinAddress

      public Address getMinAddress()
      Description copied from interface: AddressSetView
      Get the minimum address for this address set.

      NOTE: An AddressRange should generally not be formed using this address and AddressSetView.getMaxAddress() since it may span multiple AddressSpaces.

      Specified by:
      getMinAddress in interface AddressSetView
      Overrides:
      getMinAddress in class AbstractAddressSetView
      Returns:
      the minimum address for this set. Returns null if the set is empty.
    • getMaxAddress

      public Address getMaxAddress()
      Description copied from interface: AddressSetView
      Get the maximum address for this address set.

      NOTE: An AddressRange should generally not be formed using this address and AddressSetView.getMaxAddress() since it may span multiple AddressSpaces.

      Specified by:
      getMaxAddress in interface AddressSetView
      Overrides:
      getMaxAddress in class AbstractAddressSetView
      Returns:
      the maximum address for this set. Returns null if the set is empty.
    • getNumAddressRanges

      public int getNumAddressRanges()
      Specified by:
      getNumAddressRanges in interface AddressSetView
      Overrides:
      getNumAddressRanges in class AbstractAddressSetView
      Returns:
      the number of address ranges in this set.
    • getAddressRanges

      public AddressRangeIterator getAddressRanges()
      Returns:
      an iterator over the address ranges in this address set.
    • getAddressRanges

      public AddressRangeIterator getAddressRanges(boolean forward)
      Description copied from interface: AddressSetView
      Returns an iterator over the ranges in the specified order
      Parameters:
      forward - the ranges are returned from lowest to highest, otherwise from highest to lowest
      Returns:
      an iterator over all the addresse ranges in the set.
    • doGetAddressRanges

      protected AddressRangeIterator doGetAddressRanges(DBCachedObjectStoreFactory.RecAddress start, DBCachedObjectStoreFactory.RecAddress end, boolean forward)
    • getAddressRanges

      public AddressRangeIterator getAddressRanges(Address start, boolean forward)
      Returns an iterator of address ranges starting with the range that contains the given address.

      If there is no range containing the start address, then the first range will be the next range greater than the start address if going forward, otherwise the range less than the start address

      Note the first range may be incomplete up when composed of connected entries, but it will at least include all the ranges ahead of the given start -- or behind the given start if forward is false. TODO: Fix that, just like UnionAddressSetView?

      Parameters:
      start - the address the first range should contain.
      forward - true iterators forward, false backwards
      Returns:
      the AddressRange iterator
    • getNumAddresses

      public long getNumAddresses()
      Specified by:
      getNumAddresses in interface AddressSetView
      Overrides:
      getNumAddresses in class AbstractAddressSetView
      Returns:
      the number of addresses in this set.
    • intersects

      public boolean intersects(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Determine if this address set intersects with the specified address set.
      Specified by:
      intersects in interface AddressSetView
      Overrides:
      intersects in class AbstractAddressSetView
      Parameters:
      addrSet - address set to check intersection with.
      Returns:
      true if this set intersects the specified addrSet else false
    • intersects

      public boolean intersects(Address start, Address end)
      Description copied from interface: AddressSetView
      Determine if the start and end range intersects with the specified address set.

      The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      intersects in interface AddressSetView
      Overrides:
      intersects in class AbstractAddressSetView
      Parameters:
      start - start of range
      end - end of range
      Returns:
      true if the given range intersects this address set.
    • intersect

      public AddressSet intersect(AddressSetView view)
      Description copied from interface: AddressSetView
      Computes the intersection of this address set with the given address set.

      This method does not modify this address set.

      Specified by:
      intersect in interface AddressSetView
      Overrides:
      intersect in class AbstractAddressSetView
      Parameters:
      view - the address set to intersect with.
      Returns:
      AddressSet a new address set that contains all addresses that are contained in both this set and the given set.
    • intersectRange

      public AddressSet intersectRange(Address start, Address end)
      Description copied from interface: AddressSetView
      Computes the intersection of this address set with the given address range.

      This method does not modify this address set. The specified start and end addresses must form a valid range within a single AddressSpace.

      Specified by:
      intersectRange in interface AddressSetView
      Overrides:
      intersectRange in class AbstractAddressSetView
      Parameters:
      start - start of range
      end - end of range
      Returns:
      AddressSet a new address set that contains all addresses that are contained in both this set and the given range.
    • union

      public AddressSet union(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the union of this address set with the given address set.

      This method does not change this address set.

      Specified by:
      union in interface AddressSetView
      Overrides:
      union in class AbstractAddressSetView
      Parameters:
      addrSet - The address set to be unioned with this address set.
      Returns:
      AddressSet A new address set which contains all the addresses from both this set and the given set.
    • subtract

      public AddressSet subtract(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the difference of this address set with the given address set (this - set).

      Note that this is not the same as (set - this). This method does not change this address set.

      Specified by:
      subtract in interface AddressSetView
      Overrides:
      subtract in class AbstractAddressSetView
      Parameters:
      addrSet - the set to subtract from this set.
      Returns:
      AddressSet a new address set which contains all the addresses that are in this set, but not in the given set.
    • xor

      public AddressSet xor(AddressSetView addrSet)
      Description copied from interface: AddressSetView
      Computes the exclusive-or of this address set with the given set.

      This method does not modify this address set.

      Specified by:
      xor in interface AddressSetView
      Overrides:
      xor in class AbstractAddressSetView
      Parameters:
      addrSet - address set to exclusive-or with.
      Returns:
      AddressSet a new address set containing all addresses that are in either this set or the given set, but not in both sets
    • hasSameAddresses

      public boolean hasSameAddresses(AddressSetView view)
      Description copied from interface: AddressSetView
      Returns true if the given address set contains the same set of addresses as this set.
      Specified by:
      hasSameAddresses in interface AddressSetView
      Overrides:
      hasSameAddresses in class AbstractAddressSetView
      Parameters:
      view - the address set to compare.
      Returns:
      true if the given set contains the same addresses as this set.
    • getFirstRange

      public AddressRange getFirstRange()
      Description copied from interface: AddressSetView
      Returns the first range in this set or null if the set is empty
      Specified by:
      getFirstRange in interface AddressSetView
      Overrides:
      getFirstRange in class AbstractAddressSetView
      Returns:
      the first range in this set or null if the set is empty
    • getLastRange

      public AddressRange getLastRange()
      Description copied from interface: AddressSetView
      Returns the last range in this set or null if the set is empty
      Specified by:
      getLastRange in interface AddressSetView
      Overrides:
      getLastRange in class AbstractAddressSetView
      Returns:
      the last range in this set or null if the set is empty
    • getRangeContaining

      public AddressRange getRangeContaining(Address address)
      Returns the range that contains the given address

      Note that adjacent or overlapping ranges may be omitted if they don't also contain the address.

      Specified by:
      getRangeContaining in interface AddressSetView
      Overrides:
      getRangeContaining in class AbstractAddressSetView
      Parameters:
      address - the address for which to find a range.
      Returns:
      the range that contains the given address.
    • findFirstAddressInCommon

      public Address findFirstAddressInCommon(AddressSetView set)
      Description copied from interface: AddressSetView
      Finds the first address in this collection that is also in the given addressSet.
      Specified by:
      findFirstAddressInCommon in interface AddressSetView
      Overrides:
      findFirstAddressInCommon in class AbstractAddressSetView
      Parameters:
      set - the addressSet to search for the first (lowest) common address.
      Returns:
      the first address that is contained in this set and the given set.