public <E, T> E findByToken(final Production<E, T> production, E element, final Predicate<T> matches) { return find(production, element, new Predicate<E>() { public boolean apply(E input) { T token = production.getToken(input); return token != null && matches.apply(token); } }); }
public <E, T> E findByToken(final Production<E, T> production, E element, final Predicate<T> matches) { return find(production, element, new Predicate<E>() { @Override public boolean apply(E input) { T token = production.getToken(input); return token != null && matches.apply(token); } }); }
public <E, T> E find(Production<E, T> production, E element, Predicate<E> matches) { if (matches.apply(element)) return element; Iterable<E> children = getChildren(production, element); if (children != null) for (E child : children) { E found = find(production, child, matches); if (found != null) return found; } return null; }
public <E, T> E find(Production<E, T> production, E element, Predicate<E> matches) { if (matches.apply(element)) return element; Iterable<E> children = getChildren(production, element); if (children != null) for (E child : children) { E found = find(production, child, matches); if (found != null) return found; } return null; }
public <E, T> E find(Production<E, T> production, Predicate<E> matches) { return find(production, production.getRoot(), matches); }
public <E, T> E find(Production<E, T> production, Predicate<E> matches) { return find(production, production.getRoot(), matches); }