List of usage examples for java.util TreeMap TreeMap
public TreeMap()
From source file:freemarker.ext.dump.DumpAllDirective.java
SortedMap<String, Object> getDataModelDump(Environment env) throws TemplateModelException { SortedMap<String, Object> dump = new TreeMap<String, Object>(); TemplateHashModel dataModel = env.getDataModel(); // Need to unwrap in order to iterate through the variables @SuppressWarnings("unchecked") Map<String, Object> unwrappedDataModel = (Map<String, Object>) DeepUnwrap.permissiveUnwrap(dataModel); List<String> varNames = new ArrayList<String>(unwrappedDataModel.keySet()); for (String varName : varNames) { dump.putAll(getTemplateVariableDump(varName, dataModel.get(varName))); }//from ww w . j av a2s . co m return dump; }
From source file:org.catrobat.catroid.HomeController.java
private Map<String, String> createrHeaderMap(XmlHeader header) { Map<String, String> headerMap = new TreeMap<String, String>(); headerMap.put("programName", header.getProgramName()); headerMap.put("description", header.getDescription()); headerMap.put("screenWidth", (new Integer(header.getVirtualScreenWidth())).toString()); headerMap.put("screenHeight", (new Integer(header.getVirtualScreenHeight())).toString()); headerMap.put("catrobatLanguageVersion", (new Double(header.getCatrobatLanguageVersion())).toString()); headerMap.put("applicationBuildName", header.getApplicationBuildName()); headerMap.put("applicationBuildNumber", (new Integer(header.getApplicationBuildNumber())).toString()); headerMap.put("applicationName", header.getApplicationName()); headerMap.put("applicationVersion", header.getApplicationVersion()); headerMap.put("dateTimeUpload", header.getDateTimeUpload()); headerMap.put("deviceName", header.getDeviceName()); headerMap.put("mediaLicense", header.getMediaLicense()); headerMap.put("platform", header.getPlatform()); headerMap.put("platformVersion", (new Integer(header.getPlatformVersion())).toString()); headerMap.put("programLicense", header.getProgramLicense()); headerMap.put("remixOf", header.getRemixOf()); headerMap.put("tags", header.getTags()); headerMap.put("url", header.getUrl()); headerMap.put("userHandle", header.getUserHandle()); List<String> emptyValues = new ArrayList<String>(); for (String item : headerMap.keySet()) if (headerMap.get(item) == null || headerMap.get(item) == "") { emptyValues.add(item);/*from w w w . j a va 2s .c o m*/ } for (String item : emptyValues) headerMap.remove(item); return headerMap; }
From source file:com.ea.core.base.dto.DynamicDTO.java
public DynamicDTO(Map<String, Object> map) { generator = new BeanGenerator(); /*Kryo?Map?HashMap?NullPointExceptionTreeMap*/ /*?DynamicDTO?MapTreeMap*/ valueMap = new TreeMap<String, Object>(); Iterator<String> keys = map.keySet().iterator(); String key = null;/*from w ww . ja v a 2 s . co m*/ while (keys.hasNext()) { key = keys.next(); this.setValue(key, map.get(key)); } try { generateBean(); } catch (Exception e) { throw new RuntimeException("?Bean?"); } }
From source file:boa.aggregators.ConfidenceIntervalAggregator.java
/** {@inheritDoc} */ @Override//www. ja v a2 s .c o m public void start(final EmitKey key) { super.start(key); map = new TreeMap<Long, Long>(); }
From source file:de.vandermeer.skb.mvn.pm.model.PM_Model.java
/** * Creates a new project model, programmatic access to all managed projects. * @param mc model context//from w w w . j a va 2 s. c o m * @throws NullPointerException if argument was null */ public PM_Model(PM_Context mc) { Validate.notNull(mc); this.mc = mc; this.projects = new TreeMap<>(); }
From source file:de.vandermeer.skb.mvn.pm.model.PM_Context.java
/** * Creates a new project model context./* ww w.ja v a 2 s .c o m*/ * @param projectPmDir the standard project configuration directory * @throws NullPointerException if argument was null * @throws IllegalArgumentException if argument was blank */ public PM_Context(String projectPmDir) { Validate.notBlank(projectPmDir, "mc: standard project PM directory names as null"); this.projectPmDir = projectPmDir; this.buildVersions = new TreeMap<>(); }
From source file:com.artemisa.service.ProveedorServiceImpl.java
@Override public Proveedor update(com.artemisa.domain.Proveedor 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.Proveedor> foundProveedors = this.service.find(conditions); if (foundProveedors == null) { Proveedor m = this.service.update(entity); return m; } else {//from w ww . j a va2s. c o m throw new com.artemisa.service.exceptions.EntityExistsException( "El proveedor con el nombre " + entity.getNombre() + " ya existe!"); } }
From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.evaluation.F1ScoreTableAggregator.java
public static void evaluatePredictionsFoldersDomain(File masterFolder, String folderContains) throws Exception { SortedMap<String, SortedMap<String, 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(folderContains)) { File resultSummary = new File(folderData.getValue(), "resultSummary.txt"); List<String> values = extractValues(resultSummary); String macroF1 = values.get(0); if (!featureSetsResults.containsKey(featureSet)) { featureSetsResults.put(featureSet, new TreeMap<String, String>()); }/*from www . java 2s. c om*/ String domainName = data.split("_")[2]; featureSetsResults.get(featureSet).put(domainName, macroF1); } } } } // print results int rows = featureSetsResults.values().iterator().next().size(); System.out.printf("\t"); for (String featureSet : featureSetsResults.keySet()) { System.out.printf("%s\t", featureSet); } System.out.println(); for (int i = 0; i < rows; i++) { // Set<String> keySet = featureSetsResults.values().iterator().next().keySet(); SortedMap<String, String> firstColumn = featureSetsResults.values().iterator().next(); List<String> keys = new ArrayList<>(firstColumn.keySet()); System.out.printf("%s\t", keys.get(i)); for (SortedMap<String, String> values : featureSetsResults.values()) { System.out.printf("%s\t", values.get(keys.get(i))); } System.out.println(); } }
From source file:ca.travelagency.salesstats.PaymentDistribution.java
public List<InvoicePaymentDistribution> getDistributions() { Map<PaymentType, InvoicePaymentDistribution> distributions = new TreeMap<PaymentType, InvoicePaymentDistribution>(); for (InvoicePayment invoicePayment : getInvoicePayments()) { InvoicePaymentDistribution value = distributions.get(invoicePayment.getPaymentType()); if (value == null) { value = InvoicePaymentDistribution.make(invoicePayment.getPaymentType()); }/*from w w w . j a v a 2 s . c o m*/ value.add(invoicePayment); distributions.put(value.getPaymentType(), value); } List<InvoicePaymentDistribution> results = Lists.newArrayList(distributions.values()); Collections.sort(results); return results; }
From source file:com.boxedfolder.carrot.web.client.AnalyticsResource.java
@ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/count", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Map<String, String> countEntities() { Map<String, String> output = new TreeMap<>(); output.put("beacons", Long.toString(service.countBeacons())); output.put("apps", Long.toString(service.countApps())); output.put("events", Long.toString(service.countEvents())); return output; }