Package ghidra.program.database.register
Class AddressRangeObjectMap<T>
- java.lang.Object
-
- ghidra.program.database.register.AddressRangeObjectMap<T>
-
public class AddressRangeObjectMap<T> extends java.lang.Object
Associates objects with address ranges.
-
-
Constructor Summary
Constructors Constructor Description AddressRangeObjectMap()
Constructs a new ObjectRangeMap
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearAll()
Clears all objects from mapvoid
clearRange(Address start, Address end)
Clears any object associations within the given range.boolean
contains(Address address)
Returns true if the associated address has an associated object even if the assocated object is null.AddressRange
getAddressRangeContaining(Address addr)
Get the value or hole range containing the specified addressAddressRangeIterator
getAddressRangeIterator()
Returns anAddressRangeIterator
over all ranges that have associated objects.AddressRangeIterator
getAddressRangeIterator(Address start, Address end)
Returns anAddressRangeIterator
over all ranges that have associated objects within the given range.T
getObject(Address address)
Returns the object associated with the given index or null if no object is associated with the given index.boolean
isEmpty()
void
moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)
Move all values within an address range to a new range.void
setObject(Address start, Address end, T object)
Associates the given object with all indices in the given range.
-
-
-
Method Detail
-
getAddressRangeIterator
public AddressRangeIterator getAddressRangeIterator()
Returns anAddressRangeIterator
over all ranges that have associated objects.- Returns:
- an
AddressRangeIterator
over all ranges that have associated objects.
-
getAddressRangeIterator
public AddressRangeIterator getAddressRangeIterator(Address start, Address end)
Returns anAddressRangeIterator
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.
-
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
-
-
-