Class Filter<T extends DataObject>

java.lang.Object
org.spiderwiz.core.Filter<T>
Type Parameters:
T - the type of data objects maintained by an implementation of this filter.
Direct Known Subclasses:
CatchAllFilter

public abstract class Filter<T extends DataObject>
extends Object
A base class for implementing Data Object Filters.

A Spiderwiz filter is an object that lets you traverse the data object tree, or a branch of it, to collect data objects of a specific type that meet a specific condition. You apply the filter by calling DataObject.getFilteredChildren() on the parent of the branch you want to filter. If you want to apply the filter on the entire data object tree, call it on its Root Object.

Filtering works as follows. First, the object being filtered is checked for the existence of direct children of the specified type. If there are any, filterObject() is applied on them and the children that returns true are collected. If the filtered object does not have direct children of the specified type, filterParent() is applied on every child of the filtered object, regardless of its type, and if the method returns true then the filtering mechanism is applied on the child recursively.

  • Constructor Summary

    Constructors 
    Constructor Description
    Filter​(Class<T> type)
    Constructs a filter for a specific data object type.
  • Method Summary

    Modifier and Type Method Description
    protected abstract boolean filterObject​(T object)
    Implement this method to return true if the filtered object passes the filter.
    protected boolean filterParent​(DataObject parent)
    Implement this method to return true if filtering shall be applied on the branch under this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • filterObject

      protected abstract boolean filterObject​(T object)
      Implement this method to return true if the filtered object passes the filter.
      Parameters:
      object - the filtered object.
      Returns:
      true if and only if the filtered object passes the filter.
    • filterParent

      protected boolean filterParent​(DataObject parent)
      Implement this method to return true if filtering shall be applied on the branch under this object.
      Parameters:
      parent - the parent of the filtered branch.
      Returns:
      true if and only if filtering shall be applied on the branch under this object.