1 package com.openedit.util.strainer; 2 3 /** 4 * This interface supplies a contract for determining whether an object passes 5 * certain criteria. It should be implemented by multiple subclasses, each of 6 * which implements a particular search criterion. Filters can be combined via 7 * combinatorial filters ({@link AndFilter}, {@link OrFilter}, etc.). 8 * 9 * @author Eric Galluzzo 10 */ 11 public interface Filter 12 { 13 /** 14 * Determine whether the given object passes this filter. 15 * 16 * @param inObj The object to check 17 * 18 * @return <code>true</code> if the object passes, <code>false</code> 19 * otherwise. 20 * 21 * @exception FilterException If some error occurs while filtering 22 * @exception ClassCastException If the given object is not of the 23 * expected type 24 */ 25 boolean passes(Object inObj) throws FilterException, ClassCastException; 26 27 /** 28 * Accept the given filter visitor as per the Acyclic Visitor pattern, which 29 * is based on the standard Gang of Four Visitor pattern. 30 * 31 * @param inFilterVisitor The visitor to accept 32 * 33 * @throws FilterException 34 * If the visitor threw an exception 35 */ 36 void accept(FilterVisitor inFilterVisitor) throws FilterException; 37 38 /** 39 * List any child filters 40 * @author sgonsa 41 * @return may return null if there are not children 42 * 43 */ 44 Filter[] getFilters(); 45 } 46