List of usage examples for java.util LinkedHashMap get
public V get(Object key)
From source file:eu.hydrologis.jgrass.charting.impl.JGrassXYBarChart.java
/** * A line chart creator basing on series made up two values per row. More series, independing * one from the other are supported./*www . j a v a 2 s . com*/ * * @param chartValues - a hashmap containing as keys the name of the series and as values the * double[][] representing the data. Important: the data matrix has to be passed as two * rows (not two columns) * @param barwidth */ public JGrassXYBarChart(LinkedHashMap<String, double[][]> chartValues, double barwidth) { chartSeries = new XYSeries[chartValues.size()]; // extrapolate the data from the Hashmap and convert it to a XYSeries // Collection Iterator<String> it = chartValues.keySet().iterator(); int count = 0; while (it.hasNext()) { String key = it.next(); double[][] values = chartValues.get(key); chartSeries[count] = new XYSeries(key); for (int i = 0; i < values[0].length; i++) { // important: the data matrix has to be passed as two rows (not // two columns) double val = values[1][i]; if (isNovalue(val)) continue; chartSeries[count].add(values[0][i], val); } count++; } barDataset = new XYSeriesCollection(); for (int i = 0; i < chartSeries.length; i++) { barDataset.addSeries(chartSeries[i]); } dataset = new XYBarDataset(barDataset, barwidth); }
From source file:com.predic8.membrane.core.interceptor.apimanagement.ApiManagementConfiguration.java
private Map<String, Key> parsePoliciesForKeys(Map<String, Object> yaml) { Map<String, Key> result = new HashMap<String, Key>(); // assumption: the yaml is valid List<Object> keys = (List<Object>) yaml.get("keys"); for (Object keyObject : keys) { LinkedHashMap<String, Object> key = (LinkedHashMap<String, Object>) keyObject; Key keyRes = new Key(); String keyName = (String) key.get("key"); keyRes.setName(keyName);//from w ww . java 2s. c o m List<Object> policiesForKey = (List<Object>) key.get("policies"); HashSet<Policy> policies = new HashSet<Policy>(); for (Object polObj : policiesForKey) { String policyName = (String) polObj; Policy p = this.policies.get(policyName); policies.add(p); } keyRes.setPolicies(policies); result.put(keyName, keyRes); } return result; }
From source file:gemlite.shell.commands.admin.Monitor.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @CliCommand(value = "list services", help = "list services") public String services() { Set<ObjectInstance> names = jmxSrv.listMBeans(); List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); if (names == null) return "no services"; Object[] a = names.toArray(); //???/*from w w w.j a v a 2 s . c om*/ Arrays.sort(a, (Comparator) new Comparator<ObjectInstance>() { @Override public int compare(ObjectInstance o1, ObjectInstance o2) { return (o1.getObjectName().toString()).compareTo(o2.getObjectName().toString()); } }); if (LogUtil.getCoreLog().isDebugEnabled()) LogUtil.getCoreLog().debug("get names size:{} values:{}", names.size(), names.toString()); //?service? for (int i = 0; i < a.length; i++) { ObjectInstance oi = (ObjectInstance) a[i]; // service?,??? HashMap<String, Object> service = new HashMap<String, Object>(); service.put(oi.getObjectName().toString(), service); service.put("serviceName", service); try { Map<String, Object> map = jmxSrv.getAttributesValues(oi.getObjectName().toString()); if (map.size() <= 0) { map.put("serviceName", oi.getObjectName().toString()); LogUtil.getCoreLog().warn("jmxSrv.getAttributesValues is null ,ObjectName {}", oi.getObjectName().toString()); result.add(map); } else { result.add(map); } } catch (Exception e) { LogUtil.getCoreLog().error("jmxSrv.getAttributesValues is null ,ObjectName {},error:{}", oi.getObjectName().toString(), e); } } LinkedHashMap<String, HashMap<String, Object>> rs = (LinkedHashMap<String, HashMap<String, Object>>) get( CommandMeta.LIST_SERVICES); if (rs == null) rs = new LinkedHashMap<String, HashMap<String, Object>>(); for (Map<String, Object> map : result) { // ? HashMap<String, Object> service = rs.get(map.get("serviceName")); if (service == null) { service = new HashMap<String, Object>(); } service.putAll(map); // ? rs.put((String) map.get("serviceName"), service); } // ws?? put(CommandMeta.LIST_SERVICES, rs); if (!result.isEmpty()) return result.toString(); return "no services"; }
From source file:eu.hydrologis.jgrass.charting.impl.JGrassXYLineChart.java
/** * A line chart creator basing on series made up two values per row. More series, independing * one from the other are supported.//from ww w. j a va2 s .c om * * @param chartValues - a hashmap containing as keys the name of the series and as values the * double[][] representing the data. Important: the data matrix has to be passed as two * rows (not two columns) */ public JGrassXYLineChart(LinkedHashMap<String, double[][]> chartValues) { chartSeries = new XYSeries[chartValues.size()]; // extrapolate the data from the Hashmap and convert it to a XYSeries // Collection final Iterator<String> it = chartValues.keySet().iterator(); int count = 0; while (it.hasNext()) { final String key = it.next(); final double[][] values = chartValues.get(key); chartSeries[count] = new XYSeries(key); for (int i = 0; i < values[0].length; i++) { // important: the data matrix has to be passed as two rows (not // two columns) double val = values[1][i]; if (isNovalue(val)) continue; chartSeries[count].add(values[0][i], val); } count++; } lineDataset = new XYSeriesCollection(); for (int i = 0; i < chartSeries.length; i++) { lineDataset.addSeries(chartSeries[i]); } }
From source file:com.concursive.connect.web.modules.wiki.utils.WikiToHTMLUtils.java
public static String getHTML(WikiToHTMLContext context, Connection db) { String content = context.getWiki().getContent(); if (content == null) { return null; }// w w w.jav a 2 s. co m // Chunk the content into manageable pieces LinkedHashMap<String, String> chunks = chunkContent(content, context.isEditMode()); StringBuffer sb = new StringBuffer(); for (String type : chunks.keySet()) { String chunk = chunks.get(type); LOG.trace("========= CHUNK [" + type + "] ========="); if (type.endsWith(CONTENT_PREFORMATTED)) { if (!context.canAppend()) { continue; } LOG.trace(chunk); if (type.endsWith(CONTENT_CODE + "remove-test")) { sb.append("<code>"); } else { sb.append("<pre>"); } sb.append(chunk); if (type.endsWith(CONTENT_CODE + "remove-test")) { sb.append("</code>"); } else { sb.append("</pre>"); } sb.append(CRLF); } else if (type.endsWith(CONTENT_NEEDS_FORMATTING)) { String formatted = getHTML(context, db, chunk); LOG.trace(formatted); sb.append(formatted); } } return sb.toString(); // Tables (With linewraps) // Header || // Cell | // Ordered List // * // ** // Unordered List // # // ## // Links // [[Wiki link]] // [[Wiki Link|Renamed]] // [[http://external]] // Images // [[Image:Filename.jpg]] // [[Image:Filename.jpg|A caption]] // [[Image:Filename.jpg|link=wiki]] // [[Image:Filename.jpg|thumb]] // [[Image:Filename.jpg|right]] // [[Image:Filename.jpg|left]] // Videos // [[Video:http://www.youtube.com/watch?v=3LkNlTNHZzE]] // [[Video:http://www.ustream.tv/flash/live/1/371673]] // [[Video:http://www.justin.tv/vasalini]] // [[Video:http://www.livestream.com/spaceflightnow]] // [[Video:http://qik.com/zeroio]] // Forms // [{form name="wikiForm"}] // --- // [{group value="New Group" display="false"}] // --- // [{label value="This is a text field" display="false"}] // [{field type="text" name="cf10" maxlength="30" size="30" value="" required="false"}] // [{description value="This is the text to display after"}] // +++ }
From source file:jp.primecloud.auto.api.ApiFilter.java
/** * * URI(Signature????)?//from w w w .j a v a 2 s. co m * * @param decodeParamMap base64?? * @param uri URI() * @return ???URL(Signature????) */ private String createUriQueryParams(LinkedHashMap<String, String> decodeParamMap, URI uri) { String baseUriText = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?"; StringBuffer uriText = new StringBuffer(baseUriText); String splitChar = ""; for (String key : decodeParamMap.keySet()) { if (PARAM_NAME_SIGNATURE.equals(key) == false) { uriText.append(splitChar + key + "=" + decodeParamMap.get(key)); splitChar = "&"; } } return uriText.toString(); }
From source file:cm.confide.ex.chips.BaseRecipientAdapter.java
private static void putOneEntry(TemporaryEntry entry, boolean isAggregatedEntry, LinkedHashMap<Long, List<RecipientEntry>> entryMap, List<RecipientEntry> nonAggregatedEntries, Set<String> existingDestinations) { if (existingDestinations.contains(entry.destination)) { return;/*from www . j a va 2 s . co m*/ } existingDestinations.add(entry.destination); if (!isAggregatedEntry) { nonAggregatedEntries.add(RecipientEntry.constructTopLevelEntry(entry.displayName, entry.displayNameSource, entry.destination, entry.destinationType, entry.destinationLabel, entry.contactId, entry.dataId, entry.thumbnailUriString, true, entry.isGalContact)); } else if (entryMap.containsKey(entry.contactId)) { // We already have a section for the person. final List<RecipientEntry> entryList = entryMap.get(entry.contactId); entryList.add(RecipientEntry.constructSecondLevelEntry(entry.displayName, entry.displayNameSource, entry.destination, entry.destinationType, entry.destinationLabel, entry.contactId, entry.dataId, entry.thumbnailUriString, true, entry.isGalContact)); } else { final List<RecipientEntry> entryList = new ArrayList<RecipientEntry>(); entryList.add(RecipientEntry.constructTopLevelEntry(entry.displayName, entry.displayNameSource, entry.destination, entry.destinationType, entry.destinationLabel, entry.contactId, entry.dataId, entry.thumbnailUriString, true, entry.isGalContact)); entryMap.put(entry.contactId, entryList); } }
From source file:net.sf.jasperreports.engine.fill.DelayedFillActions.java
protected LinkedMap<Object, EvaluationBoundAction> pageActionsMap( LinkedHashMap<FillPageKey, LinkedMap<Object, EvaluationBoundAction>> map, FillPageKey pageKey) { LinkedMap<Object, EvaluationBoundAction> pageMap = map.get(pageKey); if (pageMap == null) { pageMap = new LinkedMap<Object, EvaluationBoundAction>(); map.put(pageKey, pageMap);/*from w ww. j av a 2s. c om*/ registerPage(pageKey.page); } return pageMap; }
From source file:com.hp.saas.agm.service.EntityService.java
private String orderToString(EntityQuery query) { StringBuffer buf = new StringBuffer(); LinkedHashMap<String, SortOrder> order = query.getOrder(); for (String name : order.keySet()) { if (buf.length() > 0) { buf.append("; "); }//from ww w . j a v a2 s . c o m buf.append(name); buf.append("["); buf.append(order.get(name) == SortOrder.ASCENDING ? "ASC" : "DESC"); buf.append("]"); } return buf.toString(); }