Package ghidra.util
Class TwoWayBreakdownAddressRangeIterator
java.lang.Object
generic.util.AbstractPeekableIterator<Map.Entry<AddressRange,TwoWayBreakdownAddressRangeIterator.Which>>
ghidra.util.TwoWayBreakdownAddressRangeIterator
- All Implemented Interfaces:
PeekableIterator<Map.Entry<AddressRange,,TwoWayBreakdownAddressRangeIterator.Which>> Iterator<Map.Entry<AddressRange,TwoWayBreakdownAddressRangeIterator.Which>>
public class TwoWayBreakdownAddressRangeIterator
extends AbstractPeekableIterator<Map.Entry<AddressRange,TwoWayBreakdownAddressRangeIterator.Which>>
An iterator that takes two iterators over address ranges and "breaks down" where they do and do
not overlap. Consider one iterator L that contains only [1,3], and another R that contains only
[2,4]. The two could be plotted:
1 2 3 4
[---L---]
[---R---]
This will return an iterator over range-which pairs. "Which" indicates which iterators include
the given range, TwoWayBreakdownAddressRangeIterator.Which.LEFT, TwoWayBreakdownAddressRangeIterator.Which.RIGHT, or TwoWayBreakdownAddressRangeIterator.Which.BOTH. There is no
NONE, so gaps are omitted. For the example above:
1 2 3 4 [L][-B--][R]
This supports the computation of difference, symmetric difference, and intersection. NOTE: Clients cannot save the entries returned by the iterator. The entry is only valid during iteration, and it is reused by the iterator for each subsequent entry.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA mutable map entrystatic enumIndicates which of the input iterators contain a range -
Field Summary
Fields inherited from class generic.util.AbstractPeekableIterator
next, soughtNext -
Constructor Summary
ConstructorsConstructorDescriptionTwoWayBreakdownAddressRangeIterator(Iterator<AddressRange> lit, Iterator<AddressRange> rit, boolean forward) Create an iterator that "breaks down" the two address range iterators. -
Method Summary
Modifier and TypeMethodDescriptionseekNext()Find the next element in this iterator, because the client called eitherAbstractPeekableIterator.nextorAbstractPeekableIterator.peek().Methods inherited from class generic.util.AbstractPeekableIterator
hasNext, next, peekMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
TwoWayBreakdownAddressRangeIterator
public TwoWayBreakdownAddressRangeIterator(Iterator<AddressRange> lit, Iterator<AddressRange> rit, boolean forward) Create an iterator that "breaks down" the two address range iterators.- Parameters:
lit- the iterator of ranges on the leftrit- the iterator of ranges on the rightforward- true for forward iteration, false for reverse. The input iterators must be ordered according to this flag.
-
-
Method Details
-
seekNext
Description copied from class:AbstractPeekableIteratorFind the next element in this iterator, because the client called eitherAbstractPeekableIterator.nextorAbstractPeekableIterator.peek().- Specified by:
seekNextin classAbstractPeekableIterator<Map.Entry<AddressRange,TwoWayBreakdownAddressRangeIterator.Which>> - Returns:
- the next element
-