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


Java TreeMap.get方法代碼示例

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


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

示例1: NtoNQueryParameter

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * コンストラクタ.
 * @param srcHandler OEntityDocHandler
 * @param targetSetName ターゲット側のEntitySet名
 * @param targetEntityTypeId ターゲット側のEntityTypeID
 */
public NtoNQueryParameter(
        final EntitySetDocHandler srcHandler,
        final String targetSetName,
        final String targetEntityTypeId) {
    String srcSetName = srcHandler.getType();
    String srcId = srcHandler.getId();

    TreeMap<String, String> tm = new TreeMap<String, String>();
    if (srcSetName.equals(UserDataODataProducer.USER_ODATA_NAMESPACE)) {
        tm.put(srcHandler.getEntityTypeId(), srcId);
        tm.put(targetEntityTypeId, "");
    } else {
        tm.put(srcSetName, srcId);
        tm.put(targetSetName, "");
    }
    this.t1 = tm.firstKey();
    this.t2 = tm.lastKey();
    this.k1 = tm.get(t1);
    this.k2 = tm.get(t2);
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:27,代碼來源:LinkDocHandler.java

示例2: getKClosestVectors

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Iterates along entries in distance map and fill the resulting k-element array.
 *
 * @param trainingData The training data.
 * @param distanceIdxPairs The distance map.
 * @param isCashedDistances Cache distances if true.
 * @return K-nearest neighbors.
 */
@NotNull private LabeledVector[] getKClosestVectors(LabeledVector[] trainingData,
    TreeMap<Double, Set<Integer>> distanceIdxPairs, boolean isCashedDistances) {
    LabeledVector[] res = new LabeledVector[k];
    int i = 0;
    final Iterator<Double> iter = distanceIdxPairs.keySet().iterator();
    while (i < k) {
        double key = iter.next();
        Set<Integer> idxs = distanceIdxPairs.get(key);
        for (Integer idx : idxs) {
            res[i] = trainingData[idx];
            if (isCashedDistances) {
                if (cachedDistances == null)
                    cachedDistances = new double[k];
                cachedDistances[i] = key;
            }
            i++;
            if (i >= k)
                break; // go to next while-loop iteration
        }
    }
    return res;
}
 
開發者ID:Luodian,項目名稱:Higher-Cloud-Computing-Project,代碼行數:31,代碼來源:KNNModel.java

示例3: selectLikelyEntry

import java.util.TreeMap; //導入方法依賴的package包/類
static <A> Entry<A, Double> selectLikelyEntry(TreeMap<A, Double> entries)
{
	ArrayList<A> keys = new ArrayList<A>(entries.keySet());
	
	Double value;
	A randomKey;
	
	do
	{			
		randomKey = keys.get(random.nextInt(keys.size()));
		value = entries.get(randomKey);
		
		//System.out.println("thinking to talk about " + randomKey + " + " + value + "("+keys.size()+" keys)");
	}
	while(value==null || (Math.random() > value.doubleValue()));
	
	return new SimpleEntry<A, Double>(randomKey, value);
}
 
開發者ID:CognitiveModeling,項目名稱:BrainControl,代碼行數:19,代碼來源:VoiceKnowledgeManager.java

示例4: insert

import java.util.TreeMap; //導入方法依賴的package包/類
public void insert(List<MDPoint> points) throws IOException {
  TreeMap<byte[], List<MDPoint>> map = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  for (MDPoint point : points) {
    byte[] row = MDUtils.bitwiseZip(point.values, dimensions);
    List<MDPoint> list = map.get(row);
    if (list == null) {
      list = new ArrayList<>();
      map.put(row, list);
    }
    list.add(point);
  }

  for (Map.Entry<byte[], List<MDPoint>> entry : map.entrySet()) {
    MDBucket bucket = index.fetchBucket(entry.getKey());
    bucket.insert(entry.getKey(), entry.getValue());
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:MDHBaseAdmin.java

示例5: inhibitEffectsBasedOnKnowledge

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Computes a measure for inhibition based on how much is known about a
 * ConditionDirectionPair.
 * 
 * @param knowledge
 * @param collision
 * @return inhibitionFactor
 */

public static double inhibitEffectsBasedOnKnowledge(
		TreeMap<ConditionDirectionPair, TreeMap<Effect, Double>> knowledge,
		ConditionDirectionPair collision) {
	final double inhibitAlsoUnknownEffects = 0.5;

	if (knowledge == null || !knowledge.containsKey(collision)) // nothing
																// is known
																// at all
		return inhibitAlsoUnknownEffects; // the collision may be undesired,
											// so we might want to inhibit
											// it.
	TreeMap<Effect, Double> effects = knowledge.get(collision);
	double inhibitionFactor = 0.0;
	for (Entry<Effect, Double> e : effects.entrySet()) {
		if (e.getKey().getType() != ActionEffect.NOTHING_HAPPENS)
			inhibitionFactor += e.getValue().doubleValue(); // always
															// inhibit
															// non-zero-effects
															// (the more is
															// known
															// about them
															// the more
															// inhibit,
															// therefore sum
															// up all
															// probabilities
															// in knowledge)
	}
	return inhibitionFactor; // never inhibit zero-effects (then 0.0 is
								// returned)
}
 
開發者ID:CognitiveModeling,項目名稱:BrainControl,代碼行數:41,代碼來源:GeneralUtil.java

示例6: getContactGroup

import java.util.TreeMap; //導入方法依賴的package包/類
public List<VirtualCategory<Contact>> getContactGroup(List<Contact> list) {
    List<VirtualCategory<Contact>> cates = new ArrayList<>();
    if (!IMUtils.isEmpty(list)) {
        List<Contact> unA = new ArrayList<>();
        TreeMap<String, List<Contact>> maps = new TreeMap<>();
        for (Contact c : list) {
            String py = c.getPYInitial();
            char A = IMUtils.isEmpty(py) ? '#' : py.charAt(0);
            if (A >= 'A' && A <= 'Z' || A >= 'a' && A <= 'z') {
                String a = String.valueOf(A).toUpperCase();
                List<Contact> values = maps.get(a);
                if (values == null) {
                    values = new ArrayList<>();
                    maps.put(a, values);
                }
                values.add(c);
            } else {
                unA.add(c);
            }
        }
        for (String n : maps.keySet()) {
            cates.add(new VirtualCategory<>(n, maps.get(n)));
        }
        if (!IMUtils.isEmpty(unA)) {
            cates.add(new VirtualCategory<>("#", unA));
        }
    }
    return cates;
}
 
開發者ID:Jamling,項目名稱:SmartQQ4IntelliJ,代碼行數:30,代碼來源:WXContactTreeNode.java

示例7: getToolOutput

import java.util.TreeMap; //導入方法依賴的package包/類
public SortedMap<String, ToolOutput> getToolOutput(List<String> names, IImageGalleryService imageGalleryService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> outputs = new TreeMap<String, ToolOutput>();
// tool output cache
TreeMap<String, ToolOutput> baseOutputs = new TreeMap<String, ToolOutput>();
if (names == null) {
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_IMAGES_UPLOADED,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_IMAGES_UPLOADED,
		    imageGalleryService, toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_COMMENTS,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_COMMENTS, imageGalleryService,
		    toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_VOTES,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_VOTES, imageGalleryService,
		    toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_UPLOADED_IMAGES_URLS,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_UPLOADED_IMAGES_URLS, imageGalleryService,
		    toolSessionId, learnerId));
} else {
    for (String name : names) {
	String[] nameParts = splitConditionName(name);
	if (baseOutputs.get(nameParts[0]) != null) {
	    outputs.put(name, baseOutputs.get(nameParts[0]));
	} else {
	    ToolOutput output = getToolOutput(name, imageGalleryService, toolSessionId, learnerId);
	    if (output != null) {
		outputs.put(name, output);
		baseOutputs.put(nameParts[0], output);
	    }
	}
    }
}

return outputs;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:37,代碼來源:ImageGalleryOutputFactory.java

示例8: writeSettings

import java.util.TreeMap; //導入方法依賴的package包/類
private static void writeSettings(XmlSerializer serializer, Map<String, Object> prefs) throws IOException {

        for (Entry<String, TreeMap<Integer, SettingsDescription>> versionedSetting :
                GlobalSettings.SETTINGS.entrySet()) {

            String key = versionedSetting.getKey();
            String valueString = (String) prefs.get(key);
            TreeMap<Integer, SettingsDescription> versions = versionedSetting.getValue();
            Integer highestVersion = versions.lastKey();
            SettingsDescription setting = versions.get(highestVersion);
            if (setting == null) {
                // Setting was removed.
                continue;
            }

            if (valueString != null) {
                try {
                    writeKeyAndPrettyValueFromSetting(serializer, key, setting, valueString);
                } catch (InvalidSettingValueException e) {
                    Timber.w("Global setting \"%s\" has invalid value \"%s\" in preference storage. " +
                            "This shouldn't happen!", key, valueString);
                }
            } else {
                Timber.d("Couldn't find key \"%s\" in preference storage. Using default value.", key);
                writeKeyAndDefaultValueFromSetting(serializer, key, setting);
            }
        }
    }
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:29,代碼來源:SettingsExporter.java

示例9: dependsOnTransitively

import java.util.TreeMap; //導入方法依賴的package包/類
private boolean dependsOnTransitively(String kit1, String kit2, 
    TreeMap<String, TreeSet<String>> dependingKits) {
    TreeSet<String> kits = dependingKits.get(kit1);
    if (kits == null) {
        return false;
    }
    return kits.contains(kit2);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ModuleDependencies.java

示例10: getFileUploadProcessors

import java.util.TreeMap; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected List<FileUploadProcessor> getFileUploadProcessors(String group) throws Exception {
  // 初始化業務分支
  if (initdTag.compareAndSet(false, true)) {
    TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> all =
        (TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>>) fileProcessFactory.getObject();
    //
    TreeMap<Integer, LinkedList<FileUploadProcessor>> pd = all.get(AbstractChannelProcessor.KEY);
    for (Entry<Integer, LinkedList<FileUploadProcessor>> orderProcessorEntry : pd.entrySet()) {
      publicChannel.addAll(orderProcessorEntry.getValue());
    }
    all.remove(AbstractChannelProcessor.KEY);//幹掉主分支
    // 遍曆其他的樹
    for (Entry<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> tree : all.entrySet()) {
      TreeMap<Integer, LinkedList<FileUploadProcessor>> thisTree = tree.getValue();
      LinkedList<FileUploadProcessor> thisTreeList = new LinkedList<FileUploadProcessor>();
      // 添加樹枝
      for (Entry<Integer, LinkedList<FileUploadProcessor>> branch : thisTree.entrySet()) {
        thisTreeList.addAll(branch.getValue());
      }
      for (int i = 0; i < thisTreeList.size()-1; i++) {
        ((AbstractChannelProcessor)thisTreeList.get(i)).nextProcessor = thisTreeList.get(i+1);
      }
      namedChannel.put(tree.getKey(), thisTreeList);
    }
  }
  //
  if (StringUtils.isBlank(group)) {
    return publicChannel;
  } else {
    LinkedList<FileUploadProcessor> ppl = namedChannel.get(group);
    return ppl == null ? new LinkedList<FileUploadProcessor>() : ppl;
  }
}
 
開發者ID:devpage,項目名稱:fastdfs-quickstart,代碼行數:35,代碼來源:GenericFileProcessor.java

示例11: getAvailableFontFamilyNames

import java.util.TreeMap; //導入方法依賴的package包/類
public String[] getAvailableFontFamilyNames(Locale requestedLocale) {
    FontManagerForSGE fm = getFontManagerForSGE();
    String[] installed = fm.getInstalledFontFamilyNames(requestedLocale);
    /* Use a new TreeMap as used in getInstalledFontFamilyNames
     * and insert all the keys in lower case, so that the sort order
     * is the same as the installed families. This preserves historical
     * behaviour and inserts new families in the right place.
     * It would have been marginally more efficient to directly obtain
     * the tree map and just insert new entries, but not so much as
     * to justify the extra internal interface.
     */
    TreeMap<String, String> map = fm.getCreatedFontFamilyNames();
    if (map == null || map.size() == 0) {
        return installed;
    } else {
        for (int i=0; i<installed.length; i++) {
            map.put(installed[i].toLowerCase(requestedLocale),
                    installed[i]);
        }
        String[] retval =  new String[map.size()];
        Object [] keyNames = map.keySet().toArray();
        for (int i=0; i < keyNames.length; i++) {
            retval[i] = (String)map.get(keyNames[i]);
        }
        return retval;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:28,代碼來源:SunGraphicsEnvironment.java

示例12: getToolOutput

import java.util.TreeMap; //導入方法依賴的package包/類
/**
    * Follows {@link PixlrService#getToolOutput(List, Long, Long)}.
    *
    */
   public SortedMap<String, ToolOutput> getToolOutput(List<String> names, IResourceService resourceService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> outputs = new TreeMap<String, ToolOutput>();
// tool output cache
TreeMap<String, ToolOutput> baseOutputs = new TreeMap<String, ToolOutput>();
if (names == null) {
    outputs.put(ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, getToolOutput(
	    ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, resourceService, toolSessionId, learnerId));
} else {
    for (String name : names) {
	String[] nameParts = splitConditionName(name);
	if (baseOutputs.get(nameParts[0]) != null) {
	    outputs.put(name, baseOutputs.get(nameParts[0]));
	} else {
	    ToolOutput output = getToolOutput(name, resourceService, toolSessionId, learnerId);
	    if (output != null) {
		outputs.put(name, output);
		baseOutputs.put(nameParts[0], output);
	    }
	}
    }
}

return outputs;

   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:ResourceOutputFactory.java

示例13: addStartEndKeysForTest

import java.util.TreeMap; //導入方法依賴的package包/類
private void addStartEndKeysForTest(TreeMap<byte[], Integer> map, byte[] first, byte[] last) {
  Integer value = map.containsKey(first)?map.get(first):0;
  map.put(first, value+1);

  value = map.containsKey(last)?map.get(last):0;
  map.put(last, value-1);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:8,代碼來源:TestLoadIncrementalHFiles.java

示例14: load

import java.util.TreeMap; //導入方法依賴的package包/類
static boolean load()
    {
        trie = new DoubleArrayTrie<Boolean>();
        if (loadDat()) return true;
        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
            String line;
            TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
            TreeMap<Character, Integer> charFrequencyMap = new TreeMap<Character, Integer>();
            while ((line = br.readLine()) != null)
            {
                map.put(line, true);
                // 音譯人名常用字詞典自動生成
                for (char c : line.toCharArray())
                {
                    // 排除一些過於常用的字
                    if ("不讚".indexOf(c) >= 0) continue;
                    Integer f = charFrequencyMap.get(c);
                    if (f == null) f = 0;
                    charFrequencyMap.put(c, f + 1);
                }
            }
            br.close();
            map.put(String.valueOf('·'), true);
//            map.put(String.valueOf('-'), true);
//            map.put(String.valueOf('—'), true);
            // 將常用字也加進去
            for (Map.Entry<Character, Integer> entry : charFrequencyMap.entrySet())
            {
                if (entry.getValue() < 10) continue;
                map.put(String.valueOf(entry.getKey()), true);
            }
            logger.info("音譯人名詞典" + path + "開始構建雙數組……");
            trie.build(map);
            logger.info("音譯人名詞典" + path + "開始編譯DAT文件……");
            logger.info("音譯人名詞典" + path + "編譯結果:" + saveDat(map));
        }
        catch (Exception e)
        {
            logger.severe("自定義詞典" + path + "讀取錯誤!" + e);
            return false;
        }

        return true;
    }
 
開發者ID:priester,項目名稱:hanlpStudy,代碼行數:47,代碼來源:TranslatedPersonDictionary.java

示例15: getServiceToArtifactMap

import java.util.TreeMap; //導入方法依賴的package包/類
public TreeMap<String, HashSet<String>> getServiceToArtifactMap ( ReleasePackage model ) {

		if ( getHostStatusManager() == null ) {
			return null;
		}

		ArrayList<String> lifeCycleHostList = model
			.getLifeCycleToHostMap()
			.get(
				getCurrentLifeCycle() );

		TreeMap<String, HashSet<String>> working_serviceToVersionMap = new TreeMap<String, HashSet<String>>();

		try {
			for ( String host : lifeCycleHostList ) {
				ObjectNode hostRuntime = getHostStatusManager().getResponseFromHost( host );
				if ( hostRuntime != null ) {

					Iterator<String> serviceIter = hostRuntime
						.path( "services" )
						.fieldNames();

					while (serviceIter.hasNext()) {
						String service_port = serviceIter.next();

						String serviceName = hostRuntime
							.path( "services" )
							.path( service_port )
							.path( "serviceName" )
							.asText();

						String artifacts = hostRuntime
							.path( "services" )
							.path( service_port )
							.path( "deployedArtifacts" )
							.asText();

						if ( artifacts.contains( "##" ) ) {
							artifacts = artifacts.substring( artifacts.indexOf( "##" ) + 2 );
						}

						if ( !working_serviceToVersionMap.containsKey( serviceName ) ) {
							working_serviceToVersionMap.put( serviceName, new HashSet<String>() );
						}

						HashSet<String> versionList = working_serviceToVersionMap.get( serviceName );

						if ( artifacts
							.trim()
							.length() != 0 ) {
							versionList.add( artifacts.trim() );
						}
					}
				}
			}
		} catch (Exception e) {
			logger.error( "Failed parsing runtime", e );
		}

		serviceToArtifactMap = working_serviceToVersionMap;

		return serviceToArtifactMap;
	}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:64,代碼來源:Application.java


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