List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:com.google.gwt.emultest.java.util.LinkedHashMapTest.java
public void testGet() { LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>(); checkEmptyLinkedHashMapAssumptions(hashMap); assertNull(hashMap.get(KEY_TEST_GET)); hashMap.put(KEY_TEST_GET, VALUE_TEST_GET); assertNotNull(hashMap.get(KEY_TEST_GET)); assertNull(hashMap.get(null));//from w w w .j av a2s . co m hashMap.put(null, VALUE_TEST_GET); assertNotNull(hashMap.get(null)); hashMap.put(null, null); assertNull(hashMap.get(null)); }
From source file:net.sf.maltcms.chromaui.normalization.spi.charts.PeakGroupRtBoxPlot.java
public List<JFreeChart> createChart() { List<JFreeChart> charts = new ArrayList<>(); LinkedHashSet<ITreatmentGroupDescriptor> treatmentGroups = new LinkedHashSet<>( project.getTreatmentGroups()); List<CategoryPlot> plots = new LinkedList<>(); for (IPeakGroupDescriptor pgd : pgdl) { LinkedHashMap<ITreatmentGroupDescriptor, HashSet<IPeakAnnotationDescriptor>> map = new LinkedHashMap<>(); for (ITreatmentGroupDescriptor itgd : treatmentGroups) { map.put(itgd, new LinkedHashSet<IPeakAnnotationDescriptor>()); }/*from ww w . ja v a2s .c o m*/ List<IPeakAnnotationDescriptor> descriptors = pgd.getPeakAnnotationDescriptors(); DefaultBoxAndWhiskerCategoryDataset baw = new DefaultBoxAndWhiskerCategoryDataset(); for (IPeakAnnotationDescriptor ipad : descriptors) { ITreatmentGroupDescriptor treatmentGroup = ipad.getChromatogramDescriptor().getTreatmentGroup(); HashSet<IPeakAnnotationDescriptor> descr = map.get(treatmentGroup); if (descr == null) { descr = new HashSet<>(); map.put(treatmentGroup, descr); } descr.add(ipad); } List<Color> colors = new LinkedList<>(); for (ITreatmentGroupDescriptor tgd : map.keySet()) { String name = getPeakName(pgd); baw.add(createBoxAndWhiskerItem(map.get(tgd)), tgd.getName() + " (" + map.get(tgd).size() + ")", name); colors.add(tgd.getColor()); } BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(true); renderer.setMeanVisible(false); renderer.setMedianVisible(true); renderer.setArtifactPaint(new Color(0, 0, 0, 128)); renderer.setMaximumBarWidth(0.1); renderer.setUseOutlinePaintForWhiskers(false); // renderer.setAutoPopulateSeriesFillPaint(true); // renderer.setAutoPopulateSeriesPaint(true); // renderer.setAutoPopulateSeriesOutlinePaint(true); NumberAxis yAxis = new NumberAxis("Peak Apex Retention Time"); yAxis.setAutoRange(true); yAxis.setAutoRangeIncludesZero(false); CategoryPlot cp = new CategoryPlot(baw, new CategoryAxis("Treatment Groups"), yAxis, renderer); Logger.getLogger(getClass().getName()).log(Level.INFO, "Setting {0} colors!", colors.size()); ChartCustomizer.setSeriesColors(cp, 0.6f, colors); // ChartCustomizer.setSeriesColors(cp, 0.9f,colors); plots.add(cp); JFreeChart chart = new JFreeChart(cp); chart.setTitle( "Peak group " + pgd.getDisplayName() + " size: " + pgd.getPeakAnnotationDescriptors().size()); charts.add(chart); } // CategoryAxis ca = new CategoryAxis("Treatment Groups"); // NumberAxis va = new NumberAxis("Normalized Peak Area"); // CombinedDomainCategoryPlot cdcp = new CombinedDomainCategoryPlot(ca); // for (CategoryPlot cp : plots) { // cp.setRangeAxis(va); // cdcp.add(cp); // break; // } // return new JFreeChart(cdcp); return charts; }
From source file:required.ChartPlotter.java
/** * Creates a sample dataset./*from w w w. j a va 2 s .c om*/ * * @return a sample dataset. * @throws IOException * @throws FileNotFoundException * @throws ClassNotFoundException */ @SuppressWarnings("unchecked") private XYDataset createDataset() throws FileNotFoundException, IOException, ClassNotFoundException { LinkedHashMap<String, Long> lhash = new LinkedHashMap<>(); try (InputStream file = new FileInputStream("SortedFreq.r"); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new ObjectInputStream(buffer); ) { //deserialize the List lhash = (LinkedHashMap<String, Long>) input.readObject(); input.close(); buffer.close(); file.close(); System.out.println(lhash.size()); } final XYSeries series2 = new XYSeries("Second"); Iterator<String> it = lhash.keySet().iterator(); for (int i = 0; i < lhash.size(); i++) { if (it.hasNext()) series2.add(i, lhash.get(it.next())); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series2); return dataset; }
From source file:org.fao.fenix.wds.web.rest.crowdprices.CrowdPricesDataRESTService.java
private String createGeoJson(List<List<String>> table) { String s = "{ \"type\":\"FeatureCollection\",\"features\":["; int i = 0;//w w w .j a v a 2 s .co m LinkedHashMap<String, List<List<String>>> markets = getCrowdPricesPoints(table); for (String marketname : markets.keySet()) { String popupcontent = "<b>" + marketname + "</b><br>"; String lat = ""; String lon = ""; for (List<String> row : markets.get(marketname)) { popupcontent += row.get(1).replace("_", " ") + " - " + row.get(2) + " " + " " + row.get(3).replace("_", " ") + "/" + row.get(4).replace("_", " ") + "<br>"; lon = row.get(5); lat = row.get(6); } // System.out.println("popup: " + popupcontent); s += "{\"type\":\"Feature\",\"properties\":{\"iconurl\":\"images/marker-icon.png\"," + "\"name\":\"Countrys\"," + // s += "{\"type\":\"Feature\",\"properties\":{\"iconurl\":\"http://fenixapps.fao.org/repository/js/leaflet/0.5.1/images/marker-icon-disabled.png\"," + "\"name\":\"Countrys\"," + "\"popupContent\":\"" + popupcontent + " \"},\"geometry\":{\"type\":\"Point\",\"coordinates\":[" + lon + "," + lat + "]}}"; if (i < markets.size() - 1) { s += ","; } i++; } s += "]}"; return s; }
From source file:com.delphix.delphix.DelphixEngine.java
public DelphixSnapshot getSnapshot(String reference) throws ClientProtocolException, IOException, DelphixEngineException { LinkedHashMap<String, DelphixSnapshot> snapshots = listSnapshots(); return snapshots.get(reference); }
From source file:com.delphix.delphix.DelphixEngine.java
/** * Get a single container/* w w w . j av a 2s.com*/ */ public DelphixContainer getContainer(String reference) throws ClientProtocolException, IOException, DelphixEngineException { LinkedHashMap<String, DelphixContainer> containers = listContainers(); return containers.get(reference); }
From source file:com.joey.software.Launcher.microneedleAnalysis.DataAnalysisViewer.java
public CategoryDataset getAVGForeArmData() { LinkedHashMap<String, ArrayList<Double>> skinData = new LinkedHashMap<String, ArrayList<Double>>(); LinkedHashMap<String, ArrayList<Double>> poreData = new LinkedHashMap<String, ArrayList<Double>>(); LinkedHashMap<String, ArrayList<Double>> poreSkinData = new LinkedHashMap<String, ArrayList<Double>>(); ArrayList<MeasurmentData> measureData = owner.measures; for (MeasurmentData measure : measureData) { if (validMeasurment(measure)) { ArrayList<Double> holdSkin = skinData.get(measure.view); if (holdSkin == null) { holdSkin = new ArrayList<Double>(); skinData.put(measure.view, holdSkin); }/*from w w w .j av a 2 s . c om*/ holdSkin.add(measure.skinDim.getValue()); ArrayList<Double> holdPore = poreData.get(measure.view); if (holdPore == null) { holdPore = new ArrayList<Double>(); poreData.put(measure.view, holdPore); } holdPore.add(measure.poreDim.getValue()); ArrayList<Double> holdPoreSkin = poreSkinData.get(measure.view); if (holdPoreSkin == null) { holdPoreSkin = new ArrayList<Double>(); poreSkinData.put(measure.view, holdPoreSkin); } holdPoreSkin.add(measure.skinPoreDim.getValue()); } } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); { String[] keys = skinData.keySet().toArray(new String[0]); for (String key : keys) { ArrayList<Double> skin = skinData.get(key); if (useSkin.isSelected()) { dataset.addValue( DataAnalysisToolkit.getAverage(DataAnalysisToolkit.ListToArrayd(skinData.get(key))), "Skin", key); } if (usePore.isSelected()) { dataset.addValue( DataAnalysisToolkit.getAverage(DataAnalysisToolkit.ListToArrayd(poreData.get(key))), "Pore", key); } if (usePoreSkin.isSelected()) { dataset.addValue( DataAnalysisToolkit.getAverage(DataAnalysisToolkit.ListToArrayd(poreSkinData.get(key))), "SkinPore", key); } if (useTotal.isSelected()) { dataset.addValue( DataAnalysisToolkit.getAverage(DataAnalysisToolkit.ListToArrayd(skinData.get(key))) + DataAnalysisToolkit .getAverage(DataAnalysisToolkit.ListToArrayd(poreSkinData.get(key))), "Total", key); } } } return dataset; }
From source file:org.fao.fenix.wds.web.rest.crowdprices.CrowdPricesDataRESTService.java
private LinkedHashMap<String, List<List<String>>> getCrowdPricesPoints(List<List<String>> table) { LinkedHashMap<String, List<List<String>>> markets = new LinkedHashMap<String, List<List<String>>>(); for (List<String> row : table) { String marketname = row.get(0); List<List<String>> rows = new ArrayList<List<String>>(); if (markets.containsKey(marketname)) { rows = markets.get(marketname); }//w w w .j a va 2 s .c o m rows.add(row); markets.put(marketname, rows); } return markets; }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.databasecomponents.SelectionDatabaseWidget.java
private void validateDatabaseParams() { List<String> oracleDatabaseValues = new ArrayList<String>(); getDatabaseConnectionDetails();//from w w w.j a v a 2 s.c om LinkedHashMap<String, Object> property = getProperties(); databaseSelectionConfig = (DatabaseSelectionConfig) property.get(propertyName); if (((Button) tableNameRadioButton.getSWTWidgetControl()).getSelection()) { oracleDatabaseValues.add(getValue(databaseSelectionConfig.getTableName())); } else { WidgetUtility.createMessageBox(Messages.METASTORE_FORMAT_ERROR_FOR_SQL_QUERY, Messages.ERROR, SWT.ICON_INFORMATION); } if (oracleDatabaseValues != null && oracleDatabaseValues.size() > 0) { extractOracleMetaStoreDetails(oracleDatabaseValues); } }
From source file:biz.netcentric.cq.tools.actool.configReader.YamlConfigReader.java
private Map<String, Set<AuthorizableConfigBean>> getAuthorizablesMap(final List<LinkedHashMap> yamlMap, final AuthorizableValidator authorizableValidator) throws AcConfigBeanValidationException { final Set<String> alreadyProcessedGroups = new HashSet<String>(); final Map<String, Set<AuthorizableConfigBean>> principalMap = new LinkedHashMap<String, Set<AuthorizableConfigBean>>(); if (yamlMap == null) { return principalMap; }// w ww . j a v a2 s .c o m final Session session = null; for (final LinkedHashMap currentMap : yamlMap) { final String currentPrincipal = (String) currentMap.keySet().iterator().next(); final Matcher matcher = forLoopPattern.matcher(currentPrincipal); if (matcher.find()) { LOG.info("Principal name {} matches FOR loop pattern. Unrolling {}", currentPrincipal, currentMap.get(currentPrincipal)); final List<AuthorizableConfigBean> groups = unrollGroupForLoop(currentPrincipal, (List<Map<String, ?>>) currentMap.get(currentPrincipal), new HashMap<String, String>()); for (final AuthorizableConfigBean group : groups) { final String principal = group.getPrincipalID(); if (!alreadyProcessedGroups.add(principal)) { throw new IllegalArgumentException( "There is more than one group definition for group: " + principal); } if (authorizableValidator != null) { authorizableValidator.validate(group); } final Set<AuthorizableConfigBean> tmpSet = new LinkedHashSet<AuthorizableConfigBean>(); tmpSet.add(group); principalMap.put(principal, tmpSet); } } else { if (!alreadyProcessedGroups.add(currentPrincipal)) { throw new IllegalArgumentException( "There is more than one group definition for group: " + currentPrincipal); } LOG.info("start reading group configuration"); LOG.info("Found principal: {} in config", currentPrincipal); final LinkedHashSet<AuthorizableConfigBean> tmpSet = new LinkedHashSet<AuthorizableConfigBean>(); principalMap.put(currentPrincipal, tmpSet); final List<Map<String, String>> currentPrincipalData = (List<Map<String, String>>) currentMap .get(currentPrincipal); if (currentPrincipalData != null && !currentPrincipalData.isEmpty()) { for (final Map<String, String> currentPrincipalDataMap : currentPrincipalData) { final AuthorizableConfigBean tmpPrincipalConfigBean = new AuthorizableConfigBean(); setupAuthorizableBean(tmpPrincipalConfigBean, currentPrincipalDataMap, (String) currentPrincipal); if (authorizableValidator != null) { authorizableValidator.validate(tmpPrincipalConfigBean); } principalMap.get(currentPrincipal).add(tmpPrincipalConfigBean); } } } } return principalMap; }