public static Map computeLevels( Map vertexLevelMap, DigraphIteration digraph, Object root, boolean longest) { if (vertexLevelMap == null) vertexLevelMap = new HashMap(); MutableInteger rootLevel = (MutableInteger) vertexLevelMap.get(root); if (rootLevel == null) { rootLevel = new MutableInteger(0); vertexLevelMap.put(root, rootLevel); } for (ArcIterator i = digraph.outgoingIterator(root); i.hasNext(); ) { i.next(); Object child = i.getDestination(); int childLevelCandidate = rootLevel.intValue() + 1; MutableInteger childLevel = (MutableInteger) vertexLevelMap.get(child); if (childLevel == null) { childLevel = new MutableInteger(childLevelCandidate); vertexLevelMap.put(child, childLevel); computeLevels(vertexLevelMap, digraph, child, longest); } else if ((longest && childLevel.intValue() < childLevelCandidate) || (!longest && childLevel.intValue() > childLevelCandidate)) { childLevel.setValue(childLevelCandidate); computeLevels(vertexLevelMap, digraph, child, longest); } } return vertexLevelMap; }
/** * Return the request parameters as a Map<String,String>. Only the first value of multivalued * parameters is included. */ Map<String, String> getParamsAsMap() { Map<String, String> map = new HashMap<String, String>(); for (Enumeration en = req.getParameterNames(); en.hasMoreElements(); ) { String name = (String) en.nextElement(); map.put(name, req.getParameter(name)); } return map; }
static { noRoleParams.put(ROLE_USER_ADMIN, "noadmin"); noRoleParams.put(ROLE_CONTENT_ADMIN, "nocontent"); noRoleParams.put(ROLE_AU_ADMIN, "noau"); noRoleParams.put(ROLE_DEBUG, "nodebug"); }