List of usage examples for java.util LinkedHashMap size
int size();
From source file:com.opengamma.analytics.financial.interestrate.capletstripping.CapletStrippingJacobian.java
public CapletStrippingJacobian(final List<CapFloor> caps, final YieldCurveBundle yieldCurves, final LinkedHashMap<String, double[]> knotPoints, final LinkedHashMap<String, Interpolator1D> interpolators, final LinkedHashMap<String, ParameterLimitsTransform> parameterTransforms, final LinkedHashMap<String, InterpolatedDoublesCurve> knownParameterTermSturctures) { Validate.notNull(caps, "caps null"); Validate.notNull(knotPoints, "null node points"); Validate.notNull(interpolators, "null interpolators"); Validate.isTrue(knotPoints.size() == interpolators.size(), "size mismatch between nodes and interpolators"); _knownParameterTermSturctures = knownParameterTermSturctures; final LinkedHashMap<String, Interpolator1D> transInterpolators = new LinkedHashMap<>(); final Set<String> names = interpolators.keySet(); _parameterNames = names;// ww w. ja v a2 s . c o m for (final String name : names) { final Interpolator1D temp = new TransformedInterpolator1D(interpolators.get(name), parameterTransforms.get(name)); transInterpolators.put(name, temp); } _capPricers = new ArrayList<>(caps.size()); for (final CapFloor cap : caps) { _capPricers.add(new CapFloorPricer(cap, yieldCurves)); } _interpolators = transInterpolators; _curveBuilder = new InterpolatedCurveBuildingFunction(knotPoints, transInterpolators); _dataBundleBuilder = new Interpolator1DDataBundleBuilderFunction(knotPoints, transInterpolators); }
From source file:required.ChartPlotter.java
/** * Creates a sample dataset.//from w w w .j a v a2 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:com.grarak.kerneladiutor.fragments.tools.BackupFragment.java
private void showBackupFlashingDialog(final File file) { final LinkedHashMap<String, Backup.PARTITION> menu = getPartitionMenu(); mBackupFlashingDialog = new Dialog(getActivity()) .setItems(menu.keySet().toArray(new String[menu.size()]), new DialogInterface.OnClickListener() { @Override/*from ww w . j a v a 2 s . c o m*/ public void onClick(DialogInterface dialogInterface, int i) { Backup.PARTITION partition = menu.values().toArray(new Backup.PARTITION[menu.size()])[i]; if (file != null) { restore(partition, file, true); } else { backup(partition); } } }).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { mBackupFlashingDialog = null; } }); mBackupFlashingDialog.show(); }
From source file:org.geosde.core.jdbc.JDBCDataStoreFactory.java
public final Param[] getParametersInfo() { LinkedHashMap map = new LinkedHashMap(); setupParameters(map);// w w w .ja v a2s .c o m return (Param[]) map.values().toArray(new Param[map.size()]); }
From source file:org.netflux.core.RecordMetadata.java
/** * Removes from this metadata all the field metadata with names included in the supplied collection. * /*from ww w. j av a 2 s . co m*/ * @param fieldNames the names of the field metadata to remove. * @throws NullPointerException if the specified collection is <code>null</code>. */ public void remove(Collection<String> fieldNames) { LinkedHashMap<String, Integer> fieldsToRemove = (LinkedHashMap<String, Integer>) this.fieldIndexes.clone(); fieldsToRemove.keySet().retainAll(fieldNames); List<FieldMetadata> newFieldMetadata = (List<FieldMetadata>) this.fieldMetadata.clone(); ListIterator<Integer> fieldIndexIterator = new ArrayList<Integer>(fieldsToRemove.values()) .listIterator(fieldsToRemove.size()); while (fieldIndexIterator.hasPrevious()) { newFieldMetadata.remove(fieldIndexIterator.previous()); } this.setFieldMetadata(newFieldMetadata); }
From source file:com.opengamma.component.ComponentManager.java
/** * Initializes the factory.//from w ww . j ava 2 s .c om * <p> * The real work of creating the component and registering it should be done here. * The factory may also publish a RESTful view and/or a life-cycle method. * * @param factory the factory to initialize, not null * @param remainingConfig the remaining configuration data, not null * @throws Exception to allow components to throw checked exceptions */ protected void initFactory(ComponentFactory factory, LinkedHashMap<String, String> remainingConfig) throws Exception { factory.init(getRepository(), remainingConfig); if (remainingConfig.size() > 0) { throw new IllegalStateException("Configuration was specified but not used: " + remainingConfig); } }
From source file:com.alibaba.wasp.meta.TestFMetaStore.java
@Test public void testIndex() throws MetaException { FTable Photo = FMetaTestUtil.Photo;/* ww w. j a v a2s. c om*/ restoreAndInitFMETA(); fMetaService.createTable(FMetaTestUtil.User); fMetaService.createTable(FMetaTestUtil.Photo); // addIndex fMetaService.addIndex(Photo.getTableName(), FMetaTestUtil.PhotosByTime); fMetaService.addIndex(Photo.getTableName(), FMetaTestUtil.PhotosByTag); // getAllIndex LinkedHashMap<String, Index> allIndexs = fMetaService.getAllIndex(Photo.getTableName()); assertEquals(allIndexs.size(), 2); // getIndex Index PBT = fMetaService.getIndex(Photo.getTableName(), FMetaTestUtil.PhotosByTime.getIndexName()); compare(PBT, FMetaTestUtil.PhotosByTime); // getIndex Index PBTAG = fMetaService.getIndex(Photo.getTableName(), FMetaTestUtil.PhotosByTag.getIndexName()); compare(PBTAG, FMetaTestUtil.PhotosByTag); // deleteIndex fMetaService.deleteIndex(Photo.getTableName(), FMetaTestUtil.PhotosByTag); allIndexs = fMetaService.getAllIndex(Photo.getTableName()); assertEquals(allIndexs.size(), 1); fMetaService.dropTable(FMetaTestUtil.User.getTableName()); fMetaService.dropTable(FMetaTestUtil.Photo.getTableName()); }
From source file:net.sf.maltcms.chromaui.normalization.spi.charts.PeakGroupRtBoxPlot.java
protected String getPeakName(IPeakGroupDescriptor pgd) { String rt = "mean rt: " + String.format("%.2f", pgd.getMeanApexTime()) + "+/-" + String.format("%.2f", pgd.getApexTimeStdDev()) + "; median rt: " + String.format("%.2f", pgd.getMedianApexTime()) + ": "; LinkedHashMap<String, Integer> names = new LinkedHashMap<>(); if (!pgd.getDisplayName().equals(pgd.getName())) { return rt + pgd.getDisplayName(); }//from w w w . j a v a 2 s. c om for (IPeakAnnotationDescriptor ipad : pgd.getPeakAnnotationDescriptors()) { if (names.containsKey(ipad.getName())) { names.put(ipad.getName(), names.get(ipad.getName()) + 1); } else { names.put(ipad.getName(), 1); } } if (names.isEmpty()) { return rt + "<NA>"; } if (names.size() > 1) { StringBuilder sb = new StringBuilder(); for (String key : names.keySet()) { sb.append(key); sb.append(" (" + names.get(key) + ")"); sb.append(" | "); } return rt + sb.replace(sb.length() - 1, sb.length() - 1, "").toString(); } else { return rt + names.keySet().toArray(new String[0])[0]; } }
From source file:com.github.nmorel.gwtjackson.shared.advanced.jsontype.TypeNamesTester.java
public void testRoundTripMap(ObjectMapperTester<LinkedHashMap<String, Animal>> mapper) { LinkedHashMap<String, Animal> input = new LinkedHashMap<String, Animal>(); input.put("venla", new MaineCoon("Venla", true)); input.put("ama", new Dog("Amadeus", 13)); String json = mapper.write(input); assertEquals("{\"venla\":{\"TypeNamesTester$MaineCoon\":{\"name\":\"Venla\",\"purrs\":true}}," + "" + "\"ama\":{\"doggy\":{\"ageInYears\":13,\"name\":\"Amadeus\"}}}", json); LinkedHashMap<String, Animal> output = mapper.read(json); assertNotNull(output);/*from w w w.j ava2s .c o m*/ assertEquals(input.size(), output.size()); // for some reason, straight comparison won't work... for (String name : input.keySet()) { Animal in = input.get(name); Animal out = output.get(name); if (!in.equals(out)) { fail("Animal in input was [" + in + "]; output not matching: [" + out + "]"); } } }
From source file:net.sf.maltcms.chromaui.normalization.spi.charts.PeakGroupBoxPlot.java
protected String getPeakName(IPeakGroupDescriptor pgd) { String rt = "mean area: " + String.format("%.2f", pgd.getMeanArea(normalizer)) + "+/-" + String.format("%.2f", pgd.getAreaStdDev(normalizer)) + "; median area: " + String.format("%.2f", pgd.getMedianArea(normalizer)) + ": "; LinkedHashMap<String, Integer> names = new LinkedHashMap<>(); if (!pgd.getDisplayName().equals(pgd.getName())) { return rt + pgd.getDisplayName(); }/* w w w. j a v a 2 s. co m*/ for (IPeakAnnotationDescriptor ipad : pgd.getPeakAnnotationDescriptors()) { if (names.containsKey(ipad.getName())) { names.put(ipad.getName(), names.get(ipad.getName()) + 1); } else { names.put(ipad.getName(), 1); } } if (names.isEmpty()) { return rt + "<NA>"; } if (names.size() > 1) { StringBuilder sb = new StringBuilder(); for (String key : names.keySet()) { sb.append(key); sb.append(" (" + names.get(key) + ")"); sb.append(" | "); } return rt + sb.replace(sb.length() - 1, sb.length() - 1, "").toString(); } else { return rt + names.keySet().toArray(new String[0])[0]; } }