@Override
 public ScoredCandidates<Container> generate(Container content, ResultDescription desc) {
   OptionalMap<String, EquivalenceSummary> childSummaries =
       summaryStore.summariesForUris(Iterables.transform(content.getChildRefs(), ChildRef.TO_URI));
   Multiset<String> parents = HashMultiset.create();
   for (EquivalenceSummary summary : Optional.presentInstances(childSummaries.values())) {
     Iterables.addAll(
         parents,
         Iterables.filter(
             Iterables.transform(summary.getEquivalents().values(), TO_PARENT),
             Predicates.notNull()));
   }
   return scoreContainers(parents, childSummaries.size(), desc);
 }
Пример #2
0
 private static Iterable<Field> filterFields(Iterable<ArgInfo> infos, Predicate<Field> filter) {
   return Iterables.filter(
       Optional.presentInstances(Iterables.transform(infos, TO_FIELD)), filter);
 }