List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:hydrograph.ui.propertywindow.propertydialog.PropertyDialog.java
private void savePropertiesInComponentModel(AbstractWidget eltWidget, LinkedHashMap<String, Object> properties) { LinkedHashMap<String, Object> tempPropert = properties; LinkedHashMap<String, Object> componentConfigurationProperties = componentProperties .getComponentConfigurationProperties(); for (String propName : tempPropert.keySet()) { componentConfigurationProperties.put(propName, tempPropert.get(propName)); }/*from w ww . jav a 2 s. c om*/ }
From source file:com.swetha.easypark.GetIndividualParkingSpotDetails.java
public void updateListView(ArrayList<LinkedHashMap<String, String>> parkingSpotMapList, int success) { if (success == 1) { mSelectedItem = 0;// ww w . j ava 2 s . co m for (int i = 0; i < parkingSpotMapList.size(); i++) { Log.i("GetIndividualParkingSpotDetails", "Inside For loop"); RadioButtonTracker l_ts; LinkedHashMap<String, String> map = parkingSpotMapList.get(i); Log.i("GetIndividualParkingSpotDetails", "Value in map is " + map.get("vacantspotdisplay")); Log.i("GetIndividualParkingSpotDetails", "parking spoid is is " + map.get("parkingspotid")); if (i == mSelectedItem) { Log.i("GetIndividualParkingSpotDetails", "Before calling RadioButtonTracker constructor - if"); l_ts = new RadioButtonTracker(map, true); Log.i("GetIndividualParkingSpotDetails", "After calling RadioButtonTracker constructor-if"); } else { l_ts = new RadioButtonTracker(map, false); } mSelectionList.add(l_ts); } Log.i("GetIndividualParkingSpotDetails", "After -if-else condition"); adapter = new RadioButtonTrackerListAdapter(mContext); adapter.setListItems(mSelectionList); Log.i("GetIndividualParkingSpotDetails", "After setListItems"); this.setListAdapter(adapter); Log.i("GetIndividualParkingSpotDetails", "After setListAdapter"); } else { AlertDialog alertDialog = new AlertDialog.Builder(GetIndividualParkingSpotDetails.this).create(); // Setting Dialog Title alertDialog.setTitle("Sorry!"); // Setting Dialog Message alertDialog.setMessage("No Parking spots found"); // Setting Icon to Dialog // alertDialog.setIcon(R.drawable.tick); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to execute after dialog closed Intent intent = new Intent(GetIndividualParkingSpotDetails.this, GetParkingLots.class); startActivity(intent); } }); // Showing Alert Message alertDialog.show(); } }
From source file:com.genentech.application.property.TPSA.java
private void runTest(boolean countP, boolean countS) { String canSmi;//from ww w . j a v a2 s . c om OEGraphMol mol = new OEGraphMol(); LinkedHashMap<String, String> smilesMap = new LinkedHashMap<String, String>(); loadHashMap(smilesMap); Iterator<String> iter = smilesMap.keySet().iterator(); oemolostream ofs = new oemolostream(); ofs.open("TPSA_test.sdf"); while (iter.hasNext()) { String key = (String) iter.next(); String PSA = (String) smilesMap.get(key); mol.Clear(); if (oechem.OEParseSmiles(mol, key)) { mol.SetTitle(key); System.out.print(key + ": "); double tpsa = calculateTPSA(mol, countP, countS); mol.SetTitle(key); oechem.OEAddSDData(mol, "TPSA", String.valueOf(tpsa)); canSmi = oechem.OECreateCanSmiString(mol); oechem.OEAddSDData(mol, "CanSmiles", canSmi); System.out.printf("Lit: %s\tTPSA: %.2f\n", PSA, tpsa); oechem.OEWriteMolecule(ofs, mol); } else { System.err.println("Error parsing the SMILES string: " + key); } } }
From source file:com.itemanalysis.jmetrik.file.JmetrikFileExporter.java
private boolean exportFile() { JmetrikFileReader reader = null;/*from w w w. j av a 2 s . c o m*/ BufferedWriter writer = null; CSVPrinter printer = null; if (outputFile.exists() && !overwrite) return false; try { reader = new JmetrikFileReader(dataFile); writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outputFile.toPath()))); reader.openConnection(); if (hasHeader) { String[] colNames = reader.getColumnNames(); printer = new CSVPrinter(writer, CSVFormat.DEFAULT.withCommentMarker('#').withDelimiter(delimiter).withHeader(colNames)); } else { printer = new CSVPrinter(writer, CSVFormat.DEFAULT.withCommentMarker('#').withDelimiter(delimiter)); } LinkedHashMap<VariableName, VariableAttributes> variableAttributes = reader.getVariableAttributes(); JmetrikCSVRecord record = null; VariableAttributes tempAttributes = null; //print scored values if (scored) { String tempValue = ""; while (reader.hasNext()) { record = reader.next(); for (VariableName v : variableAttributes.keySet()) { tempAttributes = variableAttributes.get(v); tempValue = record.originalValue(v); if (tempAttributes.getItemType() == ItemType.NOT_ITEM) { //write original string if not an item if (record.isMissing(v, tempValue) && empty) { printer.print(""); } else { printer.print(tempValue); } } else { //write scored value if a test item if (record.isMissing(v, tempValue) && empty) { printer.print(""); } else { printer.print(tempAttributes.getItemScoring().computeItemScore(tempValue)); } } } printer.println(); } //print original values } else { String tempValue = ""; while (reader.hasNext()) { record = reader.next(); for (VariableName v : variableAttributes.keySet()) { tempValue = record.originalValue(v); if (record.isMissing(v, tempValue) && empty) { printer.print(""); } else { printer.print(tempValue); } } printer.println(); } } } catch (IOException ex) { theException = ex; } finally { try { if (reader != null) reader.close(); if (printer != null) printer.close(); if (writer != null) writer.close(); } catch (IOException ex) { theException = ex; } } return true; }
From source file:org.esigate.extension.surrogate.Surrogate.java
/** * The current implementation of ESI cannot execute rules partially. For instance if ESI-Inline is requested, ESI, * ESI-Inline, X-ESI-Fragment are executed. * /*from w ww . j a v a 2 s .c om*/ * <p> * This method handles this specific case : if one requested capability enables the Esi extension in this instance, * all other capabilities are moved to this instance. This prevents broken behavior. * * * @see Esi * @see org.esigate.extension.Esi * * @param targetCapabilities * @param currentSurrogate * the current surrogate id. */ private void fixSurrogateMap(LinkedHashMap<String, List<String>> targetCapabilities, String currentSurrogate) { boolean esiEnabledInEsigate = false; // Check if Esigate will perform ESI. for (String c : Esi.CAPABILITIES) { if (targetCapabilities.get(currentSurrogate).contains(c)) { esiEnabledInEsigate = true; break; } } if (esiEnabledInEsigate) { // Ensure all Esi capabilities are executed by our instance. for (String c : Esi.CAPABILITIES) { for (String device : targetCapabilities.keySet()) { if (device.equals(currentSurrogate)) { if (!targetCapabilities.get(device).contains(c)) { targetCapabilities.get(device).add(c); } } else { targetCapabilities.get(device).remove(c); } } } } }
From source file:com.android.together.BaseActivity.java
public Line getLineInfo(Map<String, Object> res_json) { Line line = null;// w w w . j a v a2s. c o m LinkedHashMap<String, Object> base_info = (LinkedHashMap<String, Object>) res_json.get("base_info"); LinkedHashMap<String, Object> user_info = (LinkedHashMap<String, Object>) res_json.get("user_list"); line = new Line(); line.setId(Integer.parseInt((String) base_info.get("line_id"))); line.setStartAddr((String) base_info.get("start_addr")); line.setEndAddr((String) base_info.get("end_addr")); // line.setDateTime(DateUtil.changeLong(Long.parseLong((String)temp.get("date")))); line.setDateTime((String) base_info.get("date")); line.setNum(Integer.parseInt((String) base_info.get("num"))); //line.setType(Integer.parseInt((String)base_info.get("type"))); line.setReason((String) base_info.get("reason")); line.setUrl((String) base_info.get("head_url")); List<LinkedHashMap<String, Object>> driver_info = (List<LinkedHashMap<String, Object>>) user_info .get("driver"); //@SuppressWarnings("unchecked") List<LinkedHashMap<String, Object>> pass_info = (List<LinkedHashMap<String, Object>>) user_info .get("passenger"); if (driver_info != null) { User driver = new User(); if (driver_info.get(0) != null) { driver.setPhone((String) driver_info.get(0).get("phone")); driver.setName((String) driver_info.get(0).get("name")); driver.setCar_license((String) driver_info.get(0).get("car_lincense")); driver.setCar_type((String) driver_info.get(0).get("car_name")); driver.setHead_url((String) driver_info.get(0).get("head_url")); line.setDriver(driver); } } List<User> list = new ArrayList<User>(); if (pass_info != null) { for (int i = 0; i < pass_info.size(); i++) { User passenger = new User(); LinkedHashMap<String, Object> pass = pass_info.get(i); passenger.setPhone((String) pass.get("phone")); passenger.setName((String) pass.get("name")); passenger.setNum((Integer) pass.get("num")); passenger.setHead_url((String) pass.get("head_url")); list.add(passenger); } line.setPassenger_List(list); } return line; }
From source file:com.opengamma.component.ComponentManager.java
/** * Initializes the global definitions from the config. *//* ww w. j a v a 2 s . c o m*/ protected void initGlobal() { LinkedHashMap<String, String> global = _configIni.getGroup("global"); if (global != null) { PlatformConfigUtils.configureSystemProperties(); String zoneId = global.get("time.zone"); if (zoneId != null) { OpenGammaClock.setZone(ZoneId.of(zoneId)); } } }
From source file:com.netsteadfast.greenstep.bsc.action.PdcaSaveOrUpdateAction.java
@SuppressWarnings("unchecked") private List<PdcaItemVO> fillItems(List<Map<String, Object>> datas) throws ControllerException, Exception { List<PdcaItemVO> items = new ArrayList<PdcaItemVO>(); if (datas == null || datas.size() < 1) { return items; }// ww w.j a v a 2 s . c o m // fill data to PdcaItemVO for (Map<String, Object> data : datas) { PdcaItemVO item = new PdcaItemVO(); item.setType(String.valueOf(data.get("type"))); item.setTitle(String.valueOf(data.get("title"))); item.setStartDate(String.valueOf(data.get("startDate"))); item.setEndDate(String.valueOf(data.get("endDate"))); item.setDescription(String.valueOf(data.get("description"))); item.setEmployeeOids(super.transformAppendIds2List( super.defaultString(String.valueOf(data.get("ownerOids"))).trim())); //item.setUploadOids( (List<String>) data.get("upload") ); item.setUploadOids(new ArrayList<String>()); List<LinkedHashMap<String, String>> uploadDatas = (List<LinkedHashMap<String, String>>) data .get("upload"); for (LinkedHashMap<String, String> uploadData : uploadDatas) { item.getUploadOids().add(uploadData.get("oid")); } items.add(item); } return items; }
From source file:com.itemanalysis.jmetrik.stats.itemanalysis.ItemAnalysisOutputFile.java
public File saveOutput(LinkedHashMap<VariableName, ClassicalItem> itemTreeMap, boolean allCategories, boolean addDIndex) throws IOException { this.outputfile = getUniqueFile(outputfile); int nItems = itemTreeMap.size(); int maxCategory = 0; ClassicalItem item = null;/* w w w .j ava 2 s.co m*/ for (VariableName v : itemTreeMap.keySet()) { item = itemTreeMap.get(v); maxCategory = Math.max(maxCategory, item.numberOfCategories()); } int totalColumns = 4 + 3 * maxCategory; LinkedHashMap<VariableName, VariableAttributes> variableAttributeMap = new LinkedHashMap<VariableName, VariableAttributes>(); VariableAttributes nameAtt = new VariableAttributes(new VariableName("name"), new VariableLabel("Item Name"), DataType.STRING, 0); VariableAttributes difficultyAtt = new VariableAttributes(new VariableName("difficulty"), new VariableLabel("Item Difficulty"), DataType.DOUBLE, 1); VariableAttributes stdDevAtt = new VariableAttributes(new VariableName("stdev"), new VariableLabel("Item Standard Deviation"), DataType.DOUBLE, 2); VariableAttributes discrimAtt = new VariableAttributes(new VariableName("discrimination"), new VariableLabel("Item Discrimination"), DataType.DOUBLE, 3); variableAttributeMap.put(nameAtt.getName(), nameAtt); variableAttributeMap.put(difficultyAtt.getName(), difficultyAtt); variableAttributeMap.put(stdDevAtt.getName(), stdDevAtt); variableAttributeMap.put(discrimAtt.getName(), discrimAtt); VariableAttributes lower = null; VariableAttributes upper = null; VariableAttributes dIndex = null; if (addDIndex) { lower = new VariableAttributes(new VariableName("lower"), new VariableLabel("Difficulty for lower 27%"), DataType.DOUBLE, 4); upper = new VariableAttributes(new VariableName("upper"), new VariableLabel("Difficulty for upper 27%"), DataType.DOUBLE, 5); dIndex = new VariableAttributes(new VariableName("D_index"), new VariableLabel("Discrimination index"), DataType.DOUBLE, 6); variableAttributeMap.put(lower.getName(), lower); variableAttributeMap.put(upper.getName(), upper); variableAttributeMap.put(dIndex.getName(), dIndex); } VariableAttributes vPropAtt = null; VariableAttributes vSDAtt = null; VariableAttributes vCorAtt = null; int colNumber = 4; if (addDIndex) colNumber = 7; if (allCategories) { for (int k = 0; k < maxCategory; k++) { vPropAtt = new VariableAttributes(new VariableName("prop" + (k + 1)), new VariableLabel("Proportion endorsing option " + (k + 1)), DataType.DOUBLE, colNumber++); vSDAtt = new VariableAttributes(new VariableName("stdev" + (k + 1)), new VariableLabel("Std. Dev. for option " + (k + 1)), DataType.DOUBLE, colNumber++); vCorAtt = new VariableAttributes(new VariableName("cor" + (k + 1)), new VariableLabel("Distractor-total correlation for option " + (k + 1)), DataType.DOUBLE, colNumber++); variableAttributeMap.put(vPropAtt.getName(), vPropAtt); variableAttributeMap.put(vSDAtt.getName(), vSDAtt); variableAttributeMap.put(vCorAtt.getName(), vCorAtt); } } int n = 0; try (JmetrikFileWriter writer = new JmetrikFileWriter(outputfile, variableAttributeMap)) { writer.openConnection(); writer.writeHeader(nItems); int index = 0; double df = 0, sd = 0, ds = 0, dL = 0, dU = 0, D = 0; for (VariableName v : itemTreeMap.keySet()) { index = 0; item = itemTreeMap.get(v); writer.writeValue(nameAtt.getName(), item.getName().toString()); df = item.getDifficulty(); if (Double.isNaN(df)) { writer.writeValue(difficultyAtt.getName(), ""); } else { writer.writeValue(difficultyAtt.getName(), df); } index++; sd = item.getStdDev(); if (Double.isNaN(sd)) { writer.writeValue(stdDevAtt.getName(), ""); } else { writer.writeValue(stdDevAtt.getName(), sd); } index++; ds = item.getDiscrimination(); if (Double.isNaN(ds)) { writer.writeValue(discrimAtt.getName(), ""); } else { writer.writeValue(discrimAtt.getName(), ds); } index++; if (addDIndex) { dL = item.getDindexLower(); if (Double.isNaN(dL)) { writer.writeValue(lower.getName(), ""); } else { writer.writeValue(lower.getName(), dL); } index++; dU = item.getDindexUpper(); if (Double.isNaN(dU)) { writer.writeValue(upper.getName(), ""); } else { writer.writeValue(upper.getName(), dU); } index++; D = dU - dL; if (Double.isNaN(D)) { writer.writeValue(dIndex.getName(), ""); } else { writer.writeValue(dIndex.getName(), D); } index++; } if (allCategories) { Object temp; Iterator<Object> iter = item.categoryIterator(); int catIndex = 1; VariableName catProp = null; VariableName catStDev = null; VariableName catDisc = null; while (iter.hasNext()) { temp = iter.next(); catProp = new VariableName("prop" + catIndex); catStDev = new VariableName("stdev" + catIndex); catDisc = new VariableName("cor" + catIndex); vPropAtt = variableAttributeMap.get(catProp); vSDAtt = variableAttributeMap.get(catStDev); vCorAtt = variableAttributeMap.get(catDisc); //category difficulty df = item.getDifficultyAt(temp); if (Double.isNaN(df)) { writer.writeValue(vPropAtt.getName(), ""); } else { writer.writeValue(vPropAtt.getName(), df); } index++; //category sd sd = item.getStdDevAt(temp); if (Double.isNaN(sd)) { writer.writeValue(vSDAtt.getName(), ""); } else { writer.writeValue(vSDAtt.getName(), sd); } index++; //category discrimination ds = item.getDiscriminationAt(temp); if (Double.isNaN(ds)) { writer.writeValue(vCorAtt.getName(), ""); } else { writer.writeValue(vCorAtt.getName(), ds); } index++; catIndex++; } //end loop over categories //index should be equal to totalColumns // if not, add null values to remaining columns // while(index<totalColumns-1){ // writer.writeValue(index++, ""); // } } writer.updateRow(); } //end loop over items } return outputfile; }
From source file:org.openmeetings.servlet.outputhandler.Install.java
private Template getStep2Template(HttpServletRequest httpServletRequest, Context ctx, String lang) throws Exception { String header = httpServletRequest.getHeader("Accept-Language"); String[] headerList = header != null ? header.split(",") : new String[0]; String headCode = headerList.length > 0 ? headerList[0] : "en"; String filePath = getServletContext().getRealPath("/") + ImportInitvalues.languageFolderName; LinkedHashMap<Integer, LinkedHashMap<String, Object>> allLanguagesAll = getImportInitvalues() .getLanguageFiles(filePath); LinkedHashMap<Integer, String> allLanguages = new LinkedHashMap<Integer, String>(); //first iteration for preferred language Integer prefKey = -1;/*from w w w.j av a2 s . co m*/ String prefName = null; for (Integer key : allLanguagesAll.keySet()) { String langName = (String) allLanguagesAll.get(key).get("name"); String langCode = (String) allLanguagesAll.get(key).get("code"); if (langCode != null) { if (headCode.equals(langCode)) { prefKey = key; prefName = langName; break; } else if (headCode.startsWith(langCode)) { prefKey = key; prefName = langName; } } } allLanguages.put(prefKey, prefName); for (Integer key : allLanguagesAll.keySet()) { String langName = (String) allLanguagesAll.get(key).get("name"); if (key != prefKey) { allLanguages.put(key, langName); } } LinkedHashMap<String, String> allFonts = new LinkedHashMap<String, String>(); allFonts.put("TimesNewRoman", "TimesNewRoman"); allFonts.put("Verdana", "Verdana"); allFonts.put("Arial", "Arial"); List<OmTimeZone> omTimeZoneList = getImportInitvalues().getTimeZones(filePath); Template tpl = super.getTemplate("install_step1_" + lang + ".vm"); ctx.put("allLanguages", allLanguages); ctx.put("allFonts", allFonts); ctx.put("allTimeZones", ImportHelper.getAllTimeZones(omTimeZoneList)); StringWriter writer = new StringWriter(); tpl.merge(ctx, writer); return tpl; }