Package ghidra.util

# Class AddressIteratorAdapter

java.lang.Object
generic.util.FlattenedIterator<AddressRange,Address>
ghidra.util.AddressIteratorAdapter

All Implemented Interfaces:
  `AddressIterator`, `Iterable<Address>`, `Iterator<Address>`

public class AddressIteratorAdapter extends FlattenedIterator<AddressRange,Address> implements AddressIterator
Convert an `AddressRange` iterator to an `AddressIterator`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `AddressIteratorAdapter.BackwardAddressIterator`
  `protected static class`
  `AddressIteratorAdapter.ForwardAddressIterator`

- ## Field Summary

  ### Fields inherited from class generic.util.FlattenedIterator

  `inner, innerFactory, outer, preppedInner`

  ### Fields inherited from interface ghidra.program.model.address.AddressIterator

  `EMPTY_ITERATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AddressIteratorAdapter(Iterator<AddressRange> outer, boolean forward)`
  Construct an `AddressIterator` over the given address ranges
  `AddressIteratorAdapter(Iterator<AddressRange> outer, Address start, boolean forward)`
  Construct an `AddressIterator` over the given address ranges, truncating the initial range to the given start

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Iterable<Address>`
  `forRange(AddressRange range, boolean forward)`
  Iterate over the addresses in the given range
  `Iterator<Address>`
  `iterator()`

  ### Methods inherited from class generic.util.FlattenedIterator

  `hasNext, next, remove, start`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.model.address.AddressIterator

  `hasNext, next`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining, remove`

- ## Constructor Details

  - ### AddressIteratorAdapter

    public AddressIteratorAdapter(Iterator<AddressRange> outer, boolean forward)
    Construct an `AddressIterator` over the given address ranges
    Parameters:
      `outer` - an iterator of address ranges
      `forward` - true for forward iteration. Otherwise backward iteration. This flag must be consistent with the order of the given outer iterator.

  - ### AddressIteratorAdapter

    public AddressIteratorAdapter(Iterator<AddressRange> outer, Address start, boolean forward)
    Construct an `AddressIterator` over the given address ranges, truncating the initial range to the given start
    Parameters:
      `outer` - the iterator of address ranges, the first of which must contain or come after the given start.
      `start` - the starting address
      `forward` - true for forward iteration. Otherwise backward iteration. This flag must be consistent with the order of the given outer iterator.o

- ## Method Details

  - ### forRange

    public static Iterable<Address> forRange(AddressRange range, boolean forward)
    Iterate over the addresses in the given range
    Parameters:
      `range` - the range
      `forward` - true to iterate forward, false for backward
    Returns:
      the iterable

  - ### iterator

    public Iterator<Address> iterator()
    Specified by:
      `iterator` in interface `AddressIterator`
    Specified by:
      `iterator` in interface `Iterable<Address>`