List of usage examples for org.apache.commons.collections MultiHashMap MultiHashMap
public MultiHashMap()
From source file:org.rzo.yajsw.os.ms.win.w32.WindowsXPProcess.java
/** * Gets the process maps./*w ww . j a va 2s . com*/ * * @param pid * the pid * * @return the process maps */ public static Map[] getProcessMaps(int pid) { Map processMap = new HashMap(); Map childrenMap = new MultiHashMap(); Map[] result = new Map[] { processMap, childrenMap }; Pointer processes = MyKernel32.INSTANCE.CreateToolhelp32Snapshot(MyKernel32.TH32CS_SNAPPROCESS, 0); if (processes == null) { System.out.println("task list empty "); return result; } PROCESSENTRY32 me = new PROCESSENTRY32(); me.szExeFile = new char[MyKernel32.MAX_PATH]; int size = me.size(); // System.out.println("size: " + size); me.dwSize = size; if (MyKernel32.INSTANCE.Process32First(processes, me)) { do { //System.out.println(/* new String(next.szExeFile) + */" " + me.th32ModuleID + " " + me.th32DefaultHeapID + " " + me.th32ProcessID // + " -> " + me.th32ParentProcessID); if (me.th32ProcessID > 0) processMap.put(new Integer(me.th32ProcessID), me); if (me.th32ParentProcessID > 0 && processMap.get(new Integer(me.th32ParentProcessID)) != null) { childrenMap.put(new Integer(me.th32ParentProcessID), new Integer(me.th32ProcessID)); } // else // System.out.println("not added"); } while (MyKernel32.INSTANCE.Process32Next(processes, me)); } else System.out.println("cannot access first process in list "); MyKernel32.INSTANCE.CloseHandle(processes); return result; }
From source file:org.unigram.likelike.lsh.TestLSHRecommendations.java
private boolean dfsCheck(Configuration conf, Path outputPath) throws IOException { FileSystem fs = FileSystem.getLocal(conf); Path[] outputFiles = FileUtil.stat2Paths(fs.listStatus(outputPath, new OutputLogFilter())); for (Path outputFile : outputFiles) { if (!outputFile.getName().startsWith("part-")) { continue; }/*from ww w . j av a2 s .c o m*/ BufferedReader reader = this.asBufferedReader(fs.open(outputFile)); String line; MultiHashMap resultMap = new MultiHashMap(); while ((line = reader.readLine()) != null) { String[] lineArray = line.split("\t"); resultMap.put(Long.parseLong(lineArray[0]), // target Long.parseLong(lineArray[1])); // recommended } this.check(resultMap); return true; } return false; }
From source file:phex.download.log.LogBuffer.java
public LogBuffer(long maxSize) { this.maxSize = maxSize; totalSize = 0;/*ww w .j a va 2s . com*/ buffer = new UnboundedFifoBuffer(); ownerMap = new MultiHashMap(); }
From source file:salomon.engine.platform.data.tree.TreeManager.java
/** * Method builds the tree basing on its database definition. * // w w w .j a v a2 s . co m * @param tree * @throws PlatformException */ private void buildTree(Tree tree) throws PlatformException { TreeInfo treeInfo = (TreeInfo) tree.getInfo(); // loading nodes List<TreeNodeInfo> nodeInfos = treeInfo.getNodes(); // loading attribute set AttributeSet attributeSet = (AttributeSet) _attributeManager.getAttributeSet(treeInfo.getAttributeSetID()); // getting attribute desciptions AttributeDescription[] descriptions = attributeSet.getDesciptions(); // putting attributes to the map to speed up searching Map<Integer, AttributeDescription> attributeMap = new HashMap<Integer, AttributeDescription>(); for (AttributeDescription description : descriptions) { attributeMap.put(description.getDescriptionID(), description); } // getting root node // according to the sorting order, it is the first node in the list od nodes // it is removed to avoid complications while building tree TreeNodeInfo rootNodeInfo = nodeInfos.remove(0); TreeNode rootNode = new TreeNode(tree, attributeMap.get(rootNodeInfo.getAttributeItemID()), rootNodeInfo); // setting root node for given tree tree.setRootNode(rootNode); // creating nodes MultiMap nodesMap = new MultiHashMap(); for (TreeNodeInfo nodeInfo : nodeInfos) { AttributeDescription description = attributeMap.get(nodeInfo.getAttributeItemID()); TreeNode treeNode = new TreeNode(tree, description, nodeInfo); // put it in map? // putting node to the map // it is indexed by parent node id (thats why root node was removed, cause it's parent id == 0 nodesMap.put(treeNode.getInfo().getParentNodeID(), treeNode); } // getting all child nodes starting from the root node connectNodes(nodesMap, rootNode); }