Package ghidra.program.database.util
Class SynchronizedAddressSetCollection
- java.lang.Object
-
- ghidra.program.database.util.SynchronizedAddressSetCollection
-
- All Implemented Interfaces:
AddressSetCollection
public class SynchronizedAddressSetCollection extends java.lang.Object implements AddressSetCollection
Implementation of AddressSetCollection used byProgramChangeSet. It contains the actual instances of the addressSets used by theProgramChangeSetand protects access to them by synchronizing on the ProgramChangeSet. Because these objects use the actual addressSets within the programChangeSet for efficiency reasons, any changes to those underlying sets will be reflected in the set of addresses represented by this collection. But since it is synchronized, you will always get a stable set during any given call and the AddressSetCollection interface is careful not to include iterator or other methods that can't tolerate a underlying change. This object is really only intended for use by the GUI change bars and if it changes, it only results in possibly seeing the changes bars a bit earlier than otherwise.
-
-
Constructor Summary
Constructors Constructor Description SynchronizedAddressSetCollection(java.lang.Object sync, AddressSetView... addressSetViews)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Address address)Test if the address is contained within any of the addressSets in this collection.AddressfindFirstAddressInCommon(AddressSetView set)Finds the first address in this collection that is also in the given addressSet.AddressSetgetCombinedAddressSet()Returns a single AddressSet containing the union of all the addressSetViews in the collection.AddressgetMaxAddress()Returns the largest address in this collection or null if the collection is empty.AddressgetMinAddress()Returns the smallest address in this collection or null if the collection is empty.booleanhasFewerRangesThan(int rangeThreshold)Tests whether this collection of addressSets has approximately fewer ranges than the given threshold.booleanintersects(Address start, Address end)Determine if range specified by start and end intersects with any of the AddressSets in this collection.booleanintersects(AddressSetView addrSet)Determine if any AddressSet in this collection intersects with the specified address set.booleanisEmpty()Returns true if all the AddressSets in this collection are empty.
-
-
-
Constructor Detail
-
SynchronizedAddressSetCollection
public SynchronizedAddressSetCollection(java.lang.Object sync, AddressSetView... addressSetViews)
-
-
Method Detail
-
intersects
public boolean intersects(AddressSetView addrSet)
Description copied from interface:AddressSetCollectionDetermine if any AddressSet in this collection intersects with the specified address set.- Specified by:
intersectsin interfaceAddressSetCollection- Parameters:
addrSet- address set to check intersection with.
-
intersects
public boolean intersects(Address start, Address end)
Description copied from interface:AddressSetCollectionDetermine if range specified by start and end intersects with any of the AddressSets in this collection.- Specified by:
intersectsin interfaceAddressSetCollection- Parameters:
start- start of rangeend- end of range- Returns:
- true if the given range intersects this address set collection.
-
contains
public boolean contains(Address address)
Description copied from interface:AddressSetCollectionTest if the address is contained within any of the addressSets in this collection.- Specified by:
containsin interfaceAddressSetCollection- Parameters:
address- address to test.- Returns:
- true if addr exists in the set, false otherwise.
-
hasFewerRangesThan
public boolean hasFewerRangesThan(int rangeThreshold)
Description copied from interface:AddressSetCollectionTests whether this collection of addressSets has approximately fewer ranges than the given threshold. This is probably estimated by adding up the number of ranges in each AddressSet in this collections. Returns true if the total is less than the given threshold.- Specified by:
hasFewerRangesThanin interfaceAddressSetCollection- Parameters:
rangeThreshold- the number of ranges to test against.- Returns:
- true if the max possible ranges is less than the given threshold.
-
getCombinedAddressSet
public AddressSet getCombinedAddressSet()
Description copied from interface:AddressSetCollectionReturns a single AddressSet containing the union of all the addressSetViews in the collection.- Specified by:
getCombinedAddressSetin interfaceAddressSetCollection
-
findFirstAddressInCommon
public Address findFirstAddressInCommon(AddressSetView set)
Description copied from interface:AddressSetCollectionFinds the first address in this collection that is also in the given addressSet.- Specified by:
findFirstAddressInCommonin interfaceAddressSetCollection- 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.
-
isEmpty
public boolean isEmpty()
Description copied from interface:AddressSetCollectionReturns true if all the AddressSets in this collection are empty.- Specified by:
isEmptyin interfaceAddressSetCollection- Returns:
- true if all the AddressSets in this collection are empty.
-
getMinAddress
public Address getMinAddress()
Description copied from interface:AddressSetCollectionReturns the smallest address in this collection or null if the collection is empty.- Specified by:
getMinAddressin interfaceAddressSetCollection- Returns:
- the smallest address in this collection or null if the collection is empty.
-
getMaxAddress
public Address getMaxAddress()
Description copied from interface:AddressSetCollectionReturns the largest address in this collection or null if the collection is empty.- Specified by:
getMaxAddressin interfaceAddressSetCollection- Returns:
- the largest address in this collection or null if the collection is empty.
-
-