Example usage for java.util SortedSet addAll

List of usage examples for java.util SortedSet addAll

Introduction

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

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

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

final private SortedSet<ICurriculumEntry> mapEntries() {
    final ApprovementMobilityCertificateRequest request = getDocumentRequest();

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

    final Registration registration = getDocumentRequest().getRegistration();
    if (registration.isBolonha()) {
        mapCycles(entries);//from  w ww.  jav a  2 s .  c om
    } else {
        final ICurriculum curriculum = registration.getCurriculum(request.getFilteringDate());
        ApprovementMobilityCertificateRequest.filterEntries(entries, request, curriculum);
    }

    if (registration.getRegistrationProtocol().isMobilityAgreement()) {
        entries.addAll(request.getStandaloneEntriesToReport());
    }

    entries.addAll(request.getExtraCurricularEntriesToReport());
    entries.addAll(request.getPropaedeuticEntriesToReport());
    return entries;
}

From source file:org.opennms.web.svclayer.support.DefaultManualProvisioningService.java

/**
 * <p>getServiceTypeNames</p>
 *
 * @return a {@link java.util.Collection} object.
 *///from   ww  w. ja va2 s  . c  o m
@Override
public Collection<String> getServiceTypeNames(String groupName) {
    final SortedSet<String> serviceNames = new TreeSet<String>();

    m_readLock.lock();
    try {
        m_pendingForeignSourceRepository.flush();
        final ForeignSource pendingForeignSource = m_pendingForeignSourceRepository.getForeignSource(groupName);
        serviceNames.addAll(pendingForeignSource.getDetectorNames());

        m_deployedForeignSourceRepository.flush();
        final ForeignSource deployedForeignSource = m_deployedForeignSourceRepository
                .getForeignSource(groupName);
        serviceNames.addAll(deployedForeignSource.getDetectorNames());

        for (final OnmsServiceType type : m_serviceTypeDao.findAll()) {
            serviceNames.add(type.getName());
        }

        // Include all of the service names defined in the poller configuration
        if (m_pollerConfig != null && m_pollerConfig.getServiceMonitors() != null
                && !m_pollerConfig.getServiceMonitors().isEmpty()) {
            serviceNames.addAll(m_pollerConfig.getServiceMonitors().keySet());
        }

        return serviceNames;
    } finally {
        m_readLock.unlock();
    }
}

From source file:org.voltdb.utils.CatalogUtil.java

/**
 * Deterministically serializes all DR table signatures into a string and calculates the CRC checksum.
 * @param catalog    The catalog//from  www. j a  v a  2  s . c om
 * @return A pair of CRC checksum and the serialized signature string.
 */
public static Pair<Long, String> calculateDrTableSignatureAndCrc(Database catalog) {
    SortedSet<Table> tables = Sets.newTreeSet();
    tables.addAll(getNormalTables(catalog, true));
    tables.addAll(getNormalTables(catalog, false));

    final PureJavaCrc32 crc = new PureJavaCrc32();
    final StringBuilder sb = new StringBuilder();
    String delimiter = "";
    for (Table t : tables) {
        if (t.getIsdred()) {
            crc.update(t.getSignature().getBytes(Charsets.UTF_8));
            sb.append(delimiter).append(t.getSignature());
            delimiter = SIGNATURE_DELIMITER;
        }
    }

    return Pair.of(crc.getValue(), sb.toString());
}

From source file:org.jahia.utils.osgi.parsers.ParsingContext.java

public SortedSet<PackageInfo> getChildrenLocalPackagesToRemoveFromImports() {
    SortedSet<PackageInfo> childLocalPackagesToRemove = new TreeSet<PackageInfo>();
    if (children != null && children.size() > 0) {
        for (ParsingContext childParsingContext : children) {
            // remove all child local packages that satisfy package imports, since we are embedding them.
            if (!childParsingContext.isExternal() && !childParsingContext.isOptional()) {
                childLocalPackagesToRemove.addAll(childParsingContext.getLocalPackages());
                childLocalPackagesToRemove
                        .addAll(childParsingContext.getChildrenLocalPackagesToRemoveFromImports());
            }/*  www.j  a  v a 2  s  .c o m*/
        }
    }
    return childLocalPackagesToRemove;
}

From source file:module.mission.domain.MissionProcess.java

public SortedSet<MissionProcessLateJustification> getOrderedMissionProcessLateJustificationsSet() {
    final SortedSet<MissionProcessLateJustification> result = new TreeSet<MissionProcessLateJustification>(
            MissionProcessLateJustification.COMPARATOR_BY_JUSTIFICATION_DATETIME);
    result.addAll(getMissionProcessLateJustificationsSet());
    return result;
}

From source file:de.interactive_instruments.ShapeChange.Target.Metadata.ApplicationSchemaMetadata.java

protected void processProfilesMetadata(Element appSchemaElement) {

    Set<Info> schemaElements = new TreeSet<Info>();

    // identify all classes and properties that belong to the schema
    SortedSet<ClassInfo> schemaClasses = model.classes(schemaPi);

    if (schemaClasses != null) {

        for (ClassInfo ci : schemaClasses) {
            schemaElements.add(ci);//from  w w w.j av  a 2  s. com

            for (PropertyInfo pi : ci.properties().values()) {
                schemaElements.add(pi);
            }
        }
    }

    // identify the profiles of all relevant schema elements
    SortedSet<String> profileNames = new TreeSet<String>();

    for (Info i : schemaElements) {

        String[] profilesTVs = i.taggedValuesForTag("profiles");

        for (String profilesTV : profilesTVs) {

            if (profilesTV.trim().length() > 0) {

                try {

                    ProfileIdentifierMap piMap = ProfileIdentifierMap.parse(profilesTV, IdentifierPattern.loose,
                            i.name());

                    profileNames.addAll(piMap.getProfileIdentifiersByName().keySet());

                } catch (MalformedProfileIdentifierException e) {
                    result.addWarning(this, 9, profilesTV, i.fullNameInSchema(), e.getMessage());
                }
            }
        }
    }

    // now create the ProfilesMetadata XML element
    Element e_pm = document.createElement("ProfilesMetadata");

    for (String name : profileNames) {
        Element e_cp = document.createElement("containedProfile");
        e_cp.setTextContent(name);
        e_pm.appendChild(e_cp);
    }

    Element e_m = document.createElement("metadata");

    e_m.appendChild(e_pm);

    appSchemaElement.appendChild(e_m);
}

From source file:org.fenixedu.academic.domain.ExecutionDegree.java

public java.util.SortedSet<org.fenixedu.academic.domain.SchoolClass> getSortedSchoolClasses() {
    final SortedSet<SchoolClass> result = new TreeSet<>(SchoolClass.COMPARATOR_BY_NAME);
    result.addAll(getSchoolClassesSet());
    return result;
}

From source file:org.jasig.schedassist.impl.owner.SpringJDBCAvailableScheduleDaoImpl.java

@Transactional
@Override//from  ww w  . j  a  va  2 s  .c om
public AvailableSchedule addToSchedule(final IScheduleOwner owner, final Set<AvailableBlock> blocks) {
    // retrieve existing schedule
    AvailableSchedule stored = retrieve(owner);

    // expand it to minimum possible size
    SortedSet<AvailableBlock> storedExpanded = AvailableBlockBuilder.expand(stored.getAvailableBlocks(), 1);
    // expand the argument to minimum possible size blocks
    SortedSet<AvailableBlock> blocksExpanded = AvailableBlockBuilder.expand(blocks, 1);

    // since AvailableBlock equals and hashCode ignore location, call remove first to get
    // rid of any blocks that have matching times
    storedExpanded.removeAll(blocksExpanded);
    // add the new blocks to the expanded set
    boolean modified = storedExpanded.addAll(blocksExpanded);
    if (modified) {
        replaceSchedule(owner, storedExpanded);
    }

    // retrieve the new complete schedule and return
    return retrieve(owner);
}

From source file:org.jahia.services.render.RenderService.java

private Template addTemplate(Resource resource, RenderContext renderContext, String templateName,
        Set<String> installedModules, String type) throws RepositoryException {
    SortedSet<Template> templates = new TreeSet<Template>(TEMPLATE_PRIORITY_COMPARATOR);
    for (String s : installedModules) {
        JahiaTemplatesPackage pack = templateManagerService.getTemplatePackageById(s);
        if (pack != null) {
            JCRNodeWrapper templateNode = resource.getNode().getSession()
                    .getNode("/modules/" + s + "/" + pack.getVersion());
            templates.addAll(addTemplates(resource, renderContext, templateName, templateNode, type));
        }/*from www.j  av a  2s .  com*/
    }
    return templates.isEmpty() ? null : templates.last();
}

From source file:org.projectforge.framework.persistence.database.DatabaseUpdateService.java

@PostConstruct
public void initialize() {
    TableAttribute.register(new TableAttributeHookImpl());

    final SortedSet<UpdateEntry> updateEntries = new TreeSet<UpdateEntry>();
    DatabaseCoreUpdates.applicationContext = this.applicationContext;
    updateEntries.addAll(DatabaseCoreUpdates.getUpdateEntries());
    getSystemUpdater().setUpdateEntries(updateEntries);
}