當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeMultimap.keySet方法代碼示例

本文整理匯總了Java中com.google.common.collect.TreeMultimap.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMultimap.keySet方法的具體用法?Java TreeMultimap.keySet怎麽用?Java TreeMultimap.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.TreeMultimap的用法示例。


在下文中一共展示了TreeMultimap.keySet方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tag

import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
public Map<String, String> tag(Feature feature) {
    TreeMultimap<String, Integer> speeds = TreeMultimap.create();
    List<SpeedRestriction> restrictions = dbf.getSpeedRestrictions(feature.getLong("ID"));
    boolean reversed = isReversed(feature);
    for (SpeedRestriction restriction : restrictions) {
        switch (restriction.getValidity()) {
            case positive:
                speeds.put(reversed ? "maxspeed:backward" : "maxspeed:forward", restriction.getSpeed());
                break;
            case negative:
                speeds.put(reversed ? "maxspeed:forward" : "maxspeed:backward", restriction.getSpeed());
                break;
            case both:
                speeds.put("maxspeed", restriction.getSpeed());
                break;
        }
    }
    Map<String, String> result = Maps.newHashMap();
    for (String key : speeds.keySet()) {
        result.put(key, String.valueOf(speeds.get(key).iterator().next()));
    }
    return result;
}
 
開發者ID:Mappy,項目名稱:fpm,代碼行數:24,代碼來源:SpeedRestrictionTagger.java

示例2: forkByClassifier

import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
private Map<String, TreeMultimap<Calendar, ItemInfo>> forkByClassifier(
        TreeMultimap<Calendar, ItemInfo> cleanupCandidates) {
    Map<String, TreeMultimap<Calendar, ItemInfo>> result= Maps.newHashMap();
    for (Calendar calendar : cleanupCandidates.keySet()) {
        NavigableSet<ItemInfo> itemInfos = cleanupCandidates.get(calendar);
        for (ItemInfo itemInfo : itemInfos) {
            String classifier=resolveClassifier(itemInfo);
            TreeMultimap<Calendar, ItemInfo> classifierMap = result.get(classifier);
            if(classifierMap==null){
                //classifierMap= TreeMultimap.create(Ordering.natural().reverse(), Ordering.natural().reverse());
                classifierMap= TreeMultimap.create(Ordering.natural(), Ordering.natural());;
                result.put(classifier,classifierMap);
            }
            classifierMap.put(calendar,itemInfo);
        }
    }
    return result;
}
 
開發者ID:alancnet,項目名稱:artifactory,代碼行數:19,代碼來源:IntegrationCleanupServiceImpl.java

示例3: writeIFile

import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
static Path writeIFile(int keysPerFile, int repeatCount) throws
    IOException {
  TreeMultimap<Integer, Long> dataSet = createDataForIFile(keysPerFile, repeatCount);
  LOG.info("DataSet size : " + dataSet.size());
  Path path = new Path(workDir + "/src", "data_" + System.nanoTime() + ".out");
  FSDataOutputStream out = localFs.create(path);
  //create IFile with RLE
  IFile.Writer writer = new IFile.Writer(defaultConf, out, IntWritable.class
      , LongWritable.class, null, null, null, true);

  for (Integer key : dataSet.keySet()) {
    for (Long value : dataSet.get(key)) {
      writer.append(new IntWritable(key), new LongWritable(value));
      verificationDataSet.put(key, value);
    }
  }
  writer.close();
  out.close();
  return path;
}
 
開發者ID:apache,項目名稱:tez,代碼行數:21,代碼來源:TestTezMerger.java

示例4: getRecommendation

import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
/**
 * Methods to retrieve Document that is similar to a given document
 *
 * @param _documentNumber
 * @param _resultsType
 * @return
 * @throws com.google.api.services.datastore.client.DatastoreException
 */
@Override
public RecResponseBean getRecommendation(
        final long _documentNumber,
        ResultsType _resultsType) throws DatastoreException, DocumentNotFoundException {

    DocumentBean baseDocument = dao.getDocument(_documentNumber);
    TreeMultimap<BaseContent.ContentType, BaseContent> relevantBeans = baseDocument.getRelevantBeans();
    SortedSet<BaseContent> topicRelatedBeans = relevantBeans.removeAll(BaseContent.ContentType.TOPICS);
    //TODO: Filter Topics that are the same as that of the base document

    Collection<String> entityIds = new ArrayList<String>();
    for (BaseContent contentBean : relevantBeans.values()) {
        entityIds.add(ContentDictionary.makeKeyFromBean(contentBean));
    }

    TreeMultimap<BaseContent.ContentType, DocumentMeta> entityResult = dao.getEntityMeta(entityIds, _resultsType);
    Collection<DocumentMeta> result = new ArrayList<DocumentMeta>();
    for (BaseContent.ContentType contentType : entityResult.keySet()) {
        Collection<DocumentMeta> docMetas = new ArrayList<DocumentMeta>(entityResult.get(contentType));
        CollectionUtils.filterInverse(docMetas, new Predicate<DocumentMeta>() {
            @Override
            public boolean evaluate(DocumentMeta documentMeta) {
                return (documentMeta.getDocumentNumber() == _documentNumber);
            }
        });
        result.addAll(ResultsType.getResultsForCR(docMetas, _resultsType));
    }

    // Filter down the result (select randomly from the top results)
    result = ResultsType.getResultsForCR(result, ResultsType.RANDOM_10);
    result = ResultsType.getResultsForCR(result, _resultsType);

    Collection<DocumentBean> recommendedResults = new ArrayList<DocumentBean>();
    for (DocumentMeta docMeta : result) {
        recommendedResults.add(dao.getDocument(docMeta.getDocumentNumber()));
    }

    return new RecResponseBean(recommendedResults, "ContentBased");
}
 
開發者ID:balarj,項目名稱:rmend-be,代碼行數:48,代碼來源:ContentRecommender.java


注:本文中的com.google.common.collect.TreeMultimap.keySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。