List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:org.springframework.cloud.stream.binder.pubsub.PubSubMessageListener.java
private Map<String, Object> decodeAttributes(Map<String, String> attributes) { Map<String, Object> headers = new HashMap<>(); if (attributes.get(PubSubBinder.SCST_HEADERS) != null) { try {/*from w w w . j ava 2s .c o m*/ headers.putAll(mapper.readValue(attributes.get(PubSubBinder.SCST_HEADERS), Map.class)); } catch (IOException e) { logger.error("Could not deserialize SCST_HEADERS"); } } return headers; }
From source file:com.act.analysis.surfactant.SurfactantAnalysis.java
/** * Perform all analysis for a molecule, returning a map of all available features. * @param inchi The molecule to analyze. * @param display True if the molecule should be displayed; set to false for non-interactive analysis. * @return A map of all features for this molecule. * @throws Exception//from w w w . j ava 2s.co m */ public static Map<FEATURES, Double> performAnalysis(String inchi, boolean display) throws Exception { SurfactantAnalysis surfactantAnalysis = new SurfactantAnalysis(); surfactantAnalysis.init(inchi); // Start with simple structural analyses. Pair<Integer, Integer> farthestAtoms = surfactantAnalysis.findFarthestContributingAtomPair(); Double longestVectorLength = surfactantAnalysis.computeDistance(farthestAtoms.getLeft(), farthestAtoms.getRight()); // Then compute the atom distances to the longest vector (lv) and produce lv-normal planes at each atom. Pair<Map<Integer, Double>, Map<Integer, Plane>> results = surfactantAnalysis .computeAtomDistanceToLongestVectorAndNormalPlanes(); // Find the max distance so we can calculate the maxDist/|lv| ratio, or "skinny" factor. double maxDistToLongestVector = 0.0; Map<Integer, Double> distancesToLongestVector = results.getLeft(); for (Map.Entry<Integer, Double> e : distancesToLongestVector.entrySet()) { maxDistToLongestVector = Math.max(maxDistToLongestVector, e.getValue()); } // A map of the molecule features we'll eventually output. Map<FEATURES, Double> features = new HashMap<>(); // Explore the lv endpoint and min/max logP atom neighborhoods, and merge those features into the complete map. Map<FEATURES, Double> neighborhoodFeatures = surfactantAnalysis.exploreExtremeNeighborhoods(); features.putAll(neighborhoodFeatures); /* Perform regression analysis on the projection of the molecules onto lv, where their y-axis is their logP value. * Higher |slope| may mean more extreme logP differences at the ends. */ Double slope = surfactantAnalysis.performRegressionOverLVProjectionOfLogP(); /* Compute the logP surface of the molecule (seems to require a JFrame?), and collect those features. We consider * the number of closest surface components to each atom so we can guess at how much interior atoms actually * contribute to the molecule's solubility. */ JFrame jFrame = new JFrame(); jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Map<FEATURES, Double> surfaceFeatures = surfactantAnalysis.computeSurfaceFeatures(jFrame, true); features.putAll(surfaceFeatures); features.put(FEATURES.LOGP_TRUE, surfactantAnalysis.plugin.getlogPTrue()); // Save absolute logP since we calculated it. features.put(FEATURES.GEO_LV_FD_RATIO, maxDistToLongestVector / longestVectorLength); features.put(FEATURES.REG_ABS_SLOPE, slope); Map<FEATURES, Double> additionalFeatures = surfactantAnalysis.calculateAdditionalFilteringFeatures(); features.putAll(additionalFeatures); List<FEATURES> sortedFeatures = new ArrayList<>(features.keySet()); Collections.sort(sortedFeatures); // Print these for easier progress tracking. System.out.format("features:\n"); for (FEATURES f : sortedFeatures) { System.out.format(" %s = %f\n", f, features.get(f)); } if (display) { jFrame.pack(); jFrame.setVisible(true); } return features; }
From source file:io.rhiot.cloudplatform.service.device.MongoDbDeviceRegistry.java
@Override public void update(Device device) { Device existingDevice = get(device.getDeviceId()); Map existingDeviceMap = objectMapper.convertValue(existingDevice, Map.class); existingDeviceMap.putAll(objectMapper.convertValue(device, Map.class)); devicesCollection().save(deviceToDbObject(objectMapper.convertValue(existingDeviceMap, Device.class))); }
From source file:alluxio.cli.AlluxioFrameworkIntegrationTest.java
private void startAlluxioFramework(Map<String, String> extraEnv) { String startScript = PathUtils.concatPath(Configuration.get(PropertyKey.HOME), "integration", "mesos", "bin", "alluxio-mesos-start.sh"); ProcessBuilder pb = new ProcessBuilder(startScript, mMesosAddress); Map<String, String> env = pb.environment(); env.putAll(extraEnv); try {/*from w ww .j av a 2 s. c o m*/ pb.start().waitFor(); } catch (Exception e) { LOG.info("Failed to launch Alluxio on Mesos. Note that this test requires that " + "Mesos is currently running."); throw new RuntimeException(e); } }
From source file:com.adobe.acs.commons.forms.impl.FormImpl.java
@Override public ValueMap getValueMap() { final Map<String, Object> map = new HashMap<String, Object>(); map.putAll(this.data); return new ValueMapDecorator(map); }
From source file:com.adobe.acs.commons.forms.impl.FormImpl.java
@Override public ValueMap getErrorsValueMap() { final Map<String, Object> map = new HashMap<String, Object>(); map.putAll(this.errors); return new ValueMapDecorator(map); }
From source file:de.thischwa.pmcms.server.EditorServlet.java
@Override protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String idString = req.getParameter("id"); Integer id = (StringUtils.isNotBlank(idString)) ? Integer.valueOf(idString) : null; Class<?> cls = ContextUtil.getClass(req); APoormansObject<?> po;/*from ww w. j a v a 2 s.co m*/ if (id != null && id != APoormansObject.UNSET_VALUE) po = siteHolder.get(id); else try { po = (APoormansObject<?>) cls.newInstance(); } catch (Exception e) { throw new IOExceptionWithCause(e); } if (InstanceUtil.isSiteResource(po)) { try { String html = velocityRenderer.render((ASiteResource) po); resp.getWriter().append(html); } catch (RenderingException e) { throw new IOExceptionWithCause(e); } } else { Page page = (Page) po; logger.debug("Try to create an editor for: " + page); PojoHelper pojoHolder = new PojoHelper(); pojoHolder.putpo(page); Map<String, Object> addObjs = new HashMap<String, Object>(); addObjs.put("editor", new CKEditorWrapper(PoInfo.getSite(page), req)); Map<String, Object> ctxObjs = ContextObjectManager.get(pojoHolder, ViewMode.EDIT); ctxObjs.putAll(addObjs); try { velocityRenderer.render(resp.getWriter(), page, ViewMode.EDIT, ctxObjs); } catch (RenderingException e) { throw new IOExceptionWithCause(e); } } resp.setHeader("Cache-Control", "no-cache"); }
From source file:org.trustedanalytics.servicebroker.gearpump.service.externals.helpers.ExternalProcessExecutor.java
private void updateEnvOfProcessBuilder(Map<String, String> processBuilderEnv, Map<String, String> properties) { if (properties != null) { processBuilderEnv.putAll(properties); }//from ww w . j a v a 2 s. com }
From source file:com.rockagen.gnext.service.spring.KeyValueMapImpl.java
/** * Get the duplicate map/*from w w w . j a v a 2s. c om*/ * * @param key * @return */ public Map<String, String> getMap() { final Map<String, String> temp = new ConcurrentHashMap<String, String>(); temp.putAll(KEY_VALUE_MAP); return temp; }
From source file:com.revolsys.ui.web.config.PageRefMenuItem.java
@Override public String getUri() { final WebUiContext context = WebUiContext.get(); final Page referencedPage = getReferencedPage(); if (referencedPage != null) { final Map uriParams = new HashMap(); if (getStaticParameters() != null) { uriParams.putAll(getStaticParameters()); }/*from w w w .j av a 2s . c o m*/ for (final Iterator params = getParameters().entrySet().iterator(); params.hasNext();) { final Map.Entry param = (Map.Entry) params.next(); final Object key = param.getKey(); if (!uriParams.containsKey(key)) { final Object value = context.evaluateExpression((Expression) param.getValue()); uriParams.put(key, value); } } if (getAnchor() == null) { return referencedPage.getFullUrl(uriParams); } else { return referencedPage.getFullUrl(uriParams) + "#" + getAnchor(); } } else { return null; } }