List of usage examples for java.util SortedSet iterator
Iterator<E> iterator();
From source file:com.jaspersoft.studio.jasper.ChartConverter.java
private void configureAxisSeriesColors(CategoryItemRenderer renderer, JRChartPlot jrPlot) { SortedSet<JRSeriesColor> seriesColors = jrPlot.getSeriesColors(); if (seriesColors != null) { Iterator<JRSeriesColor> iter = seriesColors.iterator(); while (iter.hasNext()) { JRSeriesColor seriesColor = iter.next(); renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor()); }// www . ja va2 s . c o m } }
From source file:com.jaspersoft.studio.jasper.ChartConverter.java
private void configureAxisSeriesColors(XYItemRenderer renderer, JRChartPlot jrPlot) { SortedSet<JRSeriesColor> seriesColors = jrPlot.getSeriesColors(); if (seriesColors != null) { Iterator<JRSeriesColor> iter = seriesColors.iterator(); while (iter.hasNext()) { JRSeriesColor seriesColor = iter.next(); renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor()); }//from w w w . ja v a2 s. c om } }
From source file:fr.aliasource.webmail.proxy.impl.CompletionRegistry.java
public List<Completion> complete(IAccount account, String type, String query, int limit) { SortedSet<Completion> comps = new TreeSet<Completion>(completionComparator); for (ICompletionSourceFactory csf : factories) { if (csf.supports(type)) { List<Completion> cResult = csf.getInstance(type).complete(account, query, limit); comps.addAll(cResult);/*w ww . j a v a 2 s .com*/ } } Iterator<Completion> it = comps.iterator(); int i = 0; List<Completion> ret = new ArrayList<Completion>(limit); while (it.hasNext() && i < limit) { ret.add(it.next()); i++; } if (logger.isInfoEnabled()) { logger.info("complete(" + type + ", " + query + ", " + limit + ") => " + ret.size() + " results."); } return ret; }
From source file:org.libreplan.web.expensesheet.ExpenseSheetModel.java
@Override @Transactional(readOnly = true)//from w w w . j a v a2s . co m public boolean isPersonalAndBelongsToCurrentUser(ExpenseSheet expenseSheet) { if (!expenseSheet.isPersonal()) return false; SortedSet<ExpenseSheetLine> expenseSheetLines = getFromDB(expenseSheet).getExpenseSheetLines(); Resource resource = expenseSheetLines.iterator().next().getResource(); User user = UserUtil.getUserFromSession(); return user.getWorker().getId().equals(resource.getId()); }
From source file:org.sakaiproject.component.app.messageforums.dao.hibernate.BaseForumImpl.java
public List getTopics() { boolean isUnsorted = false; int c = 1;/* ww w . j av a 2 s.c o m*/ for (Iterator i = this.topicsSet.iterator(); i.hasNext(); c++) { Topic topic = (Topic) i.next(); if (topic.getSortIndex().intValue() != c) { isUnsorted = true; break; } } if (isUnsorted) { SortedSet sortedTopics = new TreeSet(new TopicBySortIndexAscAndCreatedDateDesc()); sortedTopics.addAll(this.topicsSet); int x = 1; for (Iterator i = sortedTopics.iterator(); i.hasNext(); x++) { Topic topic = (Topic) i.next(); topic.setSortIndex(Integer.valueOf(x)); } this.topicsSet = sortedTopics; } return Util.setToList(this.topicsSet); }
From source file:org.commonjava.freeki.data.FreekiStore.java
public SortedSet<ChildRef> listPages(final String group) { final SortedSet<ChildRef> refs = listChildren(group); for (final Iterator<ChildRef> it = refs.iterator(); it.hasNext();) { final ChildRef ref = it.next(); if (ChildType.GROUP == ref.getType()) { it.remove();//w ww . j av a 2 s .c om } } return refs; }
From source file:org.libreplan.web.expensesheet.ExpenseSheetModel.java
private Resource initResource() { if (expenseSheet.isNotPersonal()) return null; SortedSet<ExpenseSheetLine> expenseSheetLines = expenseSheet.getExpenseSheetLines(); if (!expenseSheetLines.isEmpty()) return expenseSheetLines.iterator().next().getResource(); User user = UserUtil.getUserFromSession(); return user.isBound() ? user.getWorker() : null; }
From source file:org.cloudata.core.tabletserver.ValueCollection.java
public void setColumnRecords(SortedSet<ColumnValue> columnValues) { this.columnValues = columnValues; iterator = columnValues.iterator(); }
From source file:org.apache.hadoop.hive.ql.exec.ACLTask.java
private int showUsers(Hive db, showUsersDesc showUsersD) throws HiveException { List<String> users = db.showUsers(showUsersD.getWho()); try {//from w ww . j a v a 2s. c om FileSystem fs = showUsersD.getTmpFile().getFileSystem(conf); DataOutput outStream = (DataOutput) fs.create(showUsersD.getTmpFile()); SortedSet<String> sortedUsers = new TreeSet<String>(users); Iterator<String> iterUsers = sortedUsers.iterator(); outStream.writeBytes("All users in TDW:"); outStream.write(terminator); while (iterUsers.hasNext()) { outStream.writeBytes(iterUsers.next()); outStream.write(terminator); } ((FSDataOutputStream) outStream).close(); } catch (FileNotFoundException e) { LOG.warn("show users: " + StringUtils.stringifyException(e)); return 1; } catch (IOException e) { LOG.warn("show users: " + StringUtils.stringifyException(e)); return 1; } catch (Exception e) { throw new HiveException(e.toString()); } LOG.info("show users OK"); return 0; }
From source file:org.broadleafcommerce.common.cache.StatisticsServiceImpl.java
@Override public MBeanInfo getMBeanInfo() { SortedSet<String> names = new TreeSet<String>(); for (Map.Entry<String, CacheStat> stats : cacheStats.entrySet()) { names.add(stats.getKey());/*w ww . j a va 2 s .c o m*/ } MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[names.size()]; Iterator<String> it = names.iterator(); for (int i = 0; i < attrs.length; i++) { String name = it.next(); attrs[i] = new MBeanAttributeInfo(name, "java.lang.Double", name, true, // isReadable false, // isWritable false); // isIs } attrs = ArrayUtils.add(attrs, new MBeanAttributeInfo("LOG_RESOLUTION", "java.lang.Double", "LOG_RESOLUTION", true, // isReadable true, // isWritable false) // isIs ); MBeanOperationInfo[] opers = { new MBeanOperationInfo("activate", "Activate statistic logging", null, // no parameters "void", MBeanOperationInfo.ACTION), new MBeanOperationInfo("disable", "Disable statistic logging", null, // no parameters "void", MBeanOperationInfo.ACTION) }; return new MBeanInfo("org.broadleafcommerce:name=StatisticsService." + appName, "Runtime Statistics", attrs, null, // constructors opers, null); // notifications }