示例#1
0
 public static <T> Set<T> findOperators(Collection<Operator<?>> starts, Class<T> clazz) {
   Set<T> found = new HashSet<T>();
   for (Operator<?> start : starts) {
     findOperators(start, clazz, found);
   }
   return found;
 }
示例#2
0
 @SuppressWarnings("unchecked")
 private static <T> Set<T> findOperators(Operator<?> start, Class<T> clazz, Set<T> found) {
   if (clazz.isInstance(start)) {
     found.add((T) start);
   }
   if (start.getChildOperators() != null) {
     for (Operator<?> child : start.getChildOperators()) {
       findOperators(child, clazz, found);
     }
   }
   return found;
 }