/** * This method derives the content. * * @return The derived content */ protected java.util.List<Object> deriveContent() { java.util.List<Object> ret = new java.util.ArrayList<Object>(); ActiveCollection parent = getParent(); Predicate pred = getPredicate(); ActiveCollectionContext context = getContext(); if (parent != null && pred != null) { for (Object value : (ActiveList) parent) { if (pred.evaluate(context, value)) { ret.add(value); } } } return (ret); }
/** * This constructor initializes the active list as a derived version of the supplied collection, * that applies the supplied predicate. * * @param name The name * @param parent The parent collection * @param context The context * @param predicate The predicate * @param properties The optional properties */ protected ActiveList( String name, ActiveCollection parent, ActiveCollectionContext context, Predicate predicate, java.util.Map<String, Object> properties) { super(name, parent, context, predicate, properties); if (isActive()) { // Filter the parent list items, to determine which pass the predicate for (Object value : (ActiveList) parent) { if (predicate.evaluate(context, value)) { insert(null, value); } } } }