Example usage for java.util TreeSet TreeSet

List of usage examples for java.util TreeSet TreeSet

Introduction

In this page you can find the example usage for java.util TreeSet TreeSet.

Prototype

public TreeSet(SortedSet<E> s) 

Source Link

Document

Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

Usage

From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.ApprovementInfoForEquivalenceProcess.java

public static String getApprovementsInfo(final Registration registration) {

    final StringBuilder res = new StringBuilder();

    final SortedSet<ICurriculumEntry> entries = new TreeSet<ICurriculumEntry>(
            ICurriculumEntry.COMPARATOR_BY_EXECUTION_PERIOD_AND_NAME_AND_ID);

    final Map<Unit, String> ids = new HashMap<Unit, String>();
    if (registration.isBolonha()) {
        reportCycles(res, entries, ids, registration);
    } else {/*w ww. j  a v a 2s  .com*/
        final ICurriculum curriculum = registration.getCurriculum();
        filterEntries(entries, curriculum);
        reportEntries(res, entries, ids, registration);
    }

    entries.clear();
    entries.addAll(getExtraCurricularEntriesToReport(registration));
    if (!entries.isEmpty()) {
        reportRemainingEntries(res, entries, ids,
                registration.getLastStudentCurricularPlan().getExtraCurriculumGroup(), registration);
    }

    entries.clear();
    entries.addAll(getPropaedeuticEntriesToReport(registration));
    if (!entries.isEmpty()) {
        reportRemainingEntries(res, entries, ids,
                registration.getLastStudentCurricularPlan().getPropaedeuticCurriculumGroup(), registration);
    }

    res.append(getRemainingCreditsInfo(registration.getCurriculum()));

    res.append(LINE_BREAK);

    if (!ids.isEmpty()) {
        res.append(LINE_BREAK).append(getAcademicUnitInfo(ids));
    }

    return res.toString();
}

From source file:io.netlibs.bgp.rib.Route.java

public Route(AddressFamilyKey addressFamilyKey, NetworkLayerReachabilityInformation nlri,
        Collection<PathAttribute> pathAttributes, NextHop nextHop) {
    this.addressFamilyKey = addressFamilyKey;
    this.nlri = nlri;
    if (pathAttributes != null)
        this.pathAttributes = new TreeSet<PathAttribute>(pathAttributes);
    this.nextHop = nextHop;
}

From source file:edu.cornell.mannlib.vitro.webapp.modelaccess.ontmodels.MaskingOntModelCache.java

/** The list of names in the baseCache may have changed. */
@Override/*ww  w . ja  v  a  2 s .  co  m*/
public SortedSet<String> getModelNames() {
    SortedSet<String> allNames = new TreeSet<>(baseCache.getModelNames());
    allNames.addAll(maskingNames);
    return allNames;
}

From source file:net.sourceforge.fenixedu.dataTransferObject.inquiries.StudentTeacherInquiryBean.java

public StudentTeacherInquiryBean(final TeacherDTO teacherDTO, final ExecutionCourse executionCourse,
        final ShiftType shiftType, StudentInquiryTemplate studentTeacherInquiryTemplate) {
    setTeacherInquiryBlocks(new TreeSet<InquiryBlockDTO>(new BeanComparator("inquiryBlock.blockOrder")));
    for (InquiryBlock inquiryBlock : studentTeacherInquiryTemplate.getInquiryBlocksSet()) {
        getTeacherInquiryBlocks().add(new InquiryBlockDTO(inquiryBlock, null));
    }//from w w w . j a  v a2 s .  c  o m
    setExecutionCourse(executionCourse);
    setShiftType(shiftType);
    setTeacherDTO(teacherDTO);
    setGroupsVisibility(getTeacherInquiryBlocks());
}

From source file:com.pc.dailymile.domain.UserStream.java

public void setEntries(Set<Entry> entries) {
    this.entries = new TreeSet<Entry>(entries);
}

From source file:de.tbuchloh.kiskis.gui.feedback.AbstractSubmitFeedback.java

/**
 * @return/* w  w  w.j  ava 2 s .  c om*/
 */
@SuppressWarnings("unchecked")
protected String createBuildInformation() {
    final StringBuilder sb = new StringBuilder();
    final Set<String> props = new TreeSet(Collections.list(BuildProperties.getBuildProperties().getKeys()));
    for (final String key : props) {
        sb.append(key);
        sb.append("=");
        sb.append(BuildProperties.getBuildProperties().getString(key));
        sb.append("\n");
    }
    return sb.toString();
}

From source file:net.sourceforge.fenixedu.presentationTier.util.CollectionFilter.java

public Set<T> filter(Set<T> elements) {
    Set<T> filtered;/*  w  ww  .j a va2s .com*/

    if (comparator == null) {
        filtered = new HashSet<T>();
    } else {
        filtered = new TreeSet<T>(comparator);
    }

    final Set<Predicate> predicates = getPredicates();

    if (predicates == null || predicates.isEmpty()) {
        filtered.addAll(elements);
        return Collections.unmodifiableSet(filtered);
    }
    Predicate predicate;
    if (predicates.size() == 1) {
        predicate = predicates.iterator().next();
    } else {
        predicate = AllPredicate.getInstance(predicates);
    }
    for (T element : elements) {
        if (predicate.evaluate(element)) {
            filtered.add(element);
        }
    }
    return Collections.unmodifiableSet(filtered);
}

From source file:com.anrisoftware.simplerest.oanda.core.Granularities.java

private List<Granularity> getGranularities(Set<String> granularites) {
    Set<Granularity> sorted = new TreeSet<Granularity>(new Comparator<Granularity>() {

        @Override//from  w  ww.j  a  v  a 2  s .co  m
        public int compare(Granularity o1, Granularity o2) {
            return o1.getDuration().compareTo(o2.getDuration());
        }
    });
    for (String name : granularites) {
        sorted.add(Granularity.valueOf(name));
    }
    List<Granularity> result = new ArrayList<Granularity>(sorted.size());
    for (Granularity granularity : sorted) {
        result.add(granularity);
    }
    return Collections.unmodifiableList(result);
}

From source file:au.org.biodiversity.nsl.tree.SimpleProfiler.java

public static SortedSet<String> keys() {
    return new TreeSet<String>(itemCt.keySet());
}

From source file:it.unibz.instasearch.prefs.PreferenceInitializer.java

/**
 * Get extensions that Eclipse knows of and the default ones
 * @return comma separated string of extensions
 *///from w  ww  .j  a va 2s .co  m
public static String getIndexableExtensions() {
    String defaultExtArray[] = DEFAULT_EXTENSIONS.split(",");

    TreeSet<String> extensions = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
    extensions.addAll(Arrays.asList(defaultExtArray));

    IFileEditorMapping[] allMappings = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
            .getUnifiedMappings();

    IContentType text = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);

    for (int i = 0; i < allMappings.length; i++) {
        if (allMappings[i].getName().equals("*")) {
            String ext = allMappings[i].getExtension();
            IContentType type = Platform.getContentTypeManager().findContentTypeFor("." + ext);

            if (type != null && type.isKindOf(text))
                extensions.add(ext);
        }
    }

    IContentType[] types = Platform.getContentTypeManager().getAllContentTypes();
    for (IContentType type : types) {
        if (type.isKindOf(text)) {
            String exts[] = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
            extensions.addAll(Arrays.asList(exts));
        }
    }

    return StringUtils.join(extensions.toArray(), ",");
}