Example usage for java.util Vector addAll

List of usage examples for java.util Vector addAll

Introduction

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

Prototype

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

Source Link

Document

Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.

Usage

From source file:org.opencms.flex.CmsFlexRequest.java

/**
 * Return the names of all defined request parameters for this request.<p>
 * /*w  ww . ja v a  2 s  .  c  om*/
 * @return the names of all defined request parameters for this request
 * 
 * @see javax.servlet.ServletRequest#getParameterNames()
 */
@Override
public Enumeration<String> getParameterNames() {

    Vector<String> v = new Vector<String>();
    v.addAll(m_parameters.keySet());
    return (v.elements());
}

From source file:esg.node.connection.ESGConnectionManager.java

private void pingToPeers() {
    java.util.Vector<ESGPeer> peers_ = new java.util.Vector<ESGPeer>();
    peers_.addAll(unavailablePeers.values());
    for (ESGPeer peer : peers_) {
        log.trace("Inspecting [" + peers_.size() + "] marked peers");
        if (peer.equals(defaultPeer))
            log.trace("(default peer)");
        //TODO: put in random selection and or heartbeat/leasing here...
        //this is where the relationship maintenance code goes
        //and detecting when folks fall out of the system.
        //maybe ping should be expanded to put in lease negotiation proper.
        peer.ping();//from w  ww  . ja  va  2  s .  co m
    }
    peers_.clear();
    peers_ = null; //gc niceness...
}

From source file:org.openflexo.foundation.ie.menu.FlexoItemMenu.java

/**
 * Return a Vector of embedded IEObjects at this level. NOTE that this is NOT a recursive method
 * /*w  ww.ja  v a  2 s .com*/
 * @return a Vector of IEObject instances
 */
@Override
public Vector<IObject> getEmbeddedIEObjects() {
    Vector answer = new Vector();
    answer.addAll(_subItems);
    return answer;
}

From source file:esg.node.connection.ESGConnectionManager.java

public boolean prune() {
    log.trace("prune() ...");
    int pruneCount = 0;
    java.util.Vector<ESGPeer> peers_ = new java.util.Vector<ESGPeer>();
    peers_.addAll(peers.values());
    log.trace("Inspecting [" + peers_.size() + "] currently known peers");
    for (ESGPeer peer : peers_) {
        if (peer.equals(defaultPeer))
            log.trace("(default peer)");
        if (!peer.ping()) {
            pruneCount++;/*from  w ww  .ja  v  a  2 s .  co  m*/
            log.trace("Pruning out unresponsive peer: (" + pruneCount + ") " + peer.getServiceURL());
        }
    }
    log.trace("Total number of pruned peers: [" + pruneCount + "] / [" + peers_.size() + "]");
    peers_.clear();

    peers_.addAll(unavailablePeers.values());
    log.trace("Inspecting [" + peers_.size() + "] currently dead peers");
    for (ESGPeer peer : peers_) {
        log.trace("Purging dead peer: " + peer);
        peer.unregister();
    }

    peers_.clear();
    peers_ = null; //gc niceness...
    log.trace("--> returning " + (pruneCount > 0));
    return (pruneCount > 0);
}

From source file:jeplus.gui.EPlusEditorPanel.java

public final void updateSearchStrings(String[] searchstrings) {
    if (searchstrings != null) {
        Vector<String> SSs = new Vector<>();
        for (String searchstring : searchstrings) {
            String[] sstrs = searchstring.split("\\s*\\|\\s*");
            SSs.addAll(Arrays.asList(sstrs));
        }//from   w w w  .  jav a2s .com
        this.cboSearchStrings.setModel(new DefaultComboBoxModel(SSs));
        this.cboSearchStrings.setEnabled(true);
    } else {
        this.cboSearchStrings.setModel(new DefaultComboBoxModel());
        this.cboSearchStrings.setEnabled(false);
    }
}

From source file:org.mahasen.util.SearchUtil.java

/**
 * @param propertyName//w w  w.ja va2  s .co m
 * @param propertyValue
 * @return
 * @throws InterruptedException
 * @throws MahasenException
 */
private Vector<Id> getSearchResultIds(String propertyName, String propertyValue)
        throws InterruptedException, MahasenException {

    Vector<Id> idVector = new Vector<Id>();

    // tag search for several tags
    if (propertyValue.contains("&")) {
        String values[] = propertyValue.split("\\&");
        for (String value : values) {
            if (idVector.isEmpty()) {
                Vector<Id> tempResult = mahasenManager.getSearchResults(propertyName, value.trim());
                if (tempResult != null) {
                    idVector.addAll(tempResult);
                }
            }
            if (!idVector.isEmpty()) {
                Stack<Vector<Id>> idVectorSet = new Stack<Vector<Id>>();
                idVectorSet.push(idVector);
                idVectorSet.push(mahasenManager.getSearchResults(propertyName, value.trim()));
                idVector = getCommonIds(idVectorSet);

            }
        }
    } else if (propertyValue.contains("|")) {
        String values[] = propertyValue.split("\\|");
        for (String value : values) {

            Vector<Id> tempResult = mahasenManager.getSearchResults(propertyName, value.trim());
            if (tempResult != null) {
                for (Id id : tempResult) {
                    if (!idVector.contains(id)) {
                        idVector.add(id);
                    }
                }
            }

        }
    } else {
        idVector = mahasenManager.getSearchResults(propertyName, propertyValue.trim());
    }

    return idVector;
}

From source file:edu.ucsb.nceas.metacat.admin.GeoserverAdmin.java

/**
 * Handle configuration of the database the first time that Metacat starts
 * or when it is explicitly called. Collect necessary update information
 * from the administrator./*from w ww.  ja  v  a 2s  .c om*/
 * 
 * @param request
 *            the http request information
 * @param response
 *            the http response to be sent back to the client
 */
public void configureGeoserver(HttpServletRequest request, HttpServletResponse response) throws AdminException {

    String processForm = request.getParameter("processForm");
    String bypass = request.getParameter("bypass");
    String formErrors = (String) request.getAttribute("formErrors");

    if (processForm == null || !processForm.equals("true") || formErrors != null) {
        // The servlet configuration parameters have not been set, or there
        // were form errors on the last attempt to configure, so redirect to
        // the web form for configuring metacat

        try {
            // get the current metacat version and the database version. If
            // the database version is older that the metacat version, run
            // the appropriate scripts to get them synchronized.

            String username = PropertyService.getProperty("geoserver.username");
            String password = PropertyService.getProperty("geoserver.password");

            request.setAttribute("geoserver.username", username);
            request.setAttribute("geoserver.password", password);

            // Forward the request to the JSP page
            RequestUtil.forwardRequest(request, response, "/admin/geoserver-configuration.jsp", null);
        } catch (GeneralPropertyException gpe) {
            throw new AdminException("GeoserverAdmin.configureGeoserver - Problem getting or "
                    + "setting property while initializing system properties page: " + gpe.getMessage());
        } catch (MetacatUtilException mue) {
            throw new AdminException("GeoserverAdmin.configureGeoserver - utility problem while initializing "
                    + "system properties page:" + mue.getMessage());
        }
    } else if (bypass != null && bypass.equals("true")) {
        Vector<String> processingErrors = new Vector<String>();
        Vector<String> processingSuccess = new Vector<String>();

        // Bypass the geoserver configuration. This will not keep
        // Metacat from running.
        try {
            PropertyService.setProperty("configutil.geoserverConfigured", PropertyService.BYPASSED);

        } catch (GeneralPropertyException gpe) {
            String errorMessage = "GeoserverAdmin.configureGeoserver - Problem getting or setting property while "
                    + "processing system properties page: " + gpe.getMessage();
            logMetacat.error(errorMessage);
            processingErrors.add(errorMessage);
        }
        try {
            if (processingErrors.size() > 0) {
                RequestUtil.clearRequestMessages(request);
                RequestUtil.setRequestErrors(request, processingErrors);
                RequestUtil.forwardRequest(request, response, "/admin", null);
            } else {
                // Reload the main metacat configuration page
                processingSuccess.add("Geoserver configuration successfully bypassed");
                RequestUtil.clearRequestMessages(request);
                RequestUtil.setRequestSuccess(request, processingSuccess);
                RequestUtil.forwardRequest(request, response,
                        "/admin?configureType=configure&processForm=false", null);
            }
        } catch (MetacatUtilException mue) {
            throw new AdminException(
                    "GeoserverAdmin.configureGeoserver - utility problem while processing geoservices "
                            + "geoservices page: " + mue.getMessage());
        }

    } else {
        // The configuration form is being submitted and needs to be
        // processed, setting the properties in the configuration file
        // then restart metacat

        // The configuration form is being submitted and needs to be
        // processed.
        Vector<String> validationErrors = new Vector<String>();
        Vector<String> processingErrors = new Vector<String>();
        Vector<String> processingSuccess = new Vector<String>();

        try {
            // Validate that the options provided are legitimate. Note that
            // we've allowed them to persist their entries. As of this point
            // there is no other easy way to go back to the configure form
            // and preserve their entries.
            validationErrors.addAll(validateOptions(request));

            String username = (String) request.getParameter("geoserver.username");
            String password = (String) request.getParameter("geoserver.password");

            if (username == null || password == null) {
                validationErrors.add("User Name and Password can not be null");
            } else {
                HttpClient httpClient = new HttpClient();
                GeoserverUtil.loginAdmin(httpClient);
                GeoserverUtil.changePassword(httpClient, username, password);

                PropertyService.setPropertyNoPersist("geoserver.username", username);
                PropertyService.setPropertyNoPersist("geoserver.password", password);
                PropertyService.persistProperties();

                // write the backup properties to a location outside the
                // application directories so they will be available after
                // the next upgrade
                PropertyService.persistMainBackupProperties();
            }
        } catch (MetacatUtilException ue) {
            String errorMessage = "GeoserverAdmin.configureGeoserver - Error updating geoserver password: "
                    + ue.getMessage();
            logMetacat.error(errorMessage);
            processingErrors.add(errorMessage);
        } catch (GeneralPropertyException gpe) {
            String errorMessage = "GeoserverAdmin.configureGeoserver - Problem getting or setting property while "
                    + "processing system properties page: " + gpe.getMessage();
            logMetacat.error(errorMessage);
            processingErrors.add(errorMessage);
        }

        try {
            if (validationErrors.size() > 0 || processingErrors.size() > 0) {
                RequestUtil.clearRequestMessages(request);
                RequestUtil.setRequestFormErrors(request, validationErrors);
                RequestUtil.setRequestErrors(request, processingErrors);
                RequestUtil.forwardRequest(request, response, "/admin", null);
            } else {
                // Now that the options have been set, change the
                // 'propertiesConfigured' option to 'true'
                PropertyService.setProperty("configutil.geoserverConfigured", PropertyService.CONFIGURED);

                // Reload the main metacat configuration page
                processingSuccess.add("Geoserver successfully configured");
                RequestUtil.clearRequestMessages(request);
                RequestUtil.setRequestSuccess(request, processingSuccess);
                RequestUtil.forwardRequest(request, response,
                        "/admin?configureType=configure&processForm=false", null);
            }
        } catch (MetacatUtilException mue) {
            throw new AdminException(
                    "GeoserverAdmin.configureGeoserver - utility problem while processing geoservices "
                            + "geoservices page: " + mue.getMessage());
        } catch (GeneralPropertyException gpe) {
            throw new AdminException("GeoserverAdmin.configureGeoserver - problem with properties while "
                    + "processing geoservices configuration page: " + gpe.getMessage());
        }
    }
}

From source file:net.sf.mzmine.modules.peaklistmethods.dataanalysis.heatmaps.HeatMapTask.java

private double[][] groupingDataset(UserParameter selectedParameter, String referenceGroup) {
    // Collect all data files
    Vector<RawDataFile> allDataFiles = new Vector<RawDataFile>();
    DescriptiveStatistics meanControlStats = new DescriptiveStatistics();
    DescriptiveStatistics meanGroupStats = new DescriptiveStatistics();
    allDataFiles.addAll(Arrays.asList(peakList.getRawDataFiles()));

    // Determine the reference group and non reference group (the rest of
    // the samples) for raw data files
    List<RawDataFile> referenceDataFiles = new ArrayList<RawDataFile>();
    List<RawDataFile> nonReferenceDataFiles = new ArrayList<RawDataFile>();

    List<String> groups = new ArrayList<String>();
    MZmineProject project = MZmineCore.getCurrentProject();

    for (RawDataFile rawDataFile : allDataFiles) {

        Object paramValue = project.getParameterValue(selectedParameter, rawDataFile);
        if (!groups.contains(String.valueOf(paramValue))) {
            groups.add(String.valueOf(paramValue));
        }//  www .ja  v  a  2 s.  c  om
        if (String.valueOf(paramValue).equals(referenceGroup)) {

            referenceDataFiles.add(rawDataFile);
        } else {

            nonReferenceDataFiles.add(rawDataFile);
        }
    }

    int numRows = 0;
    for (int row = 0; row < peakList.getNumberOfRows(); row++) {

        if (!onlyIdentified || (onlyIdentified && peakList.getRow(row).getPeakIdentities().length > 0)) {
            numRows++;
        }
    }

    // Create a new aligned peak list with all the samples if the reference
    // group has to be shown or with only
    // the non reference group if not.
    double[][] dataMatrix = new double[groups.size() - 1][numRows];
    pValueMatrix = new String[groups.size() - 1][numRows];

    // data files that should be in the heat map
    List<RawDataFile> shownDataFiles = nonReferenceDataFiles;

    for (int row = 0, rowIndex = 0; row < peakList.getNumberOfRows(); row++) {
        PeakListRow rowPeak = peakList.getRow(row);
        if (!onlyIdentified || (onlyIdentified && rowPeak.getPeakIdentities().length > 0)) {
            // Average area or height of the reference group
            meanControlStats.clear();
            for (int column = 0; column < referenceDataFiles.size(); column++) {

                if (rowPeak.getPeak(referenceDataFiles.get(column)) != null) {

                    if (area) {

                        meanControlStats.addValue(rowPeak.getPeak(referenceDataFiles.get(column)).getArea());
                    } else {

                        meanControlStats.addValue(rowPeak.getPeak(referenceDataFiles.get(column)).getHeight());
                    }

                }
            }

            // Divide the area or height of each peak by the average of the
            // area or height of the reference peaks in each row
            int columnIndex = 0;
            for (int column = 0; column < groups.size(); column++) {
                String group = groups.get(column);
                meanGroupStats.clear();
                if (!group.equals(referenceGroup)) {

                    for (int dataColumn = 0; dataColumn < shownDataFiles.size(); dataColumn++) {

                        Object paramValue = project.getParameterValue(selectedParameter,
                                shownDataFiles.get(dataColumn));
                        if (rowPeak.getPeak(shownDataFiles.get(dataColumn)) != null
                                && String.valueOf(paramValue).equals(group)) {

                            Feature peak = rowPeak.getPeak(shownDataFiles.get(dataColumn));

                            if (!Double.isInfinite(peak.getArea()) && !Double.isNaN(peak.getArea())) {

                                if (area) {

                                    meanGroupStats.addValue(peak.getArea());
                                } else {

                                    meanGroupStats.addValue(peak.getHeight());
                                }
                            }

                        }
                    }

                    double value = meanGroupStats.getMean() / meanControlStats.getMean();
                    if (meanGroupStats.getN() > 1 && meanControlStats.getN() > 1) {
                        pValueMatrix[columnIndex][rowIndex] = this.getPvalue(meanGroupStats, meanControlStats);
                    } else {
                        pValueMatrix[columnIndex][rowIndex] = "";
                    }

                    if (log) {

                        value = Math.log(value);
                    }
                    dataMatrix[columnIndex++][rowIndex] = value;
                }
            }
            rowIndex++;
        }
    }

    // Scale the data dividing the peak area/height by the standard
    // deviation of each column
    if (scale) {
        scale(dataMatrix);
    }

    // Create two arrays: row and column names
    rowNames = new String[dataMatrix[0].length];
    colNames = new String[groups.size() - 1];

    int columnIndex = 0;
    for (String group : groups) {

        if (!group.equals(referenceGroup)) {

            colNames[columnIndex++] = group;
        }
    }
    for (int row = 0, rowIndex = 0; row < peakList.getNumberOfRows(); row++) {
        if (!onlyIdentified || (onlyIdentified && peakList.getRow(row).getPeakIdentities().length > 0)) {
            if (peakList.getRow(row).getPeakIdentities() != null
                    && peakList.getRow(row).getPeakIdentities().length > 0) {

                rowNames[rowIndex++] = peakList.getRow(row).getPreferredPeakIdentity().getName();
            } else {

                rowNames[rowIndex++] = "Unknown";
            }
        }
    }

    return dataMatrix;
}

From source file:org.dhatim.cdr.SmooksResourceConfigurationStore.java

/**
* Get all the SmooksResourceConfiguration entries registered on this context store
 * for the specified profile set./*from   ww  w.  ja  v  a  2  s  .  co m*/
* @param profileSet The profile set against which to lookup.
* @return All SmooksResourceConfiguration entries targeted at the specified useragent.
*/
public SmooksResourceConfiguration[] getSmooksResourceConfigurations(ProfileSet profileSet) {
    Vector allSmooksResourceConfigurationsColl = new Vector();
    SmooksResourceConfiguration[] allSmooksResourceConfigurations;

    // Iterate through each of the loaded SmooksResourceConfigurationLists.
    for (int i = 0; i < configLists.size(); i++) {
        SmooksResourceConfigurationList list = configLists.get(i);
        SmooksResourceConfiguration[] resourceConfigs = list.getTargetConfigurations(profileSet);

        allSmooksResourceConfigurationsColl.addAll(Arrays.asList(resourceConfigs));
    }

    allSmooksResourceConfigurations = new SmooksResourceConfiguration[allSmooksResourceConfigurationsColl
            .size()];
    allSmooksResourceConfigurationsColl.toArray(allSmooksResourceConfigurations);

    return allSmooksResourceConfigurations;
}

From source file:org.mahasen.util.SearchUtil.java

/**
 * @param searchParameters//  ww w  .  j  av a  2  s.c o m
 * @return
 * @throws MahasenException
 * @throws InterruptedException
 */
public Vector<String> multipleOrSearch(Hashtable<String, Vector<String>> searchParameters)
        throws MahasenException, InterruptedException {
    ArrayList<SearchBean> searchValues = createSearchBeans(searchParameters);
    Vector<String> fileNames = new Vector<String>();

    Vector<Id> finalResultIds = new Vector<Id>();
    for (SearchBean searchBean : searchValues) {
        Vector<Id> resultIds;
        if (searchBean.isRangeBased()) {
            resultIds = getRangeSearchResultIds(searchBean.getPropertyName(), searchBean.getInitialValue(),
                    searchBean.getLastValue());

        } else {
            resultIds = getSearchResultIds(searchBean.getPropertyName(), searchBean.getInitialValue());

        }

        if (finalResultIds.isEmpty()) {
            finalResultIds.addAll(resultIds);
        } else {
            for (Id id : resultIds) {
                if (!finalResultIds.contains(id)) {
                    finalResultIds.add(id);
                }
            }
        }
    }
    fileNames = getResultantFileNames(finalResultIds);
    return fileNames;
}