List of usage examples for java.util TreeMap keySet
public Set<K> keySet()
From source file:pt.fct.di.benchmarks.TPCW_Riak.database.TPCW_Riak_Executor.java
public void AdminChange(int item_id) throws Exception { Item item = (Item) GSON.fromJson(getBucket("item").fetch(item_id + "").execute().getValueAsString(), Item.class); String dateString = item.getI_PUB_DATE(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date = formatter.parse(dateString); String subject = (String) item.getI_SUBJECT(); int author_id = (Integer) item.getI_AUTHOR(); String title = (String) item.getI_TITLE(); updateIndex(subject, date, item_id, title, author_id); Map<String, Map<String, Object>> orders = rangeQuery("order", null, 10000); Map<Integer, Integer> items_info = new TreeMap<Integer, Integer>(); for (Map<String, Object> orders_info : orders.values()) { boolean found = false; Collection<OrderLine> orderLines = (Collection<OrderLine>) orders_info.get("orderLines"); TreeMap<Integer, Integer> bought_items = new TreeMap<Integer, Integer>(); for (OrderLine order_line : orderLines) { int i_id = (Integer) order_line.getOL_I_ID(); if (i_id == item_id) { found = true;//from www . jav a 2 s. c o m } else { int item_qty = (Integer) order_line.getOL_QTY(); bought_items.put(i_id, item_qty); } } if (found == true) { for (Integer i_id : bought_items.keySet()) { if (items_info.containsKey(i_id)) { int current_qty = items_info.get(i_id); items_info.put(i_id, (bought_items.get(i_id) + current_qty)); } else { items_info.put(i_id, bought_items.get(i_id)); } } } } Map top_sellers = reverseSortByValue(items_info); List<Integer> best = new ArrayList<Integer>(); int num = 0; for (Iterator<Integer> it = top_sellers.keySet().iterator(); it.hasNext();) { int key = it.next(); best.add(key); num++; if (num == 5) break; } if (num < 5) { for (int i = num; i < 5; i++) { best.add(random.nextInt(990)); // the items are form 0 to 1000 // right? } } item.setPubDate(new Date(System.currentTimeMillis()).toString()); item.setI_IMAGE(new String("img" + random.nextInt(1000) % 100 + "/image_" + random.nextInt(1000) + ".gif")); item.setI_THUMBNAIL( new String("img" + random.nextInt(1000) % 100 + "/thumb" + random.nextInt(1000) + ".gif")); item.setI_RELATED1(best.get(0)); item.setI_RELATED2(best.get(1)); item.setI_RELATED3(best.get(2)); item.setI_RELATED4(best.get(3)); item.setI_RELATED5(best.get(4)); getBucket("item").store(item_id + "", GSON.toJson(item).toString()).execute(); }
From source file:net.pms.dlna.MapFile.java
@Override public void discoverChildren(String str) { if (discoverable == null) { discoverable = new ArrayList<>(); } else {//from w ww .j a va 2 s .c o m return; } int sm = configuration.getSortMethod(getPath()); List<File> files = getFileList(); // ATZ handling if (files.size() > configuration.getATZLimit() && StringUtils.isEmpty(forcedName)) { /* * Too many files to display at once, add A-Z folders * instead and let the filters begin * * Note: If we done this at the level directly above we don't do it again * since all files start with the same letter then */ TreeMap<String, ArrayList<File>> map = new TreeMap<>(); for (File f : files) { if ((!f.isFile() && !f.isDirectory()) || f.isHidden()) { // skip these continue; } if (f.isDirectory() && configuration.isHideEmptyFolders() && !FileUtil.isFolderRelevant(f, configuration)) { LOGGER.debug("Ignoring empty/non-relevant directory: " + f.getName()); // Keep track of the fact that we have empty folders, so when we're asked if we should refresh, // we can re-scan the folders in this list to see if they contain something relevant if (emptyFoldersToRescan == null) { emptyFoldersToRescan = new ArrayList<>(); } if (!emptyFoldersToRescan.contains(f)) { emptyFoldersToRescan.add(f); } continue; } String filenameToSort = FileUtil.renameForSorting(f.getName()); char c = filenameToSort.toUpperCase().charAt(0); if (!(c >= 'A' && c <= 'Z')) { // "other char" c = '#'; } ArrayList<File> l = map.get(String.valueOf(c)); if (l == null) { // new letter l = new ArrayList<>(); } l.add(f); map.put(String.valueOf(c), l); } for (String letter : map.keySet()) { // loop over all letters, this avoids adding // empty letters ArrayList<File> l = map.get(letter); UMSUtils.sort(l, sm); MapFile mf = new MapFile(getConf(), l); mf.forcedName = letter; addChild(mf); } return; } UMSUtils.sort(files, (sm == UMSUtils.SORT_RANDOM ? UMSUtils.SORT_LOC_NAT : sm)); for (File f : files) { if (f.isDirectory()) { discoverable.add(f); // manageFile(f); } } // For random sorting, we only randomize file entries if (sm == UMSUtils.SORT_RANDOM) { UMSUtils.sort(files, sm); } for (File f : files) { if (f.isFile()) { discoverable.add(f); // manageFile(f); } } }
From source file:davmail.imap.ImapConnection.java
/** * Send expunge untagged response for removed IMAP message uids. * * @param previousImapUidList uid list before refresh * @param imapUidList uid list after refresh * @throws IOException on error/*from w w w . j av a2 s . c o m*/ */ private void handleRefresh(TreeMap<Long, String> previousImapFlagMap, TreeMap<Long, String> imapFlagMap) throws IOException { // send deleted message expunge notification int index = 1; for (long previousImapUid : previousImapFlagMap.keySet()) { if (!imapFlagMap.keySet().contains(previousImapUid)) { sendClient("* " + index + " EXPUNGE"); } else { // send updated flags if (!previousImapFlagMap.get(previousImapUid).equals(imapFlagMap.get(previousImapUid))) { sendClient("* " + index + " FETCH (UID " + previousImapUid + " FLAGS (" + imapFlagMap.get(previousImapUid) + "))"); } index++; } } sendClient("* " + currentFolder.count() + " EXISTS"); sendClient("* " + currentFolder.recent + " RECENT"); }
From source file:com.jtstand.swing.StatsPanel.java
public JFreeChart getChartTime() { TreeMap<String, List<TestStepInstance>> s = getGroupedSteps(getFilteringIterator()); if (s == null || s.size() == 0) { return null; }//from w w w . jav a 2 s . c o m TimeSeriesCollection dataset = new TimeSeriesCollection(); for (Iterator<String> en = s.keySet().iterator(); en.hasNext();) { String groupName = en.next(); List<TestStepInstance> stps = s.get(groupName); // TimeSeries pop = new TimeSeries(groupName, Millisecond.class); TimeSeries pop = new TimeSeries(groupName); for (Iterator<TestStepInstance> it = stps.iterator(); it.hasNext();) { TestStepInstance step = it.next(); Number num = getNumber(step); if (num != null) { switch (chartMode) { case STEP_TIME: pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date(step.getStartTime()), TimeZone.getDefault()), num); break; case SEQUENCE_TIME: // pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date(step.getTestSequenceInstance().getStartTime()), RegularTimePeriod.DEFAULT_TIME_ZONE), num); pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date(step.getTestSequenceInstance().getCreateTime()), TimeZone.getDefault()), num); break; } } } dataset.addSeries(pop); } JFreeChart chart = null; switch (chartMode) { case STEP_TIME: chart = ChartFactory.createTimeSeriesChart(null, "Step Started Time", getValueString(), dataset, isGrouping(), true, false); break; case SEQUENCE_TIME: chart = ChartFactory.createTimeSeriesChart(null, "Sequence Started Time", getValueString(), dataset, isGrouping(), true, false); break; } chart.setBackgroundPaint((Paint) UIManager.get("Panel.background")); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer5 = new XYLineAndShapeRenderer(); renderer5.setBaseSeriesVisibleInLegend(false); plot.setRenderer(renderer5); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairVisible(true); // chart.setTitle(valueName); placeLimitMarkers(plot, true); //renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer5.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); /* coloring */ if (isCategorization()) { // TreeMap<String, Color> cmap = new TreeMap<String, Color>(); int i = 0; for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) { String groupName = it.next(); Color c = ChartCategories.getColor(i); for (int j = 0; j < dataset.getSeriesCount(); j++) { TimeSeries ts = dataset.getSeries(j); if (ts.getKey().equals(groupName)) { renderer5.setSeriesPaint(j, c); } } } } else { renderer5.setSeriesPaint(0, ChartCategories.getColor(0)); } // chart.addProgressListener(new ChartProgressListener() { // // public void chartProgress(final ChartProgressEvent progress) { // SwingUtilities.invokeLater( // new Runnable() { // // @Override // public void run() { // // System.out.println("progress:" + progress + " " + progress.getType()); // if (progress.getType() == ChartProgressEvent.DRAWING_FINISHED) { // if (plot != null) { // if (plot.isDomainCrosshairVisible() && plot.isDomainCrosshairLockedOnData()) { //// System.out.println("getDomainCrosshairValue:" + plot.getDomainCrosshairValue()); // double xx = plot.getDomainCrosshairValue(); // if (xx != 0.0) { // long x = (long) xx; // System.out.println(new Date(x)); // for (TestStepInstance step : testStepInstances.getSteps()) { // if (step.getStartTime() != null && step.getStartTime().equals(x)) { // testStepInstances.selectStep(step); // } // } // System.out.println(new Date(x)); // } // } //// if (plot.isRangeCrosshairVisible()) { //// System.out.println("getRangeCrosshairValue:" + plot.getRangeCrosshairValue()); //// } // } // } // } // }); // } // }); // chart.addChangeListener(new ChartChangeListener() { // // public void chartChanged(ChartChangeEvent event) { // System.out.println("event:" + event); // if (event != null) { //// JFreeChart chart = event.getChart(); //// System.out.println("chart:" + chart); //// if (chart != null) { //// System.out.println("title:" + event.getChart().getTitle()); //// } // System.out.println("type:" + event.getType()); // if (plot != null) { // if (plot.isDomainCrosshairVisible()) { // System.out.println("getDomainCrosshairValue:" + plot.getDomainCrosshairValue()); // long x = (long) plot.getDomainCrosshairValue(); // for (TestStepInstance step : testStepInstances.getSteps()) { // if (step.getStartTime() != null && step.getStartTime().equals(x)) { // testStepInstances.selectStep(step); // } // } // System.out.println(new Date(x)); // } // if (plot.isRangeCrosshairVisible()) { // System.out.println("getRangeCrosshairValue:" + plot.getRangeCrosshairValue()); // } // } // } // } // }); chart.setTextAntiAlias(false); return chart; }
From source file:com.cyberway.issue.net.UURIFactoryTest.java
/** * Tests from rfc2396 with amendments to accomodate differences * intentionally added to make our URI handling like IEs. * * <pre>//from www . ja v a2 s . c o m * g:h = g:h * g = http://a/b/c/g * ./g = http://a/b/c/g * g/ = http://a/b/c/g/ * /g = http://a/g * //g = http://g * ?y = http://a/b/c/?y * g?y = http://a/b/c/g?y * #s = (current document)#s * g#s = http://a/b/c/g#s * g?y#s = http://a/b/c/g?y#s * ;x = http://a/b/c/;x * g;x = http://a/b/c/g;x * g;x?y#s = http://a/b/c/g;x?y#s * . = http://a/b/c/ * ./ = http://a/b/c/ * .. = http://a/b/ * ../ = http://a/b/ * ../g = http://a/b/g * ../.. = http://a/ * ../../ = http://a/ * ../../g = http://a/g * </pre> * * @throws URIException */ public final void testRFC2396Relative() throws URIException { UURI base = UURIFactory.getInstance("http://a/b/c/d;p?q"); TreeMap<String, String> m = new TreeMap<String, String>(); m.put("..", "http://a/b/"); m.put("../", "http://a/b/"); m.put("../g", "http://a/b/g"); m.put("../..", "http://a/"); m.put("../../", "http://a/"); m.put("../../g", "http://a/g"); m.put("g#s", "http://a/b/c/g#s"); m.put("g?y#s ", "http://a/b/c/g?y#s"); m.put(";x", "http://a/b/c/;x"); m.put("g;x", "http://a/b/c/g;x"); m.put("g;x?y#s", "http://a/b/c/g;x?y#s"); m.put(".", "http://a/b/c/"); m.put("./", "http://a/b/c/"); m.put("g", "http://a/b/c/g"); m.put("./g", "http://a/b/c/g"); m.put("g/", "http://a/b/c/g/"); m.put("/g", "http://a/g"); m.put("//g", "http://g"); // CHANGED BY RFC3986 // m.put("?y", "http://a/b/c/?y"); m.put("g?y", "http://a/b/c/g?y"); // EXTRAS beyond the RFC set. // TODO: That these resolve to a path of /a/g might be wrong. Perhaps // it should be '/g'?. m.put("/../../../../../../../../g", "http://a/g"); m.put("../../../../../../../../g", "http://a/g"); m.put("../G", "http://a/b/G"); for (Iterator i = m.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); String value = (String) m.get(key); UURI uuri = UURIFactory.getInstance(base, key); assertTrue("Unexpected " + key + " " + value + " " + uuri, uuri.equals(UURIFactory.getInstance(value))); } }
From source file:semlink.apps.uvig.Generator.java
/** * Prints an HTML TD element containing the special word list for the frame * descriptions. This special list is constructed during the HTML generation * phase (see {@link uvi.Sweeper} class). * * @param title the title for the column * @see uvi.Generator#generateReferencePage() */// ww w .ja va 2 s. c om private static void printReferenceColumnSpecial(String title) { Q.oh(4, "<TD width='50%' colspan='2' class='RefTable2'>"); Q.oh(5, "<TABLE width='100%' cellspacing=0>"); Q.oh(6, "<TR><TD class='RefGroup'>" + title + "</TD></TR>"); Q.oh(6, "<TR><TD class='RefCounts'>Primary: " + refFrameIndMap.getMemberCount("primary") + " unique values / " + refFrameIndMap.getMemberships("primary") + " total uses (= # frames in VN)</TD></TR>"); Q.oh(6, "<TR><TD class='RefCounts' style='border-bottom: 1px black dashed;'>Secondary: " + refFrameIndMap.getMemberCount("secondary") + " unique values / " + refFrameIndMap.getMemberships("secondary") + " total uses</TD></TR>"); Q.oh(6, "<TR><TD>"); Q.oh(7, "<BR>"); Q.oh(7, "<UL>"); GroupComparator<String, String> comparator = new GroupComparator<String, String>() { public int compareTo(MembershipMap<String, String> map, String group1, String group2) { int mems1 = map.getMemberships(group1); int mems2 = map.getMemberships(group2); return mems2 - mems1; } }; for (String group : refFrameBothMap.groups(comparator)) { int gcnt = refFrameBothMap.getMemberships(group); String ff = (gcnt == 1) ? "frame" : "frames"; Q.oh(8, "<LI>" + group + " <B>(" + gcnt + " " + ff + ")</B>"); Q.oh(9, "<UL>"); TreeMap<String, Integer> smems = refFrameBothMap.getMembers(group); for (String member : smems.keySet()) { int scnt = smems.get(member); String fc = " <B>(" + scnt + ")</B>"; Q.oh(10, "<LI>" + member + fc + "</LI>"); } Q.oh(9, "</UL>"); Q.oh(8, "</LI>"); } Q.oh(7, "</UL>"); Q.oh(7, "<BR>"); Q.oh(6, "</TD></TR>"); Q.oh(5, "</TABLE>"); Q.oh(4, "</TD>"); }
From source file:com.sfs.beans.PrivilegesBean.java
/** * Gets a list of email addresses for the supplied user. * * @param user the user bean//from ww w . ja v a 2 s . com * * @return the list of email addresses */ public final Collection<String> getEmailAddresses(final UserBean user) { Collection<String> addresses = new ArrayList<String>(); TreeMap<String, String> unique = new TreeMap<String, String>(); if (user.getMemberOf() != null) { for (String role : user.getMemberOf()) { if (role != null) { RoleBean roleBean = (RoleBean) this.roles.get(role); StringBuffer address = new StringBuffer(); if (StringUtils.isNotBlank(roleBean.getEmailAddress())) { address.append(roleBean.getEmailAddress().trim()); if (StringUtils.isNotBlank(roleBean.getEmailName())) { address.insert(0, roleBean.getEmailName().trim() + " <"); address.append(">"); } } if (StringUtils.isNotBlank(address.toString())) { unique.put(address.toString(), address.toString()); } } } } StringBuffer userAddress = new StringBuffer(); if (StringUtils.isNotBlank(user.getEmail())) { userAddress.append(user.getEmail().trim()); if (StringUtils.isNotBlank(user.getLastName())) { userAddress.insert(0, user.getLastName().trim() + " <"); userAddress.append(">"); } if (StringUtils.isNotBlank(user.getPreferredName())) { userAddress.insert(0, user.getPreferredName().trim() + " "); } // Remove the address if it is already in the unique tree map if (unique.containsKey(userAddress.toString())) { unique.remove(userAddress.toString()); } } // Add the user name to the top of the list if (StringUtils.isNotBlank(userAddress.toString())) { addresses.add(userAddress.toString()); } for (String address : unique.keySet()) { addresses.add(address); } return addresses; }
From source file:com.sfs.whichdoctor.webservice.RotationXmlOutputImpl.java
/** * Builds a list of rotations in the second-gen XML format. * * @param rotations the rotation array/*from ww w . ja va2s . co m*/ * @param personIdentifier the person identifier * @param division the division * @param currentRotations the current rotations * * @return the rotations in XML format */ public final String getSecondGenRotations(final List<RotationBean> rotations, final int personIdentifier, final String division, final Collection<RotationBean> currentRotations) { Element xml = new Element("trainee"); xml.setAttribute("MIN", String.valueOf(personIdentifier)); // Process the current organisations TreeMap<String, Element> siteMap = new TreeMap<String, Element>(); for (RotationBean rtn : currentRotations) { if (StringUtils.isNotBlank(rtn.getOrganisation1Name())) { Element site = new Element("site"); String type = "primary"; if (!StringUtils.equalsIgnoreCase(type, rtn.getOrganisation1TypeMapping())) { // If not primary set the type to training type = "training"; } site.setAttribute("type", "current_" + type); site.setAttribute("state", loadOrgCity(rtn.getOrganisation1Id())); site.setAttribute("name", rtn.getOrganisation1Name()); siteMap.put(type, site); } if (StringUtils.isNotBlank(rtn.getOrganisation2Name())) { Element site = new Element("site"); String type = "training"; if (siteMap.containsKey(type)) { // Set to primary if the training key exists type = "primary"; } site.setAttribute("type", "current_" + type); site.setAttribute("state", loadOrgCity(rtn.getOrganisation2Id())); site.setAttribute("name", rtn.getOrganisation2Name()); siteMap.put(type, site); } } if (siteMap.size() == 1) { for (String type : siteMap.keySet()) { Element site = siteMap.get(type); Element site2 = (Element) site.clone(); String secondType = "training"; if (StringUtils.equalsIgnoreCase(type, "training")) { secondType = "primary"; } site2.setAttribute("type", "current_" + secondType); siteMap.put(secondType, site2); } } Element sitesElement = new Element("sites"); for (String type : siteMap.keySet()) { Element site = siteMap.get(type); sitesElement.addContent(site); } xml.addContent(sitesElement); Element rtnsXml = new Element("rotations"); rtnsXml.setAttribute("min", String.valueOf(personIdentifier)); for (RotationBean rtn : rotations) { rtnsXml.addContent(RotationXmlHelper.getSecondGenRotationInfo(rtn, division, loadOrgCity(rtn.getOrganisation1Id()), loadOrgCity(rtn.getOrganisation2Id()))); } xml.addContent(rtnsXml); XMLOutputter outputter = new XMLOutputter(); Format format = Format.getCompactFormat(); format.setOmitDeclaration(true); outputter.setFormat(format); return outputter.outputString(new Document(xml)); }
From source file:gemlite.shell.admin.dao.AdminDao.java
/** * members// w w w . ja v a2s . co m * * @return * @throws IOException */ private String showMembers(TreeMap<String, String> memberTreeMap) throws IOException { do { System.out.println("------------------------"); Map param = new HashMap(); param.put("beanName", "ListMembersService"); Execution execution = FunctionService.onServers(clientPool).withArgs(param); ResultCollector rc = execution.execute("REMOTE_ADMIN_FUNCTION"); Object obj = rc.getResult(); if (obj == null) { System.out.println("can't get members list"); return null; } ArrayList list = (ArrayList) obj; if (!(list.get(0) instanceof HashMap)) { System.out.println(list.get(0)); return null; } HashMap<String, String> memberMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); sb.append("NO.").append("\t").append("memberId").append("\t").append("ip").append("\n"); int no = 1; if (memberTreeMap == null) memberTreeMap = new TreeMap<String, String>(); for (int i = 0; i < list.size(); i++) { HashMap map = (HashMap) list.get(i); Iterator memberIters = map.keySet().iterator(); while (memberIters.hasNext()) { String memberId = (String) memberIters.next(); String ip = (String) map.get(memberId); memberTreeMap.put(memberId, ip); } } // ?,ip? Iterator<String> treeIt = memberTreeMap.keySet().iterator(); while (treeIt.hasNext()) { String memberId = treeIt.next(); String ip = memberTreeMap.get(memberId); sb.append(no).append(" ").append(memberId).append(" ").append(ip).append("\r\n"); memberMap.put(String.valueOf(no), memberId); no++; } System.out.println(sb.toString()); System.out.println("------------------------\nmemberId,Your choice,No. or memberId?X to exit"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String line = bufferedReader.readLine(); if (line == null) { System.out.println("no input memberId!"); } else if (!"x".equalsIgnoreCase(line.trim()) && !memberMap.entrySet().contains(line.trim()) && !memberMap.keySet().contains(line.trim())) { System.out.println("error input:" + line); } else { if (memberMap.keySet().contains(line.trim())) return memberMap.get(String.valueOf(line.trim())); return line.trim(); } } while (true); }
From source file:org.archive.url.UsableURIFactoryTest.java
/** * Tests from rfc2396 with amendments to accomodate differences * intentionally added to make our URI handling like IEs. * * <pre>// w w w .j a va 2s.co m * g:h = g:h * g = http://a/b/c/g * ./g = http://a/b/c/g * g/ = http://a/b/c/g/ * /g = http://a/g * //g = http://g * ?y = http://a/b/c/?y * g?y = http://a/b/c/g?y * #s = (current document)#s * g#s = http://a/b/c/g#s * g?y#s = http://a/b/c/g?y#s * ;x = http://a/b/c/;x * g;x = http://a/b/c/g;x * g;x?y#s = http://a/b/c/g;x?y#s * . = http://a/b/c/ * ./ = http://a/b/c/ * .. = http://a/b/ * ../ = http://a/b/ * ../g = http://a/b/g * ../.. = http://a/ * ../../ = http://a/ * ../../g = http://a/g * </pre> * * @throws URIException */ public final void testRFC2396Relative() throws URIException { UsableURI base = UsableURIFactory.getInstance("http://a/b/c/d;p?q"); TreeMap<String, String> m = new TreeMap<String, String>(); m.put("..", "http://a/b/"); m.put("../", "http://a/b/"); m.put("../g", "http://a/b/g"); m.put("../..", "http://a/"); m.put("../../", "http://a/"); m.put("../../g", "http://a/g"); m.put("g#s", "http://a/b/c/g#s"); m.put("g?y#s ", "http://a/b/c/g?y#s"); m.put(";x", "http://a/b/c/;x"); m.put("g;x", "http://a/b/c/g;x"); m.put("g;x?y#s", "http://a/b/c/g;x?y#s"); m.put(".", "http://a/b/c/"); m.put("./", "http://a/b/c/"); m.put("g", "http://a/b/c/g"); m.put("./g", "http://a/b/c/g"); m.put("g/", "http://a/b/c/g/"); m.put("/g", "http://a/g"); m.put("//g", "http://g"); // CHANGED BY RFC3986 // m.put("?y", "http://a/b/c/?y"); m.put("g?y", "http://a/b/c/g?y"); // EXTRAS beyond the RFC set. // TODO: That these resolve to a path of /a/g might be wrong. Perhaps // it should be '/g'?. m.put("/../../../../../../../../g", "http://a/g"); m.put("../../../../../../../../g", "http://a/g"); m.put("../G", "http://a/b/G"); for (Iterator<String> i = m.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); String value = (String) m.get(key); UsableURI uuri = UsableURIFactory.getInstance(base, key); assertTrue("Unexpected " + key + " " + value + " " + uuri, uuri.equals(UsableURIFactory.getInstance(value))); } }