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
ConstructorsConstructorDescriptionAddressRangeImpl(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 TypeMethodDescriptionintCompares the given address to this address range.intbooleanReturns true if the given address is contained in the range.booleanReturns the number of addresses as a BigInteger.longReturns the number of addresses in the range.inthashCode()intersect(AddressRange range) Computes the intersection of this range with another.intersectRange(Address start, Address end) Computes the intersection of this range with another.booleanintersects(AddressRange range) Returns true if the given range intersects this range.booleanintersects(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, waitMethods 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:AddressRangeReturns true if the given address is contained in the range.- Specified by:
containsin interfaceAddressRange- See Also:
-
getAddressSpace
- Specified by:
getAddressSpacein interfaceAddressRange- Returns:
- address space this range resides within
-
getMinAddress
- Specified by:
getMinAddressin interfaceAddressRange- Returns:
- the minimum address in the range.
- See Also:
-
getMaxAddress
- Specified by:
getMaxAddressin interfaceAddressRange- Returns:
- the maximum address in the range.
- See Also:
-
getLength
public long getLength()Description copied from interface:AddressRangeReturns the number of addresses in the range.- Specified by:
getLengthin interfaceAddressRange- See Also:
-
getBigLength
Description copied from interface:AddressRangeReturns the number of addresses as a BigInteger.- Specified by:
getBigLengthin interfaceAddressRange- Returns:
- the number of addresses as a BigInteger.
-
equals
-
hashCode
public int hashCode() -
compareTo
Description copied from interface:AddressRangeCompares the given address to this address range.- Specified by:
compareToin 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:AddressRangeReturns true if the given range intersects this range.- Specified by:
intersectsin interfaceAddressRange- Parameters:
range- the range to test for intersection with.- See Also:
-
intersects
Description copied from interface:AddressRangeReturns true if the given range intersects this range.- Specified by:
intersectsin 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:AddressRangeComputes the intersection of this range with another.- Specified by:
intersectin 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:AddressRangeComputes the intersection of this range with another.- Specified by:
intersectRangein 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:
compareToin interfaceComparable<AddressRange>
-
iterator
-