List of usage examples for java.util Hashtable get
@SuppressWarnings("unchecked") public synchronized V get(Object key)
From source file:bide.simulation.Simulation.java
private static void generateGelFile(String fName, String simDir, double limDet, double spotSd, Hashtable<String, double[]> setupTable) { double[] setupMean = setupTable.get("setupMean"); double[] setupDelta = setupTable.get("setupDelta"); double[] setupPi = setupTable.get("setupPi"); double[] setupRho = setupTable.get("setupRho"); try {// w ww . j ava 2 s . c om StringBuilder sb = new StringBuilder(System.getProperty("user.dir")).append(FILE_SEP).append(simDir) .append(FILE_SEP).append(fName).append(FILE_SEP); System.out.println(sb.toString()); checkDir(sb, false); sb.append(fName); String simLog = sb.toString() + ".log"; PrintWriter outLog = new PrintWriter(new BufferedWriter(new FileWriter(simLog))); String simFile = sb.toString() + ".csv"; PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(simFile))); GelSetting g = new GelSetting(noSpotPerGroup); out.println(g.createLabel()); for (int i = 0; i < totalSpot; i++) { String info = i + "\t" + setupMean[i] + "\t" + setupDelta[i] + "\t" + Transformation.invLogit(setupPi[i]) + "\t" + Transformation.invLogit(setupPi[i] + setupRho[i]); System.out.println(info); outLog.println(info); g = new GelSetting(noSpotPerGroup, setupMean[i], setupDelta[i], setupPi[i], setupRho[i], spotSd); g.setLimDet(limDet); out.println(GelSetting.printGel(i, g.generateSpot())); } out.close(); outLog.close(); } catch (Exception e) { e.printStackTrace(); } System.out.println("END"); }
From source file:Main.java
public static Hashtable<Integer, Vector<Integer>> getNodeMembership(final Vector<Vector<Integer>> CmtyVV) { Hashtable<Integer, Vector<Integer>> NIDComVH = new Hashtable<Integer, Vector<Integer>>(); for (int CID = 0; CID < CmtyVV.size(); CID++) { for (Integer NID : CmtyVV.get(CID)) { if (!NIDComVH.contains(NID)) { Vector<Integer> v = new Vector<Integer>(); v.add(CID);//w w w .ja va 2s. c o m NIDComVH.put(NID, v); } else { Vector<Integer> v = NIDComVH.get(NID); v.add(CID); NIDComVH.put(NID, v); } } } return NIDComVH; }
From source file:Utilities.java
/** * Converts the specified <code>Hashtable</code> into a string by putting * each key and value on a separate line (separated by '\n') and an arrow * (" -> ") between them./* ww w.j a va 2s .c om*/ */ public static String hashtableToString(Hashtable hashtable) { StringBuffer buf = new StringBuffer(); Enumeration keys = hashtable.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = hashtable.get(key); buf.append(key.toString()); buf.append(" -> "); buf.append(value.toString()); buf.append("\n"); } return buf.toString(); }
From source file:com.modeln.build.ctrl.charts.CMnPatchCountChart.java
/** * Create a chart representing the number of patches per customer. * The data is passed in as a hashtable where the key is the customer * information and the value is the number of patch requests. * * @param data Hashtable containing accounts and the corresponding counts * @param label Count label/* ww w . j a va 2 s . co m*/ * * @return Bar chart repesenting the customer and count information */ public static final JFreeChart getPatchesByCustomerChart(Hashtable<CMnAccount, Integer> data, String label) { Hashtable<String, Integer> hash = new Hashtable<String, Integer>(); Enumeration accountList = data.keys(); while (accountList.hasMoreElements()) { CMnAccount account = (CMnAccount) accountList.nextElement(); Integer value = data.get(account); hash.put(account.getName(), value); } return getBarChart(hash, label + " by Customer", "Customer", label); }
From source file:com.church.tools.ChartTools.java
/** * Generate pie chart./*from ww w. java 2s . c o m*/ * * @param title the title * @param values the values * @param captions the captions * @param width the width * @param height the height * @param color the color * * @return the buffered image */ public static BufferedImage GeneratePieChart(String title, double[] values, String[] captions, int width, int height, Color color) { BufferedImage bufferedImage = null; DefaultPieDataset pieDataset = new DefaultPieDataset(); Hashtable<String, String> ht = new Hashtable<String, String>(); for (int i = 0; i < values.length; i++) ht.put(captions[i], Double.toString(values[i])); Enumeration<String> enu = ht.keys(); int i = 0; while (enu.hasMoreElements()) { String str = (String) enu.nextElement(); pieDataset.setValue(str, new Double(Double.parseDouble((String) ht.get(str)))); i++; } JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false, false, false); chart.setBackgroundPaint(color); bufferedImage = chart.createBufferedImage(width, height); return bufferedImage; }
From source file:edu.ucsb.nceas.metacat.util.RequestUtil.java
/** * Forward a request that was received by this servlet on to another JSP * page or servlet to continue handling the request. In this case, the page * must be referenced in a paramter named "forwardto". If the qformat is * provided, the file will be retrieved from that skin. Otherwise, the file * will be retrieved from the system default skin. * // w w w . j a v a 2 s. com * For more specific file location, use: forwardRequest(request,response, destinationUrl, params) * * @param request * to be forwarded * @param response * that can be used for writing output to the client * @param params * the request parameters. these will be added to the request. */ public static void forwardRequest(HttpServletRequest request, HttpServletResponse response, Hashtable<String, String[]> params) throws MetacatUtilException { String forwardTos[] = params.get("forwardto"); if (forwardTos == null || forwardTos[0].equals("")) { throw new MetacatUtilException( "RequestUtil.forwardRequest - forwardto must be set in parameters when forwarding."); } String forwardTo = forwardTos[0]; String qformat = null; String qformats[] = params.get("qformat"); if (qformats == null || qformats.length == 0) { try { qformat = PropertyService.getProperty("application.default-style"); } catch (PropertyNotFoundException pnfe) { qformat = "default"; logMetacat.warn("RequestUtil.forwardRequest - could not get property " + "'application.default-style'. Using 'default'"); } } else { qformat = qformats[0]; } String destinationUrl = "/style/skins/" + qformat + "/" + forwardTo; destinationUrl += "?" + paramsToQuery(params); logMetacat.debug("RequestUtil.forwardRequest - Forwarding request to " + destinationUrl); ServletContext servletContext = request.getSession().getServletContext(); try { servletContext.getRequestDispatcher(destinationUrl).forward(request, response); } catch (IOException ioe) { throw new MetacatUtilException("RequestUtil.forwardRequest - I/O error when forwarding to " + destinationUrl + " : " + ioe.getMessage()); } catch (ServletException se) { throw new MetacatUtilException("RequestUtil.forwardRequest - Servlet error when forwarding to " + destinationUrl + " : " + se.getMessage()); } }
From source file:io.card.development.recording.Recording.java
private static Hashtable<String, byte[]> findManifestFiles(Hashtable<String, byte[]> recordingFiles) { Hashtable<String, byte[]> manifestFiles = new Hashtable<String, byte[]>(); Enumeration<String> fileNames = recordingFiles.keys(); while (fileNames.hasMoreElements()) { String fileName = fileNames.nextElement(); if (fileName.endsWith("manifest.json")) { manifestFiles.put(fileName, recordingFiles.get(fileName)); }// w w w . j av a 2 s .co m } return manifestFiles; }
From source file:unalcol.termites.boxplots.HybridGlobalInfoReport.java
private static void createChart(Hashtable<String, XYSeriesCollection> dataCollected) { System.out.println("dc" + dataCollected); for (String key : dataCollected.keySet()) { JFreeChart chart = ChartFactory.createXYLineChart(key, "Round number", "GlobalInfo", dataCollected.get(key), PlotOrientation.VERTICAL, true, true, false); XYPlot xyPlot = (XYPlot) chart.getPlot(); NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis(); domain.setRange(0.0, 10000.0);/*from w w w.j av a 2 s . com*/ FileOutputStream output; try { System.out.println("Key: " + key); output = new FileOutputStream(key + mazeMode + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 400, 400, null); } catch (FileNotFoundException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ECALAgentsRight.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:fr.paris.lutece.plugins.search.solr.web.SolrSearchApp.java
private static void isSwitched(String strFacetQuery, Hashtable<String, Boolean> tabType) { if (strFacetQuery != null && tabType != null && tabType.containsKey(strFacetQuery) && tabType.get(strFacetQuery) == Boolean.FALSE) { tabType.remove(strFacetQuery);// ww w.j a va 2 s . c om tabType.put(strFacetQuery, Boolean.TRUE); } }
From source file:com.softlayer.messaging.messagequeue.client.Client.java
/** * adds query string params/*from w ww . j a v a 2 s. c om*/ * * @param params * a key value pair of query string params * @param requestResource * the client request resource to set the query string to */ private static void addRequestParams(Hashtable<String, String> params, ClientResource requestResource) { Enumeration<String> en = params.keys(); while (en.hasMoreElements()) { String key = en.nextElement(); String value = params.get(key); requestResource.getReference().addQueryParameter(key, value); } }