List of usage examples for java.util TreeSet size
public int size()
From source file:net.firejack.platform.generate.tools.Render.java
public String renderEndpointArguments(TreeSet<ServiceParam> params) { if (params == null || params.isEmpty()) return ""; StringBuilder builder = new StringBuilder(); int i = 0;//from www.jav a 2 s . com for (ServiceParam param : params) { builder.append(" ").append(param.getName()); if (param.getLocation() == null) { builder.append(".getData()"); } if (i < params.size() - 1) { builder.append(", "); } i++; } return builder.toString(); }
From source file:org.wso2.carbon.mdm.api.User.java
/** * Update user in user store//from www . j av a 2 s .c o m * * @param userWrapper Wrapper object representing input json payload * @return {Response} Status of the request wrapped inside Response object * @throws MDMAPIException */ @PUT @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public Response updateUser(UserWrapper userWrapper, @QueryParam("username") String username) throws MDMAPIException { UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); ResponsePayload responsePayload = new ResponsePayload(); try { if (userStoreManager.isExistingUser(userWrapper.getUsername())) { Map<String, String> defaultUserClaims = buildDefaultUserClaims(userWrapper.getFirstname(), userWrapper.getLastname(), userWrapper.getEmailAddress()); if (StringUtils.isNotEmpty(userWrapper.getPassword())) { // Decoding Base64 encoded password byte[] decodedBytes = Base64.decodeBase64(userWrapper.getPassword()); userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(), new String(decodedBytes, "UTF-8")); log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed"); } List<String> listofFilteredRoles = getFilteredRoles(userStoreManager, userWrapper.getUsername()); final String[] existingRoles = listofFilteredRoles.toArray(new String[listofFilteredRoles.size()]); /* Use the Set theory to find the roles to delete and roles to add The difference of roles in existingRolesSet and newRolesSet needed to be deleted new roles to add = newRolesSet - The intersection of roles in existingRolesSet and newRolesSet */ final TreeSet<String> existingRolesSet = new TreeSet<>(); Collections.addAll(existingRolesSet, existingRoles); final TreeSet<String> newRolesSet = new TreeSet<>(); Collections.addAll(newRolesSet, userWrapper.getRoles()); existingRolesSet.removeAll(newRolesSet); // Now we have the roles to delete String[] rolesToDelete = existingRolesSet.toArray(new String[existingRolesSet.size()]); List<String> roles = new ArrayList<>(Arrays.asList(rolesToDelete)); roles.remove(ROLE_EVERYONE); rolesToDelete = new String[0]; // Clearing and re-initializing the set existingRolesSet.clear(); Collections.addAll(existingRolesSet, existingRoles); newRolesSet.removeAll(existingRolesSet); // Now we have the roles to add String[] rolesToAdd = newRolesSet.toArray(new String[newRolesSet.size()]); userStoreManager.updateRoleListOfUser(userWrapper.getUsername(), rolesToDelete, rolesToAdd); userStoreManager.setUserClaimValues(userWrapper.getUsername(), defaultUserClaims, null); // Outputting debug message upon successful addition of user if (log.isDebugEnabled()) { log.debug("User by username: " + userWrapper.getUsername() + " was successfully updated."); } // returning response with success state responsePayload.setStatusCode(HttpStatus.SC_CREATED); responsePayload.setMessageFromServer( "User by username: " + userWrapper.getUsername() + " was successfully updated."); return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); } else { if (log.isDebugEnabled()) { log.debug("User by username: " + userWrapper.getUsername() + " doesn't exists. Therefore, request made to update user was refused."); } // returning response with bad request state responsePayload.setStatusCode(HttpStatus.SC_CONFLICT); responsePayload.setMessageFromServer("User by username: " + userWrapper.getUsername() + " doesn't exists. Therefore, request made to update user was refused."); return Response.status(HttpStatus.SC_CONFLICT).entity(responsePayload).build(); } } catch (UserStoreException | UnsupportedEncodingException e) { String msg = "Exception in trying to update user by username: " + userWrapper.getUsername(); log.error(msg, e); throw new MDMAPIException(msg, e); } }
From source file:com.idega.block.cal.renderer.ScheduleDetailedDayRenderer.java
protected void writeEntries(FacesContext context, HtmlSchedule schedule, ScheduleDay day, ResponseWriter writer, int index) throws IOException { //final String clientId = schedule.getClientId(context); //FormInfo parentFormInfo = RendererUtils.findNestingForm(schedule, context); //String formId = parentFormInfo == null ? null : parentFormInfo.getFormName(); TreeSet entrySet = new TreeSet(); for (Iterator entryIterator = day.iterator(); entryIterator.hasNext();) { entrySet.add(new EntryWrapper((ScheduleEntry) entryIterator.next(), day)); }/* w w w. j av a 2s . c o m*/ EntryWrapper[] entries = (EntryWrapper[]) entrySet.toArray(new EntryWrapper[entrySet.size()]); //determine overlaps scanEntries(entries, 0); //determine the number of columns within this day int maxColumn = 0; for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); maxColumn = Math.max(wrapper.column, maxColumn); } int numberOfColumns = maxColumn + 1; //make sure the entries take up all available space horizontally maximizeEntries(entries, numberOfColumns); //now determine the width in percent of 1 column float columnWidth = 100 / numberOfColumns; //and now draw the entries in the columns for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); boolean selected = isSelected(schedule, wrapper); //compose the CSS style for the entry box StringBuffer entryStyle = new StringBuffer(); entryStyle.append(wrapper.getBounds(schedule, columnWidth, index)); if (selected) { writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry-selected"), null); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(HTML.DIV_ELEM); } else { //if the schedule is read-only, the entries should not be //hyperlinks writer.startElement(schedule.isReadonly() ? HTML.DIV_ELEM : HTML.ANCHOR_ELEM, schedule); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } if (!schedule.isReadonly()) { DateFormat format; String pattern = null; if ((pattern != null) && (pattern.length() > 0)) { format = new SimpleDateFormat(pattern); } else { if (context.getApplication().getDefaultLocale() != null) { format = DateFormat.getDateInstance(DateFormat.MEDIUM, context.getApplication().getDefaultLocale()); } else { format = DateFormat.getDateInstance(DateFormat.MEDIUM); } } String startTime = format.format(wrapper.entry.getStartTime()); startTime += " "; startTime += wrapper.entry.getStartTime().getHours(); startTime += ":"; if (wrapper.entry.getStartTime().getMinutes() < 10) { startTime += "0"; startTime += wrapper.entry.getStartTime().getMinutes(); } else { startTime += wrapper.entry.getStartTime().getMinutes(); } String endTime = ""; endTime += wrapper.entry.getEndTime().getHours(); endTime += ":"; if (wrapper.entry.getEndTime().getMinutes() < 10) { endTime += "0"; endTime += wrapper.entry.getEndTime().getMinutes(); } else { endTime += wrapper.entry.getEndTime().getMinutes(); } writer.writeAttribute(HTML.HREF_ATTR, "javascript:void(0)", null); writer.writeAttribute("entryid", wrapper.entry.getId(), null); } if (schedule.getModel().size() == 1) { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry"), null); } else { writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "workweekEntry"), null); } writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(schedule.isReadonly() ? HTML.DIV_ELEM : "a"); } } }
From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaOneWay.java
protected void doGraph() { // graph Component is available here // data: variables double xData, yData, residuals, predicted are available here after doAnalysis() is run. ////System.out.println("\nAnovaOneWay doGraph call removeAll"); graphPanel.removeAll();// w w w. j a v a 2s.c o m JPanel innerPanel = new JPanel(); JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); graphPanel.add(graphPane); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS)); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); // 1. Box plot of data: yData vs. xData (where xData is categorical) //int seriesCount = 3; // seriesCount //int categoryCount= 1; //double[][][] yValue = new double[seriesCount][categoryCount][]; //String[] seriesName = {"1", "2", "3"}; /* String[][] xNameData = new String[seriesCount][categoryCount]; // xNameData: category names. xNameData[0] = new String[] {""}; xNameData[1] = xNameData[0]; xNameData[2] = xNameData[0]; */ // data is for testing only. // the data below gives hallow triagle and circles. // static test data only /* yValue[0][0] = new double[] {14.67,13.72,13.84,13.90,14.56,13.88,14.30,14.11,13.84,13.90,14.56,13.88, 15, 16, 17}; yValue[1][0] = new double[] {13.94,14.40,14.14,14.59,13.59,14.24,14.05,11,12,13, 15, 20, 8}; yValue[2][0] = new double[] {14.24,14.05,14.65,13,10,19,20,10,11,12,23, 20, 23, 24}; */ /* the parameters to be passed are: 1.boxPlotTitle, xAxisLabel, YAxisLabel. 2. serieCount, categoryCount 3. seriesname (e.g. sex, race, etc) 4. category's name (e.g. height, weight, etc)--xData 5. yValue(double), */ /* JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs " + independentHeader, independentHeader, dependentHeader, dependentHeader + " Value " , xData, yData, "Regression Line", intercept, slope, ""); ChartPanel chartPanel = new ChartPanel(scatterChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight)); innerPanel.add(chartPanel); */ double xDataDouble[] = new double[xData.length]; String groupLegend = ""; boolean useStringLegend = false; TreeSet<String> treeSet = new TreeSet<String>(); try { for (int i = 0; i < xData.length; i++) { xDataDouble[i] = (new Double(xData[i])).doubleValue(); } } catch (Exception e) { useStringLegend = true; for (int i = 0; i < xData.length; i++) { treeSet.add((String) xData[i]); } } int groupSize = treeSet.size(); ////System.out.println("TreeSet.size() = " + groupSize); Iterator<String> iterator = treeSet.iterator(); int groupIndex = 1; String groupName = null; while (iterator.hasNext()) { groupName = (String) iterator.next(); //xDataDouble[groupIndex-1] = groupIndex; groupLegend += ("\t" + groupName + "=" + groupIndex + " "); for (int i = 0; i < xData.length; i++) { if (xData[i].equalsIgnoreCase(groupName)) { // xData[i] is a String. xDataDouble[i] = (double) groupIndex; } } groupIndex++; } if (useStringLegend) { groupLegend = "Group Names: " + groupLegend; groupLegend = groupLegend.substring(0, groupLegend.length() - 2); //System.out.println("groupLegend = " + groupLegend); // 1. scatter plot of data: yData vs. xData } //JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot", independentHeader, "Residuals", "Residual Value", xData, residuals, "At Residual = 0", 0, 0, ""); JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot", independentHeader, "Residuals", "Residual Value", xDataDouble, residuals, " " + groupLegend, 0, 0, ""); //JFreeChart scatterChart = chartFactory.getLineChart("Scatter Plot", independentHeader, dependentHeader, xDataDouble, yData);//getChart(title, xlabel, ylabel, xdata,ydata) ChartPanel chartPanel = new ChartPanel(scatterChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight)); innerPanel.add(chartPanel); /* if (useStringLegend) { JPanel labelPanel = new JPanel(); labelPanel.setBackground(Color.WHITE); JLabel legendLabel1 = new JLabel(groupLegend); legendLabel1.setBackground(Color.WHITE); labelPanel.add(legendLabel1, BorderLayout.NORTH); innerPanel.add(labelPanel); } */ // this is only a test for having more than one charts in a boxlayout // 1.5. box plot of data //mapToArray(boxPlotNameValueMap); /* JFreeChart boxChart = chartFactory.getBoxAndWhiskerChart(boxPlotTitle, xAxisLabel, yAxisLabel, seriesCount, categoryCount, seriesName, xNameData, yValue); chartPanel = new ChartPanel(boxChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight)); graphPanel.add(chartPanel); */ // 2. residual on fit plot: residuals vs. xData //JFreeChart rxChart = chartFactory.getLineChart("Residual on Covariate Plot", independentHeader, "Residuals", xDataDouble, residuals); JFreeChart rxChart = chartFactory.getQQChart("Residual on Covariate Plot", independentHeader, "Residuals", "Residuals", xDataDouble, residuals, " " + groupLegend, 0, 0, ""); chartPanel = new ChartPanel(rxChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight)); innerPanel.add(chartPanel); // 3. residual on fit plot: residuals vs. predicted //JFreeChart rfChart = chartFactory.getLineChart("Residual on Fit Plot", "Predicted", "Residuals", predicted, residuals); JFreeChart rfChart = chartFactory.getQQChart("Residual on Fit Plot", "Predicted " + dependentHeader, "Residuals", "Residuals", predicted, residuals, "At Residual = 0", 0, 0, ""); chartPanel = new ChartPanel(rfChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight)); innerPanel.add(chartPanel); // 4. Normal QQ plot: need residuals and standardized normal scores //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals); int len = sortedNormalQuantiles.length; double slope = (sortedStandardizedResiduals[len - 1] - sortedStandardizedResiduals[0]) / (sortedNormalQuantiles[len - 1] - sortedNormalQuantiles[0]); double y0 = sortedStandardizedResiduals[len - 1] - slope * sortedNormalQuantiles[len - 1]; // max_x = Math.max (normalQuantiles[row_count-1],stdResiduals[row_count-1]); JFreeChart qqChart = chartFactory.getQQChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", "Standardized Residual Value ", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "At Standardized Residual = 0", y0, slope, "noshape"); //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "noline"); chartPanel = new ChartPanel(qqChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight)); innerPanel.add(chartPanel); graphPanel.validate(); }
From source file:org.aika.network.neuron.lattice.AndNode.java
private Neuron computeNeuron(TreeSet<AndNode> significantLowerBound, TreeSet<Node> nonSignificantUpperBound) { Map<InputNode, Integer> indexes = new TreeMap<>(); ArrayList<InputNode> revIndexes = new ArrayList<>(); for (AndNode n : significantLowerBound) { for (InputNode in : n.parents.keySet()) { if (!indexes.containsKey(in)) { indexes.put(in, indexes.size()); revIndexes.add(in);/*w w w . ja v a 2 s . c om*/ } } } double[] objF = new double[indexes.size() + 1]; objF[0] = 1; LinearObjectiveFunction f = new LinearObjectiveFunction(objF, 0); LinearConstraint[] constraintArr = new LinearConstraint[significantLowerBound.size() + nonSignificantUpperBound.size()]; int i = 0; for (AndNode n : significantLowerBound) { double[] c = new double[indexes.size() + 1]; c[0] = 1; for (InputNode in : n.parents.keySet()) { c[indexes.get(in) + 1] = in.key.isNeg ? -1 : 1; } constraintArr[i] = new LinearConstraint(c, Relationship.GEQ, 0.5); i++; } for (Node n : nonSignificantUpperBound) { double[] c = new double[indexes.size() + 1]; c[0] = 1; if (n instanceof InputNode) { c[indexes.get(n) + 1] = ((InputNode) n).key.isNeg ? -1 : 1; } else if (n instanceof AndNode) { for (InputNode in : ((AndNode) n).parents.keySet()) { c[indexes.get(in) + 1] = in.key.isNeg ? -1 : 1; } } constraintArr[i] = new LinearConstraint(c, Relationship.LEQ, -0.5); i++; } LinearConstraintSet constraints = new LinearConstraintSet(constraintArr); SimplexSolver solver = new SimplexSolver(); PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, new NonNegativeConstraint(false)); double bias = solution.getKey()[0]; TreeSet<Synapse> synapses = new TreeSet<>(); for (int j = 1; j < solution.getKey().length; j++) { InputNode in = revIndexes.get(j - 1); Synapse s = new Synapse(in.inputNeuron, in.key.posDelta); s.w = (float) solution.getKey()[j]; synapses.add(s); } return Neuron.createNeuron(new Neuron(), bias, synapses, false); }
From source file:org.apache.myfaces.custom.schedule.ScheduleDetailedDayRenderer.java
protected void writeEntries(FacesContext context, HtmlSchedule schedule, ScheduleDay day, ResponseWriter writer) throws IOException { final String clientId = schedule.getClientId(context); FormInfo parentFormInfo = RendererUtils.findNestingForm(schedule, context); String formId = parentFormInfo == null ? null : parentFormInfo.getFormName(); TreeSet entrySet = new TreeSet(); for (Iterator entryIterator = day.iterator(); entryIterator.hasNext();) { entrySet.add(new EntryWrapper((ScheduleEntry) entryIterator.next(), day)); }/* www .j a va2s. c o m*/ EntryWrapper[] entries = (EntryWrapper[]) entrySet.toArray(new EntryWrapper[entrySet.size()]); //determine overlaps scanEntries(entries, 0); //determine the number of columns within this day int maxColumn = 0; for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); maxColumn = Math.max(wrapper.column, maxColumn); } int numberOfColumns = maxColumn + 1; //make sure the entries take up all available space horizontally maximizeEntries(entries, numberOfColumns); //now determine the width in percent of 1 column float columnWidth = 100 / numberOfColumns; //and now draw the entries in the columns for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); boolean selected = isSelected(schedule, wrapper); //compose the CSS style for the entry box StringBuffer entryStyle = new StringBuffer(); entryStyle.append(wrapper.getBounds(schedule, columnWidth)); String entryBorderColor = getEntryRenderer(schedule).getColor(context, schedule, wrapper.entry, selected); if (entryBorderColor != null) { entryStyle.append(" border-color: "); entryStyle.append(entryBorderColor); entryStyle.append(";"); } if (selected) { writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry-selected"), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the tooltip if (schedule.isTooltip()) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(HTML.DIV_ELEM); } else { //if the schedule is read-only, the entries should not be //hyperlinks writer.startElement(schedule.isReadonly() ? HTML.DIV_ELEM : HTML.ANCHOR_ELEM, schedule); //draw the tooltip if (schedule.isTooltip()) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } if (!schedule.isReadonly()) { writer.writeAttribute(HTML.HREF_ATTR, "#", null); writer.writeAttribute(HTML.ONCLICK_ATTR, "fireEntrySelected('" + formId + "', '" + clientId + "', '" + wrapper.entry.getId() + "');", null); } writer.writeAttribute(HTML.CLASS_ATTR, getEntryRenderer(schedule).getEntryClass(schedule, wrapper.entry), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(schedule.isReadonly() ? HTML.DIV_ELEM : HTML.ANCHOR_ELEM); } } }
From source file:org.zaproxy.zap.extension.ascanrulesBeta.SessionFixation.java
/** * finds and returns the cookie matching the specified cookie name from the message response. * * @param message// w w w .ja v a 2 s . c o m * @param cookieName * @return the HtmlParameter representing the cookie, or null if no matching cookie was found */ private HtmlParameter getResponseCookie(HttpMessage message, String cookieName) { TreeSet<HtmlParameter> cookieBackParams = message.getResponseHeader().getCookieParams(); if (cookieBackParams.size() == 0) { // no cookies return null; } for (Iterator<HtmlParameter> i = cookieBackParams.iterator(); i.hasNext();) { HtmlParameter tempparam = i.next(); if (tempparam.getName().equals(cookieName)) { // found it. return it. return tempparam; } } // there were cookies, but none matching the name return null; }
From source file:org.apache.roller.weblogger.ui.struts2.editor.Categories.java
public String execute() { // build list of categories for display TreeSet allCategories = new TreeSet(new WeblogCategoryPathComparator()); try {//from w ww. j a v a 2s . c o m // Build list of all categories, except for current one, sorted by path. WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager(); List<WeblogCategory> cats = wmgr.getWeblogCategories(getActionWeblog(), true); for (WeblogCategory cat : cats) { if (!cat.getId().equals(getCategoryId())) { allCategories.add(cat); } } // build category path WeblogCategory parent = getCategory().getParent(); if (parent != null) { List categoryPath = new LinkedList(); categoryPath.add(0, getCategory()); while (parent != null) { categoryPath.add(0, parent); parent = parent.getParent(); } setCategoryPath(categoryPath); } } catch (WebloggerException ex) { log.error("Error building categories list", ex); // TODO: i18n addError("Error building categories list"); } if (allCategories.size() > 0) { setAllCategories(allCategories); } return LIST; }
From source file:org.auscope.gridtools.RegistryQueryClient.java
/** * Gets the names of the subclusters at a site. * // w w w.j a v a2s . c o m * @param site The site to check * @return An array of subcluster names */ public String[] getSubClusterNamesAtSite(String site) { String names[] = new String[0]; String xpathQuery = "//*[local-name()='Site']/child::node()[local-name()='Name']" + "[translate(text(),'abcdefghijklmnopqrstuvwxyz'," + "'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=translate('" + site + "'," + "'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')]" + "/parent::node()/descendant::node()[local-name()='Cluster']"; // Parse the document NodeList clusterNodeList = turboMDSquery(xpathQuery); if (clusterNodeList != null) { TreeSet<String> myTreeSet = new TreeSet<String>(); for (int i = 0; i < clusterNodeList.getLength(); i++) { Element siteEl = (Element) clusterNodeList.item(i); myTreeSet.add(getTextValue(siteEl, "Name")); } names = myTreeSet.toArray(new String[myTreeSet.size()]); } return names; }
From source file:org.apache.fop.complexscripts.fonts.GlyphTable.java
/** * Obtain ordered list of all lookup tables, where order is by lookup identifier, which * lexicographic ordering follows the lookup list order. * @return (possibly empty) ordered list of all lookup tables *//* w w w . ja va2 s. com*/ public List/*<LookupTable>*/ getLookupTables() { TreeSet/*<String>*/ lids = new TreeSet/*<String>*/ (lookupTables.keySet()); List/*<LookupTable>*/ ltl = new ArrayList/*<LookupTable>*/ (lids.size()); for (Iterator it = lids.iterator(); it.hasNext();) { String lid = (String) it.next(); ltl.add(lookupTables.get(lid)); } return ltl; }