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 Details

    • 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, DataType filler, 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 filler data-type is provided, it is used to fill holes in structures. If a maximum number of extracted primitives is exceeded, or if no filler is provided and a hole is encountered, 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
      filler - is the data-type to use as filler (or null)
      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