当前位置: 首页>>代码示例>>Java>>正文


Java TreeMap.putAll方法代码示例

本文整理汇总了Java中java.util.TreeMap.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java TreeMap.putAll方法的具体用法?Java TreeMap.putAll怎么用?Java TreeMap.putAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.TreeMap的用法示例。


在下文中一共展示了TreeMap.putAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRemovedSymmetryGraph

import java.util.TreeMap; //导入方法依赖的package包/类
public TreeMap<T, LinkedList<Edge>> getRemovedSymmetryGraph() {
	if(graphType != GraphType.UNDIRECTED)
		return edgesByVertices;
	
	TreeMap<T, LinkedList<Edge>> edgesByVertexes_copy = new TreeMap<>();
	edgesByVertexes_copy.putAll(edgesByVertices);
	
	// 대칭 그래프 삭제
	for(LinkedList<Edge> edges1 : edgesByVertices.values()) {
		
		for(Edge edge1 : edges1) {
			
			LinkedList<Edge> edges2 = edgesByVertexes_copy.get(edge1.getToVertex());
			for(int i=0 ; i<edges2.size() ; i++) {
				
				Edge edge2 = edges2.get(i);
				if(edge2.getToVertex().equals(edge1.getFromVertex()))
					edges2.remove();
				
			}
		}
	}
	
	return edgesByVertexes_copy;
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:26,代码来源:AbstractGraph.java

示例2: printBrokerRuntimeStats

import java.util.TreeMap; //导入方法依赖的package包/类
public void printBrokerRuntimeStats(final DefaultMQAdminExt defaultMQAdminExt, final String brokerAddr,
    final boolean printBroker) throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException {
    KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

    // 为了排序
    TreeMap<String, String> tmp = new TreeMap<String, String>();
    tmp.putAll(kvTable.getTable());

    Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, String> next = it.next();
        if (printBroker) {
            System.out.printf("%-24s %-32s: %s%n", brokerAddr, next.getKey(), next.getValue());
        } else {
            System.out.printf("%-32s: %s%n", next.getKey(), next.getValue());
        }
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:19,代码来源:BrokerStatusSubCommand.java

示例3: printBrokerRuntimeStats

import java.util.TreeMap; //导入方法依赖的package包/类
public void printBrokerRuntimeStats(final DefaultMQAdminExt defaultMQAdminExt, final String brokerAddr,
    final boolean printBroker) throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException {
    KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

    TreeMap<String, String> tmp = new TreeMap<String, String>();
    tmp.putAll(kvTable.getTable());

    Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, String> next = it.next();
        if (printBroker) {
            System.out.printf("%-24s %-32s: %s%n", brokerAddr, next.getKey(), next.getValue());
        } else {
            System.out.printf("%-32s: %s%n", next.getKey(), next.getValue());
        }
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:18,代码来源:BrokerStatusSubCommand.java

示例4: getPlayerWorldObjectSubset

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * returns subset of BaseEffects (and their probabilities) in knowledge
 * referring to the same type of marioWorldObjects
 * 
 * @param playerWorldObject
 * @return
 */
public TreeMap<Effect, Double> getPlayerWorldObjectSubset(
		PlayerWorldObject playerWorldObject) {
	// iterate over all entries in knowledge
	TreeMap<Effect, Double> effectMap = new TreeMap<Effect, Double>();
	for (Entry<ConditionDirectionPair, TreeMap<Effect, Double>> entry : knowledge
			.entrySet()) {
		Condition currCond = entry.getKey().condition;
		PlayerWorldObject currObj = currCond.getTarget();
		// if the entry concerns the right MarioWorldObject, add all known
		// effect and probabilities to the map
		if (currObj == Generalizer.generalizePlayerWorldObject(playerWorldObject)) {
			effectMap.putAll(entry.getValue());
		}
	}
	return effectMap;
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:24,代码来源:Brain.java

示例5: buildResource

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * 将path、queryParam、formParam合成一个字符串
 *
 */
private static String buildResource(String pathWithParams, Map<String, String> queryParams, Map<String, String> formParams) {
    StringBuilder result = new StringBuilder();
    result.append(pathWithParams);

    //使用TreeMap,默认按照字母排序
    TreeMap<String, String> parameter = new TreeMap<String, String>();
    if (MapUtils.isNotEmpty(queryParams)) {
        parameter.putAll(queryParams);
    }
    if (MapUtils.isNotEmpty(formParams)) {
        parameter.putAll(formParams);
    }

    if (parameter.size() > 0) {
        result.append("?");

        // bugfix by [email protected]: "kv separator should be ignored while value is empty, ex. k1=v1&k2&k3=v3&k4"
        List<String> comboMap = new ArrayList<String>();
        for(Entry<String, String> entry : parameter.entrySet()){
            String comboResult = entry.getKey() + (StringUtils.isNotEmpty(entry.getValue())? "="+entry.getValue() : StringUtils.EMPTY);
            comboMap.add(comboResult);
        }
        Joiner joiner = Joiner.on("&");
        result.append(joiner.join(comboMap));
    }
    return result.toString();
}
 
开发者ID:aliyun,项目名称:apigateway-sdk-core,代码行数:32,代码来源:SignUtil.java

示例6: testPutAll

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * putAll adds all key-value pairs from the given map
 */
public void testPutAll() {
    TreeMap empty = new TreeMap();
    TreeMap map = map5();
    empty.putAll(map);
    assertEquals(5, empty.size());
    assertTrue(empty.containsKey(one));
    assertTrue(empty.containsKey(two));
    assertTrue(empty.containsKey(three));
    assertTrue(empty.containsKey(four));
    assertTrue(empty.containsKey(five));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:TreeMapTest.java

示例7: toString

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public String toString() {
    //order settings by key before printing them out, for readability
    TreeMap<String, ScriptMode> scriptModesTreeMap = new TreeMap<>();
    scriptModesTreeMap.putAll(scriptModes);
    StringBuilder stringBuilder = new StringBuilder();
    for (Map.Entry<String, ScriptMode> stringScriptModeEntry : scriptModesTreeMap.entrySet()) {
        stringBuilder.append(stringScriptModeEntry.getKey()).append(": ").append(stringScriptModeEntry.getValue()).append("\n");
    }
    return stringBuilder.toString();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:ScriptModes.java

示例8: getUserDefinedMap

import java.util.TreeMap; //导入方法依赖的package包/类
public Map<String, String> getUserDefinedMap() {
    TreeMap<String, String> result;
    synchronized (lock) {
        result = new TreeMap<>(map.comparator());
        result.putAll(map);
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:MacroMap.java

示例9: toMap

import java.util.TreeMap; //导入方法依赖的package包/类
public Map<String, String> toMap() {
    TreeMap<String, String> result;
    synchronized (lock) {
        result = new TreeMap<>(map.comparator());
        result.putAll(hostEnv);
        result.putAll(map);
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MacroMap.java

示例10: toString

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public String toString() {
    //order settings by key before printing them out, for readability
    TreeMap<String, Boolean> scriptModesTreeMap = new TreeMap<>();
    scriptModesTreeMap.putAll(scriptEnabled);
    StringBuilder stringBuilder = new StringBuilder();
    for (Map.Entry<String, Boolean> stringScriptModeEntry : scriptModesTreeMap.entrySet()) {
        stringBuilder.append(stringScriptModeEntry.getKey()).append(": ").append(stringScriptModeEntry.getValue()).append("\n");
    }
    return stringBuilder.toString();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:ScriptModes.java

示例11: execute

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);

    defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();

        String brokerAddr = commandLine.getOptionValue('b').trim();

        //获取broker一些全局统计信息 例如commitlog  全局offset等信息
        KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

        TreeMap<String, String> tmp = new TreeMap<String, String>();
        tmp.putAll(kvTable.getTable());

        Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
        while (it.hasNext()) {
            Entry<String, String> next = it.next();
            System.out.printf("%-32s: %s\n", next.getKey(), next.getValue());
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    finally {
        defaultMQAdminExt.shutdown();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:31,代码来源:BrokerStatusSubCommand.java

示例12: getPackages

import java.util.TreeMap; //导入方法依赖的package包/类
private Map<String, Integer> getPackages(Node n, String curPath, boolean dumpAllPackages) {
	TreeMap<String, Integer> res = new TreeMap<String, Integer>();
	
	if (n.hasClasses() || dumpAllPackages)
		res.put(curPath + n.name, n.clazzCount);

	if (!n.isLeaf()) {
		for (Node c: n.childs) {
			res.putAll(getPackages(c, curPath + (n.name.equals("Root")? "" : n.name + "."), dumpAllPackages));
		}
	}

	return res;
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:15,代码来源:PackageTree.java

示例13: populateTreeMap

import java.util.TreeMap; //导入方法依赖的package包/类
protected void populateTreeMap(final HierarchicalStreamReader reader, final UnmarshallingContext context,
        final TreeMap<?, ?> result, Comparator<?> comparator) {
    final boolean inFirstElement = comparator == NULL_MARKER;
    if (inFirstElement) {
        comparator = null;
    }
    @SuppressWarnings("unchecked")
    final SortedMap<Object, Object> sortedMap = new PresortedMap<Object, Object>(
        (Comparator<Object>)(comparator != null && JVM.hasOptimizedTreeMapPutAll() ? comparator : null));
    if (inFirstElement) {
        // we are already within the first entry
        putCurrentEntryIntoMap(reader, context, result, sortedMap);
        reader.moveUp();
    }
    populateMap(reader, context, result, sortedMap);
    @SuppressWarnings("unchecked")
    final TreeMap<Object, Object> typedResult = (TreeMap<Object, Object>)result;
    try {
        if (JVM.hasOptimizedTreeMapPutAll()) {
            if (comparator != null && comparatorField != null) {
                comparatorField.set(result, comparator);
            }
            typedResult.putAll(sortedMap); // internal optimization will not call comparator
        } else if (comparatorField != null) {
            comparatorField.set(result, sortedMap.comparator());
            typedResult.putAll(sortedMap); // "sort" by index
            comparatorField.set(result, comparator);
        } else {
            typedResult.putAll(sortedMap); // will use comparator for already sorted map
        }
    } catch (final IllegalAccessException e) {
        throw new ConversionException("Cannot set comparator of TreeMap", e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:TreeMapConverter.java

示例14: statisticsOriginal

import java.util.TreeMap; //导入方法依赖的package包/类
private static void statisticsOriginal(File inputFile, File outputFile, File outputFileChanges, File graphicsFolder) throws IOException, Exception {
	BufferedWriter bw=new BufferedWriter(new FileWriter(outputFile));
	bw.write("\t");
	bw.write("\t");
	bw.write(HitStatistic.getHeaderString());
	bw.write("\t\t");
	bw.write(HitStatistic.getHeaderString());
	bw.write("\tat least one hit");
	bw.newLine();

	TreeMap<String, MassBank> massbankFilesOriginal=Utils.getAllDBFiles(originalDBFolders, ser, false, false);

	TreeMap<String, Map<MassBank, HitDescription>> stats=new TreeMap<String, Map<MassBank, HitDescription>>();

	for (int i=0;i<querys.length;i++){
		TreeMap<String, Map<MassBank, HitDescription>> statsTmp=new TreeMap<String, Map<MassBank, HitDescription>>();
		TreeMap<String, HitStatistic> allHitstatistics=new TreeMap<String, HitStatistic>();
		TreeMap<String, HitStatistic> allHitstatisticsDifferentMassesExcluded=new TreeMap<String, HitStatistic>();

		String queryLong=querys[i];
		String decoy="Original";

		System.out.println("statisticsOriginal: "+queryLong+decoy);
		bw.write(queryLong+decoy);bw.newLine();			

		for(String searchMethod:searchMethodsStatisticsOriginal){				

			File hitstatistics = new File(inputFile.getAbsolutePath()+sep+searchMethod+sep+"HitStatistic_"+queryLong+decoy+".txt");
			File hitstatisticsDifferentMassesExcluded = new File(inputFile.getAbsolutePath()+sep+searchMethod+sep+"HitStatistic_DifferentMassesExcluded_"+queryLong+decoy+".txt");

			if(hitstatistics.exists()&&hitstatisticsDifferentMassesExcluded.exists()){
				HitStatistic hits=new HitStatistic(hitstatistics, massbankFilesOriginal);					
				bw.write(searchMethod+"\tall\t");
				bw.write(hits.toEntryString());
				Map<MassBank, HitDescription> stat=hits.getHitDescription();
				stats.put(queryLong+decoy+"-"+searchMethod, stat);
				allHitstatistics.put(queryLong+decoy+"-"+searchMethod, hits);

				hits=new HitStatistic(hitstatisticsDifferentMassesExcluded, massbankFilesOriginal);					
				bw.write("\tdifferent masses excluded:\t");
				bw.write(hits.toEntryString());
				bw.write("\t"+hits.getNumberEntriesWithAtLeastOneHit());
				stat=hits.getHitDescription();
				statsTmp.put(queryLong+decoy+"-"+searchMethod+"-SameMass", stat);
				allHitstatisticsDifferentMassesExcluded.put(queryLong+decoy+"-"+searchMethod+"-SameMass", hits);

				bw.newLine();
			}
			bw.flush();
		}
		HitStatistic.writeROCCurves(new File(graphicsFolder.getAbsolutePath()+sep+"ROCCurve_"+queryLong+decoy+".jpg"), allHitstatistics);
		HitStatistic.writeROCCurves(new File(graphicsFolder.getAbsolutePath()+sep+"ROCCurve_DifferentMassesExcluded_"+queryLong+decoy+".jpg"), allHitstatisticsDifferentMassesExcluded);
		stats.putAll(statsTmp);
	}
	bw.close();

	compareSearchMethods(outputFileChanges, stats);
}
 
开发者ID:boecker-lab,项目名称:passatuto,代码行数:59,代码来源:MainStatistics.java

示例15: statisticsHighFDR

import java.util.TreeMap; //导入方法依赖的package包/类
private static void statisticsHighFDR(File inputFile, File outputFile, File outputFileChanges, File graphicsFolder) throws IOException, Exception {
	BufferedWriter bw=new BufferedWriter(new FileWriter(outputFile));
	bw.write("\t\t");
	bw.write(HitStatistic.getHeaderString());
	bw.write("\tat least one hit");
	bw.newLine();

	TreeMap<String, MassBank> massbankFilesOriginal=Utils.getAllDBFiles(originalDBFolders, ser, false, false);

	TreeMap<String, Map<MassBank, HitDescription>> stats=new TreeMap<String, Map<MassBank, HitDescription>>();

	for (int i=0;i<querys.length;i++){
		TreeMap<String, Map<MassBank, HitDescription>> statsTmp=new TreeMap<String, Map<MassBank, HitDescription>>();			
		TreeMap<String, HitStatistic> allHitstatisticsDifferentMassesExcluded=new TreeMap<String, HitStatistic>();

		String queryLong=querys[i];
		String decoy="Original";

		System.out.println("statisticsOriginal: "+queryLong+decoy);
		bw.write(queryLong+decoy);bw.newLine();			

		for(String searchMethod:searchMethodsStatisticsOriginal){				

			File hitstatisticsDifferentMassesExcluded = new File(inputFile.getAbsolutePath()+sep+searchMethod+sep+"HitStatistic_DMEHighFDR_"+queryLong+decoy+".txt");

			if(hitstatisticsDifferentMassesExcluded.exists()){
				HitStatistic hits=new HitStatistic(hitstatisticsDifferentMassesExcluded, massbankFilesOriginal);					
				bw.write("searchMethod\tdifferent masses excluded:\t");
				bw.write(hits.toEntryString());
				bw.write("\t"+hits.getNumberEntriesWithAtLeastOneHit());
				Map<MassBank, HitDescription> stat=hits.getHitDescription();
				statsTmp.put(queryLong+decoy+"-"+searchMethod+"-SameMass", stat);
				allHitstatisticsDifferentMassesExcluded.put(queryLong+decoy+"-"+searchMethod+"-SameMass", hits);

				bw.newLine();
			}
			bw.flush();
		}
		HitStatistic.writeROCCurves(new File(graphicsFolder.getAbsolutePath()+sep+"ROCCurve_DMEHighFDR_"+queryLong+decoy+".jpg"), allHitstatisticsDifferentMassesExcluded);
		stats.putAll(statsTmp);
	}
	bw.close();

	compareSearchMethods(outputFileChanges, stats);
}
 
开发者ID:boecker-lab,项目名称:passatuto,代码行数:46,代码来源:MainStatistics.java


注:本文中的java.util.TreeMap.putAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。