Package ghidra.program.model.lang.protorules

# Interface DatatypeFilter

All Known Implementing Classes:
  `HomogeneousAggregate`, `MetaTypeFilter`, `SizeRestrictedFilter`

public interface DatatypeFilter
A filter selecting a specific class of data-type. A test of whether data-type belongs to its class can be performed by calling the filter() method.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DatatypeFilter`
  `clone()`
  Make a copy of this filter
  `void`
  `encode(Encoder encoder)`
  Encode this filter and its configuration to a stream
  `static boolean`
  `extractPrimitives(DataType dt, int max, ArrayList<DataType> res)`
  Extract an ordered list of primitive data-types making up the given data-type The primitive data-types are passed back in an ArrayList.
  `boolean`
  `filter(DataType dt)`
  Test whether the given data-type belongs to this filter's data-type class
  `boolean`
  `isEquivalent(DatatypeFilter op)`
  Test if the given filter is configured and performs identically to this
  `static DatatypeFilter`
  `restoreFilterXml(XmlPullParser parser)`
  Instantiate a filter from the given stream.
  `void`
  `restoreXml(XmlPullParser parser)`
  Configure details of the data-type class being filtered from the given stream

- ## Method Details

  - ### clone

    DatatypeFilter clone()
    Make a copy of this filter
    Returns:
      the new copy

  - ### isEquivalent

    boolean isEquivalent(DatatypeFilter op)
    Test if the given filter is configured and performs identically to this
    Parameters:
      `op` - is the given filter
    Returns:
      true if the two filters are equivalent

  - ### filter

    boolean filter(DataType dt)
    Test whether the given data-type belongs to this filter's data-type class
    Parameters:
      `dt` - is the given data-type to test
    Returns:
      true if the data-type is in the class, false otherwise

  - ### encode

    void encode(Encoder encoder) throws IOException
    Encode this filter and its configuration to a stream
    Parameters:
      `encoder` - is the stream encoder
    Throws:
      `IOException` - for problems writing to the stream

  - ### restoreXml

    void restoreXml(XmlPullParser parser) throws XmlParseException
    Configure details of the data-type class being filtered from the given stream
    Parameters:
      `parser` - is the given stream decoder
    Throws:
      `XmlParseException` - if there are problems with the stream

  - ### extractPrimitives

    static boolean extractPrimitives(DataType dt, int max, ArrayList<DataType> res)
    Extract an ordered list of primitive data-types making up the given data-type The primitive data-types are passed back in an ArrayList. If the given data-type is already primitive, it is passed back as is. Otherwise if it is composite, its components are recursively listed. If a maximum number of extracted primitives is exceeded, or if the primitives are not properly aligned, or if a non-primitive non-composite data-type is encountered, false is returned.
    Parameters:
      `dt` - is the given data-type to extract primitives from
      `max` - is the maximum number of primitives to extract before giving up
      `res` - will hold the list of primitives
    Returns:
      true if all primitives were extracted

  - ### restoreFilterXml

    static DatatypeFilter restoreFilterXml(XmlPullParser parser) throws XmlParseException
    Instantiate a filter from the given stream.
    Parameters:
      `parser` - is the given stream decoder
    Returns:
      the new data-type filter instance
    Throws:
      `XmlParseException` - for problems reading the stream