List of usage examples for org.apache.commons.collections MultiMap containsKey
boolean containsKey(Object key);
From source file:edu.wustl.geneconnect.metadata.MetadataCalculator.java
/** * Add to multi map/* w w w . jav a 2 s. c o m*/ * Key is the source node IDs * @param fromNodeID * @param toNodeID * @param usingNodeID */ private void updatePath(int fromNodeID, int toNodeID, int usingNodeID) { if (fromNodeID == toNodeID) { return; } // Get all paths from 'fromNodeID' MultiMap pathMap = getPathsForSrc(fromNodeID); if (pathMap.containsKey(new Integer(usingNodeID))) { // Get all possible paths from 'fromNodeID' to 'usingNodeID' Collection coll = (Collection) pathMap.get(new Integer(usingNodeID)); if (null != coll) { for (Iterator iter = coll.iterator(); iter.hasNext();) { List l1 = (List) iter.next(); List newNodeList = new ArrayList(); // Check for cyclicity (i.e.) the path should NOT contain 'toNodeID' if (!l1.contains(new Integer(toNodeID))) { // Append each path to the 'toNodeID' for (Iterator iter1 = l1.iterator(); iter1.hasNext();) { newNodeList.add(iter1.next()); } // now add 'toNodeID' as the last element newNodeList.add(new Integer(toNodeID)); // Add this entry to the map after checking that it is not already present if (!isPathPresent(fromNodeID, toNodeID, newNodeList)) { pathMap.put(new Integer(toNodeID), newNodeList); } } } } } else { // This should ideally never happen } }
From source file:org.squashtest.tm.web.internal.controller.requirement.VerifyingTestCaseManagerController.java
@ResponseBody @SuppressWarnings("unchecked") @RequestMapping(value = "/requirement-versions/{requirementVersionId}/coverage-stats", method = RequestMethod.GET, params = { "perimeter" }) public RequirementCoverageStat getCoverageStat(@PathVariable long requirementVersionId, @RequestParam String perimeter) { LOGGER.debug("JTH go controller go"); MultiMap mapIdsByType = JsTreeHelper.mapIdsByType(new String[] { perimeter }); List<Long> iterationIds = new ArrayList<>(); RequirementCoverageStat stat = new RequirementCoverageStat(); if (mapIdsByType.containsKey(campaign_name)) { List<Long> ids = (List<Long>) mapIdsByType.get(campaign_name); try {/*w ww. ja v a2s. c o m*/ //Only one selected node for v1.13... Campaign campaign = campaignFinder.findById(ids.get(0)); iterationIds.addAll(getIterationsIdsForCampagain(campaign)); } catch (IdentityUnavailableException e) { stat.setCorruptedPerimeter(true); } } if (mapIdsByType.containsKey(iteration_name)) { List<Long> ids = (List<Long>) mapIdsByType.get(iteration_name); iterationIds.addAll(ids); } verifiedRequirementsManagerService.findCoverageStat(requirementVersionId, iterationIds, stat); return stat; }