1 package org.andromda.metafacades.uml;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5
6 import org.apache.commons.collections.CollectionUtils;
7 import org.apache.commons.collections.Predicate;
8
9
10 /***
11 * Filters a collection of objects so that the collection contains only those
12 * objects that pass the <code>evaluate</code> test. <p/> It is useful for
13 * filtering the results of a query.
14 * </p>
15 *
16 * @author Anthony Mowers
17 * @author Chad Brandon
18 */
19 public abstract class FilteredCollection
20 extends ArrayList
21 implements Predicate
22 {
23 /***
24 * Constructor for the FilterCollection object
25 *
26 * @param collection
27 */
28 public FilteredCollection(Collection collection)
29 {
30 this.addAll(collection);
31 CollectionUtils.filter(
32 this,
33 this);
34 }
35
36 /***
37 * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)
38 */
39 public abstract boolean evaluate(Object object);
40 }