List of usage examples for java.util SortedSet add
boolean add(E e);
From source file:com.atlassian.jira.util.system.ExtendedSystemInfoUtilsImpl.java
public Collection<Plugin> getPlugins() { final SortedSet<Plugin> plugins = new TreeSet<Plugin>(new PluginComparator()); for (Plugin plugin : pluginAccessor.getPlugins()) { if (!plugins.add(plugin)) { throw new IllegalStateException("Multiple plugins with the same key and version:" + plugin.getKey() + " " + plugin.getPluginsVersion()); }//w w w . j av a 2s. c o m } return Collections.unmodifiableSet(plugins); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ViewHomepageDA.java
public ActionForward listAlumni(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedMap<Degree, SortedSet<Homepage>> homepages = new TreeMap<Degree, SortedSet<Homepage>>( Degree.COMPARATOR_BY_DEGREE_TYPE_AND_NAME_AND_ID); for (final Registration registration : rootDomainObject.getRegistrationsSet()) { if (registration.getActiveState().getStateType().equals(RegistrationStateType.CONCLUDED)) { final Degree degree = registration.getActiveStudentCurricularPlan().getDegreeCurricularPlan() .getDegree();/*from ww w . j av a 2s .c o m*/ final SortedSet<Homepage> degreeHomepages; if (homepages.containsKey(degree)) { degreeHomepages = homepages.get(degree); } else { degreeHomepages = new TreeSet<Homepage>(Homepage.HOMEPAGE_COMPARATOR_BY_NAME); homepages.put(degree, degreeHomepages); } final Homepage homepage = registration.getPerson().getHomepage(); if (homepage != null && homepage.getActivated()) { degreeHomepages.add(homepage); } } } request.setAttribute("homepages", homepages); final String selectedPage = request.getParameter("selectedPage"); if (selectedPage != null) { request.setAttribute("selectedPage", selectedPage); } return mapping.findForward("list-homepages-alumni"); }
From source file:org.stockwatcher.data.cassandra.StockDAOImpl.java
@Override public SortedSet<Comment> getStockCommentsBySymbol(StatementOptions options, String symbol, int limit) { SortedSet<Comment> comments = new TreeSet<Comment>(); try {// w ww .j ava 2 s . co m BoundStatement bs = selectStockCommentsBySymbol.bind(); bs.setString("stock_symbol", symbol); int count = 0; for (Row row : execute(bs, options)) { if (row.getBool("active")) { Comment comment = createComment(row); comments.add(comment); if (++count >= limit) { break; } } } } catch (DriverException e) { throw new DAOException(e); } return comments; }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the ore asteroids of this sector. * /* ww w. j a va 2s . c o m*/ * @return The ore asteroids */ public Asteroid[] getOreAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isOre()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the ice asteroids of this sector. * /*from ww w.jav a 2 s . co m*/ * @return The ice asteroids */ public Asteroid[] getIceAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isIce()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.resourceAllocationManager.ManageLessonDA.java
public ActionForward deleteLessonInstances(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedSet<NextPossibleSummaryLessonsAndDatesBean> set = new TreeSet<NextPossibleSummaryLessonsAndDatesBean>(); for (final String lessonDate : request.getParameterValues("lessonDatesToDelete")) { set.add(NextPossibleSummaryLessonsAndDatesBean.getNewInstance(lessonDate)); }//from w ww . j a va 2 s .c o m try { DeleteLessonInstance.run(set); ActionErrors actionErrors = new ActionErrors(); for (final NextPossibleSummaryLessonsAndDatesBean n : set) { actionErrors.add(null, new ActionError("message.deleteLesson", n.getDate())); } saveErrors(request, actionErrors); } catch (UnsupportedOperationException unsupportedOperationException) { ActionErrors actionErrors = new ActionErrors(); for (final NextPossibleSummaryLessonsAndDatesBean n : set) { actionErrors.add(unsupportedOperationException.getMessage(), new ActionError("error.Lesson.not.instanced", n.getDate())); } saveErrors(request, actionErrors); } catch (DomainException domainException) { ActionErrors actionErrors = new ActionErrors(); actionErrors.add(domainException.getMessage(), new ActionError(domainException.getMessage())); saveErrors(request, actionErrors); } return viewAllLessonDates(mapping, form, request, response); }
From source file:net.zypr.api.Protocol.java
public String[] getAllVerbs() { SortedSet<String> sortedSet = new TreeSet<String>(); for (Enumeration enumeration = _services.elements(); enumeration.hasMoreElements();) { String[] verbs = ((ServiceVO) (enumeration.nextElement())).getVerbs(); for (int index = 0; index < verbs.length; index++) sortedSet.add(verbs[index]); }/*from w w w .ja v a 2 s . c o m*/ return (sortedSet.toArray(new String[0])); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ViewHomepageDA.java
public ActionForward listTeachers(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedMap<Unit, SortedSet<Homepage>> homepages = new TreeMap<Unit, SortedSet<Homepage>>( Unit.COMPARATOR_BY_NAME_AND_ID); for (final Teacher teacher : rootDomainObject.getTeachersSet()) { final Person person = teacher.getPerson(); final Employee employee = person.getEmployee(); if (employee != null) { final Contract contract = employee.getCurrentWorkingContract(); if (contract != null) { final Unit unit = contract.getWorkingUnit(); final SortedSet<Homepage> unitHomepages; if (homepages.containsKey(unit)) { unitHomepages = homepages.get(unit); } else { unitHomepages = new TreeSet<Homepage>(Homepage.HOMEPAGE_COMPARATOR_BY_NAME); homepages.put(unit, unitHomepages); }// w ww . ja va2 s.c o m final Homepage homepage = person.getHomepage(); if (homepage != null && homepage.getActivated().booleanValue()) { unitHomepages.add(homepage); } } } } request.setAttribute("homepages", homepages); final String selectedPage = request.getParameter("selectedPage"); if (selectedPage != null) { request.setAttribute("selectedPage", selectedPage); } return mapping.findForward("list-homepages-teachers"); }
From source file:de.ailis.xadrian.data.Sector.java
/** * Returns the nividium asteroids of this sector. * //from w ww .j a v a2s . c om * @return The nividium asteroids */ public Asteroid[] getNividiumAsteroids() { final SortedSet<Asteroid> asteroids = new TreeSet<Asteroid>(); for (final Asteroid asteroid : getAsteroids()) { if (asteroid.getWare().isNividium()) { asteroids.add(asteroid); } } return asteroids.toArray(new Asteroid[asteroids.size()]); }
From source file:com.revetkn.ios.analyzer.ArtworkAnalyzer.java
/** @return All image files in the project. */ protected SortedSet<File> extractAllImageFiles(File projectRootDirectory) { SortedSet<File> allImageFiles = new TreeSet<File>(); for (File pngFile : listFiles(projectRootDirectory, new SuffixFileFilter(new ArrayList<String>(imageFileSuffixes())), new NotFileFilter(new NameFileFilter(new ArrayList<String>(ignoredDirectoryNames()))))) allImageFiles.add(pngFile); return allImageFiles; }