List of usage examples for java.util TreeMap TreeMap
public TreeMap()
From source file:dictionary.GeneralDictionary.java
/** Creates a new instance of GeneralDictionary */ public GeneralDictionary() { map = new TreeMap<String, String>(); map.put("book", "a set of written or printed pages, usually bound with " + "a protective cover"); map.put("editor", "a person who edits"); }
From source file:com.artemisa.service.TipoProductoServiceImpl.java
@Override public TipoProducto update(com.artemisa.domain.TipoProducto entity) throws EntityExistsException, HibernateException { Map<String, String> conditions = new TreeMap<>(); conditions.put("", "nombre = '" + entity.getNombre() + "'"); conditions.put("and", "id != " + entity.getId()); List<com.artemisa.domain.TipoProducto> foundTipoProductos = this.service.find(conditions); if (foundTipoProductos == null) { TipoProducto m = this.service.update(entity); return m; } else {// ww w .j a v a 2 s . co m throw new com.artemisa.service.exceptions.EntityExistsException( "El tipo producto con el nombre " + entity.getNombre() + " ya existe!"); } }
From source file:tpt.dbweb.cat.evaluation.ComparisonResult.java
/** * Combines the results contained in this object. Result is also a ComparisonResult instance, with virtual documents "macro" and "micro". * Only works if it contains ValueEvaluationStatistics results * @return//from www . j a v a2s.co m */ public ComparisonResult combine() { ComparisonResult result = new ComparisonResult(); for (String docId : docidToMetricToResult.keySet()) { Map<String, EvaluationStatistics> metricToResult = docidToMetricToResult.get(docId); for (String metric : docidToMetricToResult.get(docId).keySet()) { EvaluationStatistics stat = metricToResult.get(metric); // macro EvaluationStatistics macro = result.docidToMetricToResult .computeIfAbsent("macro", k -> new TreeMap<>()) .computeIfAbsent(metric, k -> new ValueEvaluationStatistics()); macro.addMacro(stat); EvaluationStatistics micro = result.docidToMetricToResult .computeIfAbsent("micro", k -> new TreeMap<>()) .computeIfAbsent(metric, k -> new ValueEvaluationStatistics()); micro.addMicro(stat); } } return result; }
From source file:com.itemanalysis.psychometrics.scaling.ScoreTable.java
public ScoreTable(ScoreBounds sumScoreBounds, Double by, String name, int precision) { this.sumScoreBounds = sumScoreBounds; this.by = by; this.name = name; this.precision = precision; table = new TreeMap<Double, Double>(); }
From source file:de.rahn.finances.commons.metrics.MetricsExporterServiceTest.java
private <V> SortedMap<String, V> singletonMap(String name, V value) { TreeMap<String, V> map = new TreeMap<>(); map.put(name, value);/* w w w . jav a2s.c om*/ return map; }
From source file:web.diva.server.unused.PCAGenerator.java
/** * * * @return dataset.//from www . j a va 2 s . c om */ private XYDataset createDataset(TreeMap<Integer, PCAPoint> points, int[] subSelectionData, int[] selection, boolean zoom, DivaDataset divaDataset) { final XYSeriesCollection dataset = new XYSeriesCollection(); seriesList = new TreeMap<String, XYSeries>(); seriesList.put("#000000", new XYSeries("#000000")); seriesList.put("unGrouped", new XYSeries("LIGHT_GRAY")); for (Group g : divaDataset.getRowGroups()) { if (g.isActive() && !g.getName().equalsIgnoreCase("all")) { seriesList.put(g.getHashColor(), new XYSeries(g.getHashColor())); } } if (!zoom && (selection == null || selection.length == 0) && subSelectionData == null) { for (int key : points.keySet()) { PCAPoint point = points.get(key); if (seriesList.containsKey(point.getColor())) { // seriesList.get(divaDataset.getGeneColorArr()[point.getGeneIndex()]).add(point.getX(), point.getY()); } else { seriesList.get("unGrouped").add(point.getX(), point.getY()); } } } else if (zoom) { selectionSet.clear(); for (int i : selection) { selectionSet.add(i); } for (int x : subSelectionData) { PCAPoint point = points.get(x); if (selectionSet.contains(point.getGeneIndex())) { if (seriesList.containsKey(point.getColor())) { // seriesList.get(divaDataset.getGeneColorArr()[point.getGeneIndex()]).add(point.getX(), point.getY()); } else { seriesList.get("#000000").add(point.getX(), point.getY()); } } else { seriesList.get("unGrouped").add(point.getX(), point.getY()); } } } else if (subSelectionData != null) { selectionSet.clear(); for (int i : selection) { selectionSet.add(i); } // for (int key : subSelectionData) { // PCAPoint point = points.get(key); // if (selectionSet.contains(point.getGeneIndex())) { // if (seriesList.containsKey(divaDataset.getGeneColorArr()[point.getGeneIndex()])) { // seriesList.get(divaDataset.getGeneColorArr()[point.getGeneIndex()]).add(point.getX(), point.getY()); // // } else { // // seriesList.get("#000000").add(point.getX(), point.getY()); // } // // } else { // // seriesList.get("unGrouped").add(point.getX(), point.getY()); // } // // } } else //selection without zoom { selectionSet.clear(); for (int i : selection) { selectionSet.add(i); } // for (int key : points.keySet()) { // PCAPoint point = points.get(key); // // if (selectionSet.contains(point.getGeneIndex())) { // if (seriesList.containsKey(divaDataset.getGeneColorArr()[point.getGeneIndex()])) { // seriesList.get(divaDataset.getGeneColorArr()[point.getGeneIndex()]).add(point.getX(), point.getY()); // // } else { // // seriesList.get("#000000").add(point.getX(), point.getY()); // } // // } else { // // seriesList.get("unGrouped").add(point.getX(), point.getY()); // } // // } } for (XYSeries ser : seriesList.values()) { dataset.addSeries(ser); } return dataset; }
From source file:com.yahoo.pulsar.discovery.service.server.DiscoveryServiceStarter.java
protected static void startWebService(ServerManager server, ServiceConfig config) throws Exception { // add servlet Map<String, String> initParameters = new TreeMap<>(); initParameters.put("zookeeperServers", config.getZookeeperServers()); server.addServlet("/*", DiscoveryServiceServlet.class, initParameters); // start web-service server.start();/* w w w . j a va2s . com*/ log.info("Discovery service is started at {}", server.getServiceUri().toString()); }
From source file:dictionary.ExtendedDictionary.java
/** * Creates a new instance of ExtendedDictionary *///from w w w . j a v a 2 s . c o m public ExtendedDictionary() { map = new TreeMap<String, String>(); map.put("xml", "a document standard often used in web services, among other " + "things"); map.put("REST", "an architecture style for creating, reading, updating, " + "and deleting data that attempts to use the common " + "vocabulary of the HTTP protocol; Representational State " + "Transfer"); }
From source file:org.ventiv.webjars.requirejs.config.RequireJsConfigBuilder.java
public Map<String, Object> buildConfig() { Map<String, String> webJars = locator.getWebJars(); Map<String, String> paths = new TreeMap<String, String>(); Map<String, Object> requireJsConfig = new LinkedHashMap<>(); requireJsConfig.put("paths", paths); for (Map.Entry<String, String> webJar : webJars.entrySet()) { Map<String, Object> webJarRequireJsConfig = getWebJarRequireJsConfig(webJar); if (webJarRequireJsConfig != null) { buildPathForJar(webJar.getKey(), webJar.getValue(), webJarRequireJsConfig, paths); buildOthersForJar(webJar.getKey(), webJar.getValue(), webJarRequireJsConfig, requireJsConfig); }/*from w w w. j av a 2 s . com*/ } // Add to any dependencies if (env != null) { Map<String, Object> shim = (Map<String, Object>) requireJsConfig.get("shim"); for (Map.Entry<String, Object> shimEntry : shim.entrySet()) { List newDependencies = env.getProperty("webjars.requirejs.dependencies." + shimEntry.getKey(), List.class); if (newDependencies != null && !newDependencies.isEmpty()) { if (shimEntry.getValue() == null) shimEntry.setValue(new ArrayList<String>()); if (shimEntry.getValue() instanceof Collection) ((Collection) shimEntry.getValue()).addAll(newDependencies); } } } // Add any paths / dependencies that are in the environment that are not in our config already if (env != null) { List<String> newModules = env.getProperty("webjars.requirejs.newModules", List.class); for (String module : newModules) { paths.put(module, env.getProperty("webjars.requirejs.paths." + module)); List<String> dependencies = env.getProperty("webjars.requirejs.dependencies." + module, List.class); if (dependencies != null && !dependencies.isEmpty()) ((Map<String, Object>) requireJsConfig.get("shim")).put(module, dependencies); } } return requireJsConfig; }
From source file:com.artemisa.service.PresentacionServiceImpl.java
@Override public Presentacion update(com.artemisa.domain.Presentacion entity) throws EntityExistsException, HibernateException { Map<String, String> conditions = new TreeMap<>(); conditions.put("", "descripcion= '" + entity.getDescripcion() + "'"); conditions.put("and", "id != " + entity.getId()); List<com.artemisa.domain.Presentacion> foundPresentacions = this.service.find(conditions); if (foundPresentacions == null) { Presentacion m = this.service.update(entity); return m; } else {//from ww w . ja va 2 s . co m throw new com.artemisa.service.exceptions.EntityExistsException( "La presentacin con la descripcin " + entity.getDescripcion() + " ya existe!"); } }