List of usage examples for java.util TreeMap TreeMap
public TreeMap()
From source file:ee.signwise.sdk.model.MessageInfo.java
/** * Constructor for MessageInfo// w w w. ja v a 2s. com * @param jobj JSON object */ public MessageInfo(JSONObject jobj) { m_messages = new TreeMap<String, String>(); Iterator<String> it = jobj.keys(); while (it.hasNext()) { String key = it.next(); String msg = jobj.getString(key); m_messages.put(key, msg); } }
From source file:de.vandermeer.skb.interfaces.application.CliOptionList.java
/** * Returns a sorted map of CLI options, the mapping is the sort string to the CLI option. * @param list option list to sort//from www. j av a 2 s . c o m * @param numberShort number of arguments with short command * @param numberLong number of arguments with long command * @return sorted map */ static TreeMap<String, ApoBaseC> sortedMap(Set<ApoBaseC> list, int numberShort, int numberLong) { TreeMap<String, ApoBaseC> ret = new TreeMap<>(); if (list == null) { return ret; } for (ApoBaseC opt : list) { String key; if (numberShort == 0) { key = opt.getCliLong(); } if (numberLong == 0) { key = opt.getCliShort().toString(); } else { if (opt.getCliLong() != null) { if (opt.getCliShort() != null) { key = opt.getCliShort().toString() + "," + opt.getCliLong(); } else { key = opt.getCliLong().charAt(0) + "," + opt.getCliLong(); } } else { key = opt.getCliShort().toString(); } } ret.put(key.toLowerCase(), opt); } return ret; }
From source file:com.yahoo.flowetl.core.pipe.result.BackedPipeResult.java
/** * Instantiates a new backed pipe result. */ public BackedPipeResult() { backing = new TreeMap<String, Object>(); }
From source file:it.imtech.bookimporter.BookUtilityTest.java
/** * Test of getOrderedLanguages method, of class BookUtility. *//*from w w w .ja va2 s.c o m*/ public void testGetOrderedLanguages() { System.out.println("Test Ordering configuration languages: method -> getOrderedLanguages"); TreeMap<String, String> en = new TreeMap<String, String>(); en.put("English", "en"); en.put("German", "de"); en.put("Italian", "it"); TreeMap<String, String> it = new TreeMap<String, String>(); it.put("Inglese", "en"); it.put("Italiano", "it"); it.put("Tedesco", "de"); TreeMap<String, String> de = new TreeMap<String, String>(); de.put("Deutsch", "de"); de.put("English", "en"); de.put("Italienisch", "it"); try { CustomClassLoader loader = new CustomClassLoader(); Locale locale = new Locale("en"); ResourceBundle bundle = ResourceBundle.getBundle(RESOURCES, locale, loader); XMLConfiguration config = new XMLConfiguration(new File(DEBUG_XML)); TreeMap<String, String> result = BookUtility.getOrderedLanguages(config, bundle); assertEquals(en, result); locale = new Locale("it"); bundle = ResourceBundle.getBundle(RESOURCES, locale, loader); config = new XMLConfiguration(new File(DEBUG_XML)); result = BookUtility.getOrderedLanguages(config, bundle); assertEquals(it, result); locale = new Locale("de"); bundle = ResourceBundle.getBundle(RESOURCES, locale, loader); config = new XMLConfiguration(new File(DEBUG_XML)); result = BookUtility.getOrderedLanguages(config, bundle); assertEquals(de, result); } catch (ConfigurationException e) { fail("Ordering Language Test failed: ConfigurationException:- " + e.getMessage()); } }
From source file:com.github.lucapino.sheetmaker.parsers.mediainfo.MediaInfoRetriever.java
@Override public MovieInfo getMovieInfo(String filePath) { MediaInfo mediaInfo = new MediaInfo(); String fileToParse = filePath; // test if we have iso if (filePath.toLowerCase().endsWith("iso")) { // open iso and parse the ifo files Map<Integer, String> ifoFiles = new TreeMap<>(); try {//from w w w. ja v a 2s . c o m FileSystemManager fsManager = VFS.getManager(); FileObject fo = fsManager.resolveFile("iso:" + filePath + "!/"); // create an ifo file selector FileSelector ifoFs = new FileFilterSelector(new FileFilter() { @Override public boolean accept(FileSelectInfo fsi) { return fsi.getFile().getName().getBaseName().toLowerCase().endsWith("ifo"); } }); FileObject[] files = fo.getChild("VIDEO_TS").findFiles(ifoFs); for (FileObject file : files) { File tmpFile = new File( System.getProperty("java.io.tmpdir") + File.separator + file.getName().getBaseName()); System.out.println(file.getName().getBaseName()); IOUtils.copy(file.getContent().getInputStream(), new FileOutputStream(tmpFile)); mediaInfo.Open(tmpFile.getAbsolutePath()); String format = mediaInfo.Get(MediaInfo.StreamKind.General, 0, "Format_Profile", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); System.out.println("Format profile: " + format); // if format is "Program" -> it's a video file if (format.equalsIgnoreCase("program")) { String duration = mediaInfo.Get(MediaInfo.StreamKind.General, 0, "Duration", MediaInfo.InfoKind.Text, MediaInfo.InfoKind.Name); System.out.println("Duration: " + duration); ifoFiles.put(Integer.valueOf(duration), tmpFile.getName()); } mediaInfo.Close(); } if (!ifoFiles.isEmpty()) { if (ifoFiles.size() == 1) { fileToParse = ifoFiles.values().iterator().next(); } else { // get the last entry -> the bigger one Set<Integer> keys = ifoFiles.keySet(); Iterator<Integer> iterator = keys.iterator(); for (int i = 0; i < keys.size(); i++) { String fileName = ifoFiles.get(iterator.next()); if (i == keys.size() - 1) { fileToParse = fileName; } else { new File(fileName).delete(); } } } } } catch (IOException | NumberFormatException ex) { } } // here fileToParse is correct mediaInfo.Open(fileToParse); System.out.println(mediaInfo.Inform()); return new MovieInfoImpl(mediaInfo, filePath); }
From source file:com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity.java
/** * Constructor. A new map is created. */ public MultipleCurrencyMulticurveSensitivity() { _sensitivity = new TreeMap<>(); }
From source file:josejamilena.pfc.analizador.GraficoPorSGBD.java
public GraficoPorSGBD(final String sgbd, final String script) throws ClassNotFoundException, SQLException { Map<String, String> res = new TreeMap<String, String>(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Statement stmt = null;//from www. j a v a2 s. c o m ResultSet rs = null; String consulta = "select tiempo, fecha from estadisticas where tipo=\'" + script + "\' and host_sgbd=\'" + sgbd + "\'"; stmt = App.conn.createStatement(); rs = stmt.executeQuery(consulta); while (rs.next()) { res.put(rs.getString(2), rs.getString(1)); } rs.close(); stmt.close(); Iterator it = res.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); dataset.setValue(Double.parseDouble(pairs.getValue().toString()), script, pairs.getKey().toString()); } JFreeChart chart = ChartFactory.createBarChart(sgbd, // chart title "Hora", // domain axis label "Duracin (milisegundos)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, false, // include legend true, false); CategoryPlot plot = chart.getCategoryPlot(); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); ChartPanel chartPanel = new ChartPanel(chart); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add((new JPanel()).add(chartPanel)); setContentPane(scrollPane); }
From source file:com.opengamma.analytics.financial.provider.sensitivity.inflation.MultipleCurrencyInflationSensitivity.java
/** * Constructor. A new map is created. */ public MultipleCurrencyInflationSensitivity() { _sensitivity = new TreeMap<>(); }
From source file:josejamilena.pfc.analizador.GraficoPorCliente.java
public GraficoPorCliente(final String cliente, final String script) throws ClassNotFoundException, SQLException { Map<String, String> res = new TreeMap<String, String>(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); Statement stmt = null;//from w ww .j a v a2 s . c om ResultSet rs = null; String consulta = "select tiempo, fecha from estadisticas where tipo=\'" + script + "\' and host_cliente=\'" + cliente + "\'"; stmt = App.conn.createStatement(); rs = stmt.executeQuery(consulta); while (rs.next()) { res.put(rs.getString(2), rs.getString(1)); } rs.close(); stmt.close(); Iterator it = res.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); dataset.setValue(Double.parseDouble(pairs.getValue().toString()), script, pairs.getKey().toString()); } JFreeChart chart = ChartFactory.createBarChart(cliente, // chart title "Hora", // domain axis label "Duracin (milisegundos)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, false, // include legend true, false); CategoryPlot plot = chart.getCategoryPlot(); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); ChartPanel chartPanel = new ChartPanel(chart); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add((new JPanel()).add(chartPanel)); setContentPane(scrollPane); }
From source file:in.huohua.peterson.network.HttpRequest.java
public HttpRequest(final String url) { this(url, HTTP_METHOD_GET, new TreeMap<String, String>()); }