Package ghidra.util

Class 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.