Package ghidra.program.model.address
Class AddressRangeImpl
java.lang.Object
ghidra.program.model.address.AddressRangeImpl
- All Implemented Interfaces:
AddressRange
,Serializable
,Comparable<AddressRange>
,Iterable<Address>
Implementation of an AddressRange. An AddressRange is a contiguous
inclusive set of addresses from some minimum to a maximum address. Once created
it is immutable.
- Since:
- 2000-2-16
- See Also:
-
Constructor Summary
ConstructorDescriptionAddressRangeImpl
(Address start, long length) Construct an AddressRange with the given start address and length.AddressRangeImpl
(AddressRange range) Construct a new AddressRangeImpl from the given range.AddressRangeImpl
(Address start, Address end) Construct an AddressRange with the given start and end address. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares the given address to this address range.int
boolean
Returns true if the given address is contained in the range.boolean
Returns the number of addresses as a BigInteger.long
Returns the number of addresses in the range.int
hashCode()
intersect
(AddressRange range) Computes the intersection of this range with another.intersectRange
(Address start, Address end) Computes the intersection of this range with another.boolean
intersects
(AddressRange range) Returns true if the given range intersects this range.boolean
intersects
(Address start, Address end) Returns true if the given range intersects this range.iterator()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AddressRangeImpl
Construct a new AddressRangeImpl from the given range.- Parameters:
range
- the address range to copy.
-
AddressRangeImpl
Construct an AddressRange with the given start and end address. If the start address is before the end address, they are swapped to be in order.- Parameters:
start
- start address in the rangeend
- end address in the range- Throws:
IllegalArgumentException
- thrown if the minimum and maximum addresses are not comparable.
-
AddressRangeImpl
Construct an AddressRange with the given start address and length.- Parameters:
start
- start address in the rangelength
- the length of the range.- Throws:
AddressOverflowException
- if the length would wrap.
-
-
Method Details
-
contains
Description copied from interface:AddressRange
Returns true if the given address is contained in the range.- Specified by:
contains
in interfaceAddressRange
- See Also:
-
getAddressSpace
- Specified by:
getAddressSpace
in interfaceAddressRange
- Returns:
- address space this range resides within
-
getMinAddress
- Specified by:
getMinAddress
in interfaceAddressRange
- Returns:
- the minimum address in the range.
- See Also:
-
getMaxAddress
- Specified by:
getMaxAddress
in interfaceAddressRange
- Returns:
- the maximum address in the range.
- See Also:
-
getLength
public long getLength()Description copied from interface:AddressRange
Returns the number of addresses in the range.- Specified by:
getLength
in interfaceAddressRange
- See Also:
-
getBigLength
Description copied from interface:AddressRange
Returns the number of addresses as a BigInteger.- Specified by:
getBigLength
in interfaceAddressRange
- Returns:
- the number of addresses as a BigInteger.
-
equals
-
hashCode
public int hashCode() -
compareTo
Description copied from interface:AddressRange
Compares the given address to this address range.- Specified by:
compareTo
in interfaceAddressRange
- Parameters:
addr
- the address to compare.- Returns:
- a negative integer if the address is greater than the maximum range address, zero if the address is in the range, and a positive integer if the address is less than minimum range address.
- See Also:
-
toString
-
intersects
Description copied from interface:AddressRange
Returns true if the given range intersects this range.- Specified by:
intersects
in interfaceAddressRange
- Parameters:
range
- the range to test for intersection with.- See Also:
-
intersects
Description copied from interface:AddressRange
Returns true if the given range intersects this range.- Specified by:
intersects
in interfaceAddressRange
- Parameters:
start
- the first address in the range to test for intersection.end
- the last address in the range to test for intersection.- See Also:
-
intersect
Description copied from interface:AddressRange
Computes the intersection of this range with another.- Specified by:
intersect
in interfaceAddressRange
- Parameters:
range
- the range to intersect this range with- Returns:
- AddressRange the intersection or null if the ranges do not intersect.
- See Also:
-
intersectRange
Description copied from interface:AddressRange
Computes the intersection of this range with another.- Specified by:
intersectRange
in interfaceAddressRange
- Parameters:
start
- of rangeend
- end of range- Returns:
- AddressRange the intersection or null if the ranges do not intersect.
- See Also:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AddressRange>
-
iterator
-