Read hints from all resources in a collection, retaining
<code>suiteNames</code>. If <code>suiteNames</code> is null,
everything is retained.
167152
public static Map<String,List<Long>> mergeHints(
      Collection<ResourceCollection> resources, Collection<String> suiteNames) {
    final Map<String,List<Long>> hints = new HashMap<>();
    for (ResourceCollection rc : resources) {
      Iterator<Resource> i = rc.iterator();
      while (i.hasNext()) {
        InputStream is = null;
        Resource r = i.next();
        try {
          is = r.getInputStream();
          mergeHints(is, hints);

          // Early prune the hints to those we have on the list.
          if (suiteNames != null) {
            hints.keySet().retainAll(suiteNames);
          }
        } catch (IOException e) {
          throw new BuildException("Could not read hints from resource: "
              + r.getDescription(), e);
        } finally {
          try {
            if (is != null) is.close();
          } catch (IOException e) {
            throw new BuildException("Could not close hints file: " + r.getDescription());
          }
        }
      }
    }
    return hints;
  }
908745
public void setFindings(java.util.Collection<AwsSecurityFinding> findings) {
        if (findings == null) {
            this.findings = null;
            return;
        }

        this.findings = new java.util.ArrayList<AwsSecurityFinding>(findings);
    }
839547
private void searchProperties(List<CmsResource> resources) {

        if (CmsSourceSearchForm.REGEX_ALL.equals(m_settings.getSearchpattern())) {
            for (CmsResource resource : resources) {
                m_matchedResources.add(resource);
                getReport().println(
                    Messages.get().container(Messages.RPT_SOURCESEARCH_MATCHED_0),
                    I_CmsReport.FORMAT_OK);
            }

        } else {
            for (CmsResource resource : resources) {
                Matcher matcher;
                try {
                    CmsProperty prop = getCms().readPropertyObject(resource, m_settings.getProperty().getName(), false);
                    matcher = Pattern.compile(m_settings.getSearchpattern()).matcher(prop.getValue());
                    if (matcher.find()) {
                        m_matchedResources.add(resource);
                        getReport().println(
                            Messages.get().container(Messages.RPT_SOURCESEARCH_MATCHED_0),
                            I_CmsReport.FORMAT_OK);
                    } else {
                        getReport().println(
                            Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0),
                            I_CmsReport.FORMAT_NOTE);
                    }

                } catch (CmsException e) {
                    LOG.error("Ubable to read property", e);
                }
            }
        }
        if (m_replace) {
            replaceProperties(m_matchedResources);
        }
        // report results
        reportResults(resources.size());
    }
1134607
@Deprecated
  public static <T> boolean allTheSame(final Iterable<T> iterable) {
    if (Iterables.isEmpty(iterable)) {
      return true;
    }

    final T reference = Iterables.getFirst(iterable, null);

    for (final T x : iterable) {
      if (!x.equals(reference)) {
        return false;
      }
    }
    return true;
  }
216892
@Override
    public synchronized Collection<T> readAll() throws Exception {
        Cursor cursor = db.query(transformer.getTableName(), transformer.getFields(), null, null, null, null, null);
        Collection<T> list = getAllCursor(cursor);
        return list;
    }
1134433
protected void cacheCollection() {
        this.clear();
        for (FluentModelTImpl childResource : this.listChildResources()) {
            this.childCollection.put(childResource.childResourceKey(), childResource);
        }
    }
111606
public <T extends Collection<?>> T notEmpty(final T collection, final String message) {
        if (collection == null) {
            failNull(message);
        }
        if (collection.isEmpty()) {
            fail(message);
        }
        return collection;
    }
1106029
public void setResources(java.util.Collection<Resource> resources) {
        if (resources == null) {
            this.resources = null;
            return;
        }

        this.resources = new java.util.ArrayList<Resource>(resources);
    }
779390
public void readDependencies(CmsObject cms, List<CmsResource> folderContent) {

        Map<Integer, CmsDocumentDependency> attachments = new HashMap<Integer, CmsDocumentDependency>();
        if (isAttachment()) {
            attachments.put(new Integer(getAttachmentNumber()), this);
        }

        // iterate all resources in the folder to check if this is a language version
        Iterator<CmsResource> i = folderContent.iterator();
        while (i.hasNext()) {
            CmsResource r = i.next();
            // only add files and don't add the resource itself again
            if (r.isFile() && !getResource().getRootPath().equals(r.getRootPath())) {
                CmsPublishedResource pubRes = new CmsPublishedResource(
                    r,
                    getResource().getPublishTag(),
                    CmsResourceState.STATE_CHANGED);
                CmsDocumentDependency dep = new CmsDocumentDependency(pubRes);
                if (getDocumentName().equals(dep.getDocumentName())) {
                    if (isAttachment()) {
                        // this document is an attachment
                        if (dep.isAttachment()) {
                            if ((getAttachmentNumber() == dep.getAttachmentNumber()) && dep.hasLocaleFileName()) {
                                // the dependency must be a language version of this attachment document
                                addVariant(dep);
                            }
                            if (getAttachmentNumber() == dep.getAttachmentNumber()) {
                                dep.setMainDocument(dep);
                            } else {
                                Integer attNum = new Integer(dep.getAttachmentNumber());
                                CmsDocumentDependency att = attachments.get(attNum);
                                if (att != null) {
                                    att.addVariant(dep);
                                } else {
                                    attachments.put(attNum, dep);
                                }
                            }
                        } else {
                            // this is the main document of the dependency
                            setMainDocument(dep);
                        }
                    } else {
                        // this document is a main document
                        if (dep.isAttachment()) {
                            // add this dependency as an attachment
                            addAttachment(dep);
                        } else if (CmsStringUtil.isEqual(getDocumentSuffix(), dep.getDocumentSuffix())) {
                            // if this is no attachment, and the file suffix is equal,
                            // this must be a language version of the main document
                            addVariant(dep);
                        }
                        // if the file suffix is NOT equal, this is a new main document
                        setMainDocument(this);
                    }
                }
            }
        }

        if (m_mainDocument != null) {
            for (CmsDocumentDependency att : attachments.values()) {
                m_mainDocument.addAttachment(att);
            }
            // add the main document as dependency for this attachment
            addDependency(m_mainDocument);
            for (CmsDocumentDependency var : getVariants()) {
                String mainFileName = getMainDocument().getDocumentName();
                if (getMainDocument().getDocumentSuffix() != null) {
                    mainFileName += getMainDocument().getDocumentSuffix();
                }
                if (mainFileName.equals(var.getResource().getRootPath())) {
                    setType(DependencyType.variant);
                    break;
                } else {
                    setType(DependencyType.document);
                    break;
                }
            }
        }
    }
178138
private void readResources(Project ganttProject)
   {
      Resources resources = ganttProject.getResources();
      readResourceCustomPropertyDefinitions(resources);
      readRoleDefinitions(ganttProject);

      for (net.sf.mpxj.ganttproject.schema.Resource gpResource : resources.getResource())
      {
         readResource(gpResource);
      }
   }
314167
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)
   {
      Project.Resources resources = project.getResources();
      if (resources != null)
      {
         for (Project.Resources.Resource resource : resources.getResource())
         {
            readResource(resource, calendarMap);
         }
      }
   }
744413
public Resources interpret(final Set<ClassResult> classResults) {
        resources = new Resources();
        resources.setBasePath(PathNormalizer.getApplicationPath(classResults));

        javaTypeAnalyzer = new JavaTypeAnalyzer(resources.getTypeRepresentations());
        dynamicTypeAnalyzer = new DynamicTypeAnalyzer(resources.getTypeRepresentations());
        stringParameterResolver = new StringParameterResolver(resources.getTypeRepresentations(), javaTypeAnalyzer);

        classResults.stream().filter(c -> c.getResourcePath() != null).forEach(this::interpretClassResult);
        resources.consolidateMultiplePaths();

        return resources;
    }
1264406
def check_hints(self, ds):
        '''
        
        '''
        ret_val = []

        ret_val.extend(self._check_hint_bounds(ds))

        return ret_val
872201
public void setFindings(java.util.Collection<AuditFinding> findings) {
        if (findings == null) {
            this.findings = null;
            return;
        }

        this.findings = new java.util.ArrayList<AuditFinding>(findings);
    }
1136209
private static Set<String> collectKnownPrefixes(FieldInfo fi)
      throws IOException {
    if (fi != null) {
      HashSet<String> result = new HashSet<>();
      String singlePositionPrefixes = fi.getAttribute(
          MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SINGLE_POSITION);
      String multiplePositionPrefixes = fi.getAttribute(
          MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_MULTIPLE_POSITION);
      String setPositionPrefixes = fi.getAttribute(
          MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SET_POSITION);
      if (singlePositionPrefixes != null) {
        String[] prefixes = singlePositionPrefixes
            .split(Pattern.quote(MtasToken.DELIMITER));
        for (int i = 0; i < prefixes.length; i++) {
          String item = prefixes[i].trim();
          if (!item.equals("")) {
            result.add(item);
          }
        }
      }
      if (multiplePositionPrefixes != null) {
        String[] prefixes = multiplePositionPrefixes
            .split(Pattern.quote(MtasToken.DELIMITER));
        for (int i = 0; i < prefixes.length; i++) {
          String item = prefixes[i].trim();
          if (!item.equals("")) {
            result.add(item);
          }
        }
      }
      if (setPositionPrefixes != null) {
        String[] prefixes = setPositionPrefixes
            .split(Pattern.quote(MtasToken.DELIMITER));
        for (int i = 0; i < prefixes.length; i++) {
          String item = prefixes[i].trim();
          if (!item.equals("")) {
            result.add(item);
          }
        }
      }
      return result;
    } else {
      return Collections.emptySet();
    }
  }
1210921
def get_querysets_for_context_hints(context_hints_per_source):
    
    model_select_relateds = defaultdict(set)
    model_prefetch_relateds = defaultdict(set)
    model_querysets = {}
    for context_hints in context_hints_per_source.values():
        for hints in context_hints.values():
            model = get_model(hints['app_name'], hints['model_name'])
            model_querysets[model] = model.objects
            model_select_relateds[model].update(hints.get('select_related', []))
            model_prefetch_relateds[model].update(hints.get('prefetch_related', []))

    # Attach select and prefetch related parameters to the querysets if needed
    for model, queryset in model_querysets.items():
        if model_select_relateds[model]:
            queryset = queryset.select_related(*model_select_relateds[model])
        if model_prefetch_relateds[model]:
            queryset = queryset.prefetch_related(*model_prefetch_relateds[model])
        model_querysets[model] = queryset

    return model_querysets
434505
@Override
	public boolean containsAll(Collection<?> collection) {
		if (booleanTerms == null) {
			return false;
		}
		return booleanTerms.containsAll(collection);
	}