Class MultiCodeUnitIterator

java.lang.Object
ghidra.program.util.MultiCodeUnitIterator

public class MultiCodeUnitIterator extends Object
MultiCodeUnitIterator is a class for iterating through multiple code unit iterators simultaneously. The next() method returns an array of code units, since a code unit can be obtained from neither, either, or both of the original code unit iterators.
  • Constructor Details

    • MultiCodeUnitIterator

      public MultiCodeUnitIterator(Listing[] listings, Address addr, boolean forward)
      Constructor of a multi-code unit iterator.
      Parameters:
      listings - an array of the program listings whose code units are to be iterated.
      addr - the address where the iterator should start.
      forward - true indicates a forward iterator. false indicates a backwards iterator.
    • MultiCodeUnitIterator

      public MultiCodeUnitIterator(Listing[] listings, AddressSetView addrs, boolean forward)
      Constructor of a multi-code unit iterator.
      Parameters:
      listings - an array of the program listings whose code units are to be iterated.
      addrs - the address set over which the code units should be iterated.
      forward - true indicates a forward iterator. false indicates a backwards iterator.
  • Method Details

    • hasNext

      public boolean hasNext()
      Determines whether or not any of the iterators have a next code unit.
      Returns:
      true if the next code unit can be obtained from any of the code unit iterators.
    • next

      public CodeUnit[] next()
      Returns the next code unit(s). The next code unit could be from any one or more of the iterators. The array returns a code unit for each listing that has a code unit with a minimum address at the next iterator address. The code units in the array match up to the listings in the array passed to this classes constructor. The code unit will be null in the array if no code unit started at the next code unit address for that listing.
      Returns:
      an array with the next code unit(s).