private DirFilter getDirFilter() { DirFilter deepestDirFilter = new DirFilter(Operator.EQ, preferences.get(Keys.MEDIA_DIR)); for (Filter<? super Tables.Tracks> filter : getFilters()) { final DirFilter finalDeepestDirFilter = deepestDirFilter; deepestDirFilter = filter.accept( new TurtleFilterVisitor<Tables.Tracks, DirFilter>() { public DirFilter visit(DirFilter dirFilter) { return finalDeepestDirFilter .getValue() .contains(dirFilter.getValueWithoutWildcards()) ? finalDeepestDirFilter : new DirFilter(Operator.EQ, dirFilter.getValueWithoutWildcards()); } public DirFilter visit(NotFilter<? super Tables.Tracks> notFilter) { return finalDeepestDirFilter; } public <T, Z> DirFilter visit( FieldFilter<? super Tables.Tracks, Z, T> fieldFilter) { return finalDeepestDirFilter; } public DirFilter visit(FilterSet<? super Tables.Tracks> filterSet) { return finalDeepestDirFilter; } }); } return deepestDirFilter; }
XmlNode[] getMatchingChildren(Filter filter) { ArrayList rv = new ArrayList(); NodeList nodes = this.dom.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (filter.accept(node)) { rv.add(createImpl(node)); } } return (XmlNode[]) rv.toArray(new XmlNode[0]); }