@SuppressWarnings("unchecked") public static <T,P extends Predicate<T>>P find(Predicate<T> p,Class<P> clazz){
  if (clazz.isAssignableFrom(p.getClass())) {
    return (P)p;
  }
  for (  Predicate<T> c : p.getChildren()) {
    P r=find(c,clazz);
    if (r != null) {
      return r;
    }
  }
  return null;
}

@ SuppressWarnings ( "unchecked" ) public static < T , P extends Predicate < T > > P find ( Predicate < T > p , Class < P > clazz ) { if ( clazz . isAssignableFrom ( p . getClass ( ) ) ) { return ( P ) p ; } for ( Predicate < T > c : p . getChildren ( ) ) { P r = find ( c , clazz ) ; if ( r != null ) { return r ; } } return null ; }
locate a predicate in the predicate tree .
