Package ghidra.program.model.lang.protorules

# Class PrimitiveExtractor

java.lang.Object
ghidra.program.model.lang.protorules.PrimitiveExtractor

public class PrimitiveExtractor extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `PrimitiveExtractor.Primitive`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PrimitiveExtractor(DataType dt, boolean unionIllegal, int offset, int max)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `containsHoles()`
  `boolean`
  `containsUnknown()`
  `PrimitiveExtractor.Primitive`
  `get(int i)`
  Get the i-th extracted primitive and its offset
  `boolean`
  `isAligned()`
  `boolean`
  `isValid()`
  `int`
  `size()`

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

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

- ## Constructor Details

  - ### PrimitiveExtractor

    public PrimitiveExtractor(DataType dt, boolean unionIllegal, int offset, int max)
    Parameters:
      `dt` - is data-type extract from
      `unionIllegal` - is true if unions encountered during extraction are considered illegal
      `offset` - is the starting offset to associate with the data-type
      `max` - is the maximum number of primitives to extract before giving up

- ## Method Details

  - ### isValid

    public boolean isValid()
    Returns:
      true if all primitive elements were extracted

  - ### containsUnknown

    public boolean containsUnknown()
    Returns:
      true if any extracted element was unknown/undefined

  - ### isAligned

    public boolean isAligned()
    Returns:
      true if all extracted elements are aligned

  - ### containsHoles

    public boolean containsHoles()
    Returns:
      true if there is extra space in the data-type that is not alignment padding

  - ### size

    public int size()
    Returns:
      the number of primitives extracted

  - ### get

    public PrimitiveExtractor.Primitive get(int i)
    Get the i-th extracted primitive and its offset
    Parameters:
      `i` - is the index
    Returns:
      the primitive and offset