List of usage examples for java.util SortedMap keySet
Set<K> keySet();
From source file:org.opennms.ng.dao.support.FilterResourceWalker.java
/** * <p>walk</p>/*from w w w .jav a 2 s . co m*/ */ public void walk() { EntityVisitor visitor = new AbstractEntityVisitor() { @Override public void visitNode(OnmsNode node) { walk(node); } }; SortedMap<Integer, String> map = getFilterDao().getNodeMap(m_filter); for (final Integer nodeId : map.keySet()) { final OnmsNode node = getNodeDao().load(nodeId); visitor.visitNode(node); } }
From source file:com.github.lukaszbudnik.dqueue.OrderedQueueClientIntegrationTest.java
@After public void after() throws Exception { session.execute("drop keyspace " + cassandraKeyspace); SortedMap<String, Timer> timers = metricRegistry.getTimers(); timers.keySet().stream().forEach(k -> { Timer t = timers.get(k);/*from ww w .ja va 2 s . c o m*/ System.out.println(k); System.out.println("\ttimes called ==> " + t.getCount()); System.out.println("\tmedian ==> " + t.getSnapshot().getMedian() / 1000 / 1000); System.out.println("\t75th percentile ==> " + t.getSnapshot().get75thPercentile() / 1000 / 1000); System.out.println("\t99th percentile ==> " + t.getSnapshot().get99thPercentile() / 1000 / 1000); }); SortedMap<String, HealthCheck.Result> healthChecks = healthCheckRegistry.runHealthChecks(); healthChecks.keySet().stream().forEach(k -> { HealthCheck.Result healthCheck = healthChecks.get(k); System.out.println(k + " healthy? ==> " + healthCheck.isHealthy()); }); queueClient.close(); }
From source file:org.motrice.jmx.BasicAppManagement.java
/** * Get the log level of a named logger.//from ww w. j a v a 2 s . com * The first logger ending with the name is chosen. */ @ManagedOperation(description = "Get the log level of a specific logger", currencyTimeLimit = 10) @ManagedOperationParameters({ @ManagedOperationParameter(name = "logger", description = "(Last part of) logger name") }) public String getLogLevel(String logger) { // Note that getLogger returns a new logger if the name is undefined SortedMap<String, Logger> map = doGetLoggers(); String level = "*Unknown*"; if (notBlank(logger)) { for (String key : map.keySet()) { if (key.endsWith(logger.trim())) { Logger log = map.get(key); if (log != null) level = log.getLevel().toString(); } } } return level; }
From source file:org.libreplan.web.common.components.finders.ResourceMultipleFiltersFinderByResourceAndCriterion.java
private List<FilterPair> fillWithFirstTenFiltersCriterions() { SortedMap<CriterionType, List<Criterion>> mapCriterions = getMapCriterions(); Iterator<CriterionType> iteratorCriterionType = mapCriterions.keySet().iterator(); while (iteratorCriterionType.hasNext() && getListMatching().size() < 10) { CriterionType type = iteratorCriterionType.next(); for (int i = 0; getListMatching().size() < 10 && i < mapCriterions.get(type).size(); i++) { Criterion criterion = mapCriterions.get(type).get(i); addCriterion(type, criterion); }// w ww. j a v a 2 s. com } return getListMatching(); }
From source file:org.squale.squaleweb.util.graph.KiviatMaker.java
/** * Ajoute les d'un composant. <br /> * <b>Attention : </b> pour assurer la cohrences des donnes, si cette mthode est appelle plusieurs fois, pValues * doit avoir chaque fois la meme taille et les mme cls. * /*from w ww . ja v a 2 s . c o m*/ * @param pName nom associ la future courbe. * @param pValues SortedMap contenant en cl (tri!) des facteurs sous forme de String et en valeur des nombres * (Double). * @param pRequest pour avoir le nom des facteurs internationaliss */ public void addValues(String pName, SortedMap pValues, HttpServletRequest pRequest) { Set keys = pValues.keySet(); // Ajoute les donnes Iterator it = keys.iterator(); // Pour chaque axe, on cre l'axe avec son titre et on ajoute les valeurs while (it.hasNext()) { // Internationalisation du nom // On a besoin d'un tokenizer pour ne pas prendre en compte la partie entre () String key = (String) it.next(); StringTokenizer st = new StringTokenizer(key, "("); String axis = WebMessages.getString(pRequest, ("factor.internationalise.name." + st.nextToken()).trim()); // le facteur peut ne pas avoir de note, dans ce cas il n'y a plus de tokens // le premier token contient tout if (st.hasMoreTokens()) { axis += "(" + st.nextToken(); } mDataset.addValue(1.0D, "1.0", axis); mDataset.addValue(2.0D, "2.0", axis); final double thirdValue = 3.0D; mDataset.addValue(thirdValue, "3.0", axis); Number number = ((Number) pValues.get(key)); if (number != null && number.doubleValue() >= 0.0) { mDataset.addValue(number.doubleValue(), pName, axis); } } }
From source file:com.citic.zxyjs.zwlscx.mapreduce.join.api.DataJoinReducerBase.java
@SuppressWarnings("unchecked") protected void reduce(Text key, Iterable<TaggedMapOutput> values, Context context) throws IOException, InterruptedException { SortedMap<Text, ResetableIterator<TaggedMapOutput>> groups = regroup(key, values.iterator(), context); Text[] tags = groups.keySet().toArray(new Text[0]); ResetableIterator<TaggedMapOutput>[] groupValues = new ResetableIterator[tags.length]; for (int i = 0; i < tags.length; i++) { groupValues[i] = groups.get(tags[i]); }//from w w w.ja va 2 s . c o m joinAndCollect(tags, groupValues, key, context); for (int i = 0; i < tags.length; i++) { groupValues[i].close(); } }
From source file:net.ontopia.topicmaps.impl.basic.index.OccurrenceIndex.java
/** * INTERNAL: utility method used to extract all keys from the sorted * map that matches the prefix and aggregate all values stores as * entry values.//w ww .j a va 2 s .c o m */ private <E> Collection<E> extractPrefixValues(CollectionSortedMap<String, E> map, String prefix) { Collection<E> result = null; SortedMap<String, Collection<E>> tail = map.tailMap(prefix); Iterator<String> iter = tail.keySet().iterator(); while (iter.hasNext()) { String key = iter.next(); if (key == null || !key.startsWith(prefix)) { break; } // add values to result if (result == null) result = new HashSet<E>(); Collection<E> c = map.get(key); result.addAll(c); } return (result == null ? new HashSet<E>() : result); }
From source file:org.libreplan.web.common.components.finders.OrderElementsMultipleFiltersFinder.java
private List<FilterPair> fillWithFirstTenFiltersCriterions() { SortedMap<CriterionType, List<Criterion>> mapCriterions = getMapCriterions(); Iterator<CriterionType> iteratorCriterionType = mapCriterions.keySet().iterator(); while (iteratorCriterionType.hasNext() && getListMatching().size() < 10) { CriterionType type = iteratorCriterionType.next(); for (int i = 0; getListMatching().size() < 10 && i < mapCriterions.get(type).size(); i++) { Criterion criterion = mapCriterions.get(type).get(i); addCriterion(type, criterion); }// w w w. j a v a 2 s. c o m } return getListMatching(); }
From source file:fr.gael.dhus.util.functional.collect.SortedMapTest.java
/** Constructor: Empty map param. */ @Test/* www .j a va 2 s. co m*/ public void emptyMapTest() { SortedMap sorted_map = new SortedMap(Collections.emptyMap(), cmp); Assert.assertTrue(sorted_map.isEmpty()); Assert.assertEquals(sorted_map.size(), 0); Assert.assertFalse(sorted_map.keySet().iterator().hasNext()); Assert.assertFalse(sorted_map.values().iterator().hasNext()); Assert.assertFalse(sorted_map.entrySet().iterator().hasNext()); }
From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.evaluation.F1ScoreTableAggregator.java
public static void evaluatePredictionsFoldersFullCV(File masterFolder) throws Exception { SortedMap<String, List<String>> featureSetsResults = new TreeMap<>(); File[] foldersFeatureSets = masterFolder.listFiles(EvalHelper.DIRECTORY_FILTER); for (File folderFeatureSet : foldersFeatureSets) { String[] split = folderFeatureSet.getName().split("_"); String featureSet = split[0]; String paramE = split[1]; String paramT = split[2]; if ("e0".equals(paramE) && "t1".equals(paramT)) { Map<String, File> foldersData = EvalHelper.listSubFoldersAndRemoveUUID(folderFeatureSet); for (Map.Entry<String, File> folderData : foldersData.entrySet()) { String data = folderData.getKey(); if (data.contains("ArgumentSequenceLabelingCV")) { File resultSummary = new File(folderData.getValue(), "resultSummary.txt"); List<String> values = extractValues(resultSummary); featureSetsResults.put(featureSet, values); }// w w w. j av a2 s. c o m } } } // print results int rows = featureSetsResults.values().iterator().next().size(); for (String featureSet : featureSetsResults.keySet()) { System.out.printf("%s\t", featureSet); } System.out.println(); for (int i = 0; i < rows; i++) { for (List<String> result : featureSetsResults.values()) { System.out.printf("%s\t", result.get(i)); } System.out.println(); } }