Example usage for java.util ArrayList isEmpty

List of usage examples for java.util ArrayList isEmpty

Introduction

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

Prototype

public boolean isEmpty() 

Source Link

Document

Returns true if this list contains no elements.

Usage

From source file:com.celements.web.plugin.cmd.RenameCommand.java

/**
 * /* w  ww .j  av a2s  .c  om*/
 * @param spaceName
 * @param newSpaceName
 * @param context
 * @return renamed pages
 */
public List<String> renameSpace(String spaceName, String newSpaceName, XWikiContext context) {
    ArrayList<String> renamedPages = new ArrayList<String>();
    try {
        for (String docName : context.getWiki().getSpaceDocsName(spaceName, context)) {
            String fullname = spaceName + "." + docName;
            String newDocName = newSpaceName + "." + docName;
            if (renameDoc(fullname, newDocName, true, context)) {
                renamedPages.add(docName);
            } else {
                mLogger.error(
                        "renameSpace: Failed to rename Document [" + fullname + "] to [" + newDocName + "].");
            }
        }
        if (!renamedPages.isEmpty()) {
            getWebUtils().flushMenuItemCache(context);
        }
    } catch (XWikiException exp) {
        mLogger.error("renameSpace: Failed to rename Space [" + spaceName + "] to [" + newSpaceName + "].",
                exp);
    }
    return renamedPages;
}

From source file:jeplus.EPlusTask.java

/**
 * Preprocess the input file (.imf/.idf), including calling EP-Macro
 * @param config/*w w w .j  av a 2  s  . com*/
 * @return Operation successful or not
 */
public boolean preprocessInputFile(JEPlusConfig config) {
    boolean ok = true;
    String[] SearchStrings = SearchStringList.toArray(new String[0]);
    String[] Newvals = AltValueList.toArray(new String[0]);
    if (WorkEnv.isIMF()) {
        // If the input template file is for EP-Macro (.imf)
        // Check if #fileprefix is available
        String fprefixstr = IDFmodel.getIncludeFilePrefix(WorkEnv.IDFDir + WorkEnv.IDFTemplate);
        if (fprefixstr != null) {
            File fprefix = new File(fprefixstr);
            if (!fprefix.isAbsolute()) {
                fprefix = new File(WorkEnv.IDFDir.concat(fprefixstr));
            }
            if (!(fprefix.isDirectory() && fprefix.exists())) {
                System.err.println("IMF processing error: ##fileprefix (" + fprefix.getAbsolutePath()
                        + ") is not a folder or does not exist. Current folder is assumed.");
                fprefix = new File(WorkEnv.IDFDir);
            }
            try {
                fprefixstr = fprefix.getCanonicalPath();
            } catch (IOException ex) {
                logger.error("", ex);
                ok = false;
            }
        }
        // Update the imf template
        ok = ok && EPlusWinTools.updateIMFFile(WorkEnv.IDFDir + WorkEnv.IDFTemplate, fprefixstr, SearchStrings,
                Newvals, getWorkingDir());
        if (ok) {
            // If imf template was successfully updated ("in.imf" is created), run EP-Macro
            EPlusWinTools.runEPMacro(config, getWorkingDir());
            // Test EP-Macro was successful or not by checking the presence of "out.idf"
            ok = EPlusWinTools.isFileAvailable("out.idf", getWorkingDir());
            // If ok, update the out.idf with the search strings and values again.
            ok = (ok && EPlusWinTools.updateIDFFile(getWorkingDir() + "out.idf", SearchStrings, Newvals,
                    getWorkingDir()));
        }
    } else {
        // Otherwise it is for EPlus (.idf)
        ok = EPlusWinTools.updateIDFFile(WorkEnv.IDFDir + WorkEnv.IDFTemplate, SearchStrings, Newvals,
                getWorkingDir());
    }
    if (ok) {
        // Collect E+ include files (e.g. in Schedule:File objects)
        ArrayList<String> incfiles = IDFmodel.getScheduleFiles(getWorkingDir() + EPlusConfig.getEPDefIDF());
        if (!incfiles.isEmpty()) {
            try (PrintWriter outs = (config.getScreenFile() == null) ? null
                    : new PrintWriter(new FileWriter(getWorkingDir() + config.getScreenFile(), true));) {
                if (outs != null) {
                    outs.println("# Copying dependant files - " + (new SimpleDateFormat()).format(new Date()));
                    outs.flush();
                }
                // Copy them to working dir
                for (String incfile : incfiles) {
                    File ori = new File(RelativeDirUtil.checkAbsolutePath(incfile, WorkEnv.IDFDir));
                    File dest = new File(getWorkingDir() + ori.getName());
                    try {
                        // Log to console.log
                        if (outs != null) {
                            outs.println(incfile);
                            outs.flush();
                        }
                        FileUtils.copyFile(ori, dest);
                    } catch (IOException ex) {
                        logger.error("", ex);
                        // Log to console.log
                        if (outs != null) {
                            outs.println(ex.getMessage());
                            outs.flush();
                        }
                        ok = false;
                        break;
                    }
                }
            } catch (Exception ex) {
                logger.error("", ex);
            }
        }
        // Update idf
        if (ok && incfiles.size() > 0) {
            ok = IDFmodel.replaceScheduleFiles(getWorkingDir() + EPlusConfig.getEPDefIDF(), incfiles);
        }
    }
    return ok;
}

From source file:com.fusesource.forge.jmstest.executor.BenchmarkProbeWrapper.java

private List<JMXConnectionFactory> getJmxConnectionFactories(final BenchmarkProbeConfig probeConfig) {

    ArrayList<JMXConnectionFactory> result = new ArrayList<JMXConnectionFactory>();
    String jmxNamePattern = probeConfig
            .getPreferredJmxConnectionFactoryName(getContainer().getClientInfo().getClientName());

    for (String name : getApplicationContext().getBeanNamesForType(JMXConnectionFactory.class)) {
        if (name.matches(jmxNamePattern)) {
            log().debug("Using JMX ConnectionFactory : " + name);
            result.add((JMXConnectionFactory) getApplicationContext().getBean(name));
        }/* ww w.  j a  v  a  2s .c  o  m*/
    }

    if (result.isEmpty()) {
        result.add((JMXConnectionFactory) getBean(
                new String[] {
                        JMXConnectionFactory.DEFAULT_JMX_CONNECTION_FACTORY_NAME + "-"
                                + getContainer().getClientInfo().getClientName(),
                        JMXConnectionFactory.DEFAULT_JMX_CONNECTION_FACTORY_NAME },
                JMXConnectionFactory.class));
    }

    if (result.isEmpty()) {
        log().warn("Could not resolve jmxConnectionFactory. Creating default.");
        JMXConnectionFactory cf = new JMXConnectionFactory();
        cf.setUsername("smx");
        cf.setPassword("smx");
        result.add(cf);
    }

    return result;
}

From source file:main.ScorePipeline.java

/**
 * Run the spectrum similarity pipeline.
 *
 * @param isGUI true if the GUI is asked, false: a standalone version
 *
 * @throws IOException in case of an I/O related problem
 * @throws FileNotFoundException in case of file opening related problem
 * @throws ClassNotFoundException in case of a class loading by name problem
 * @throws MzMLUnmarshallerException in case of an MzML parsing related
 * problem//ww  w .j  a  v  a  2s .  c o  m
 * @throws IllegalArgumentException in case of an in appropriate argument
 * was passed
 * @throws NumberFormatException in case of a numeric conversion related
 * problem
 * @throws InterruptedException in case of an inactive thread interruption
 * problem
 */
public static void run(boolean isGUI) throws IOException, FileNotFoundException, ClassNotFoundException,
        MzMLUnmarshallerException, IllegalArgumentException, NumberFormatException, InterruptedException {
    //send an event
    sendAnalyticsEvent();
    if (isGUI) {
        LOGGER = Logger.getLogger(MainController.class);
    }
    String thydFolder = ConfigHolder.getInstance().getString("spectra.folder"),
            tsolFolder = ConfigHolder.getInstance().getString("spectra.to.compare.folder"),
            outputFolder = ConfigHolder.getInstance().getString("output.folder");
    int transformation = ConfigHolder.getInstance().getInt("transformation"), // 0-Nothing 1- Log2 2-Square root
            noiseFiltering = ConfigHolder.getInstance().getInt("noise.filtering"), // 0-Nothing 1- PrideAsap 2-TopN 3-Discard peaks less than 5% of precursor
            topN = ConfigHolder.getInstance().getInt("topN"), // Top intense N peaks
            msRobinCalculationOption = 1, // Calculation is  #0: -10*Log10(Pro)*SQRT(IP)) #1: -10*Log10(Pro)*IP #2: -Log10(Pro*IP) #3: (1-Pro)*IP
            calculationOptionIntensityMSRobin = 1; // IP is calculated as 0:Summing up intensity-ratios #1:Multiply intensity-ratios #2:Math.pow(10, (1-IP))
    boolean is_charged_based = ConfigHolder.getInstance().getBoolean("is.charged.based"), // F- All against all T-only the same charge state 2-bigger than 4, check against all
            is_hq_data = false, //removed is.hq = true from MS2Similarity.properties
            is_precursor_peak_removed = ConfigHolder.getInstance().getBoolean("precursor.peak.removal"),
            doesCalculateOnly5 = ConfigHolder.getInstance().getBoolean("calculate.only5"),
            isNFTR = ConfigHolder.getInstance().getBoolean("isNFTR");
    double min_mz = 100, // To start binning (removed min.mz from MS2Similarity.properties because only for cumulative binomial scoring function)
            max_mz = 3500, // To end binning (removed max.mz from MS2Similarity.properties because only for cumulative binomial scoring function)
            fragment_tolerance = ConfigHolder.getInstance().getDouble("fragment.tolerance"), // A bin size if 2*0.5
            percentage = ConfigHolder.getInstance().getDouble("percent"),
            precTol = ConfigHolder.getInstance().getDouble("precursor.tolerance"); // 0-No PM tolerance otherwise the exact mass difference
    int sliceIndex = ConfigHolder.getInstance().getInt("slice.index"),
            maxCharge = ConfigHolder.getInstance().getInt("max.charge");
    // Select a scoring function name as msrobin (this is pROBility INtensity weighted scoring function, dot, spearman, and pearson (all lower case))
    String scoreType = "msrobin"; // Avaliable scoring functions: msrobin/spearman/pearson/dot

    /// SETTINGS//////////////////////////////////////////
    File thydatigenas_directory = new File(thydFolder), tsoliums_directory = new File(tsolFolder);

    // prepare a title on an output file
    String noiseFilteringInfo = "None", transformationInfo = "None", precursorPeakRemoval = "On",
            chargeBased = "None", precTolBased = "0";
    if (!is_precursor_peak_removed) {
        precursorPeakRemoval = "None";
    }
    if (noiseFiltering == 1) {
        noiseFilteringInfo = "Pride";
    } else if (noiseFiltering == 2) {
        noiseFilteringInfo = "TopN";
    } else if (noiseFiltering == 3) {
        noiseFilteringInfo = "DiscardLowAbundance";
    }
    if (transformation == 1) {
        transformationInfo = "Log2";
    } else if (transformation == 2) {
        transformationInfo = "Sqrt";
    }
    if (is_charged_based) {
        chargeBased = "givenCharge";
    }
    if (precTol > 0) {
        precTolBased = String.valueOf(precTol);
    }

    String param = "NF_" + noiseFilteringInfo + "_TR_" + transformationInfo + "_PPR_" + precursorPeakRemoval
            + "_CHR_" + chargeBased + "_PRECTOL_" + precTolBased,
            paramTitle = "_NF_" + noiseFiltering + "_TR_" + transformation + "_PPR_" + precursorPeakRemoval
                    + "_CHR_" + is_charged_based + "_PRECTOL_" + precTol;

    if (is_hq_data) {
        paramTitle = "_HQ_" + paramTitle;
        param = "HQ_" + param;
    }
    switch (scoreType) {
    case "msrobin":
        param += "_MSRobin";
        break;
    case "dot":
        param += "_Dot";
        break;
    case "spearman":
        param += "_Spearman";
        break;
    case "pearson":
        param += "_Pearson";
        break;
    default:
        LOGGER.info(
                "Selected scoring name is not avaliable. Available functions are msrobin, do, spearman and pearson");
        System.exit(0);
    }
    param += ".txt";

    File output = new File(outputFolder + File.separator + param);
    // write a title on an output
    try (BufferedWriter bw = new BufferedWriter(new FileWriter(output))) {
        // write a title on an output
        String title_score_type = scoreType;
        if (scoreType.endsWith("msrobin")) {
            title_score_type = "ScoringFunction_Pipeline";
        }
        String version = ConfigHolder.getInstance().getString("score.pipeline.version");
        LOGGER.info("The version of score.pipeline :" + version);
        bw.write("The version of Score.Pipeline is " + version + "\n");
        bw.write("Spectrum Title" + "\t" + "Charge" + "\t" + "PrecursorMZ" + "\t"
                + "Spectrum_Title_Comparison_Dataset" + "\t" + title_score_type + paramTitle + "\n");

        /// RUNNING //////////////////////////////////////////
        int[] charges = new int[maxCharge]; // restricting to only charge state based
        int i = 0;
        for (int charge = 2; charge < maxCharge; charge++) {
            charges[i] = charge;
            i++;
        }
        LOGGER.info("Run is ready to start with " + param + " for " + scoreType);
        LOGGER.info("Only calculate +/-2 slices up and down: " + doesCalculateOnly5);
        //Get indices for each spectrum..

        int index = 1;
        for (File thyd : thydatigenas_directory.listFiles()) {
            if (thyd.getName().endsWith(".mgf")) {
                for (File tsol : tsoliums_directory.listFiles()) {
                    if (tsol.getName().endsWith(".mgf")) {
                        if (doesCalculateOnly5) {
                            int tsolIndex = Integer.parseInt(tsol.getName().split("_")[sliceIndex].substring(0,
                                    tsol.getName().split("_")[sliceIndex].indexOf(".mgf"))),
                                    thydIndex = Integer
                                            .parseInt(thyd.getName().split("_")[sliceIndex].substring(0,
                                                    thyd.getName().split("_")[sliceIndex].indexOf(".mgf")));
                            // Now select an mgf files from the same slices..
                            if (index - 2 <= thydIndex && thydIndex <= index + 2 && tsolIndex == index) {
                                LOGGER.info("slice number (spectra.folder and spectra.folder.to.compare)="
                                        + thydIndex + "\t" + tsolIndex);
                                LOGGER.info("a name of an mgf from the spectra.folder=" + thyd.getName());
                                LOGGER.info("a name of an mgf from the spectra.folder.to.compare="
                                        + tsol.getName());
                                if (!scoreType.equals("msrobin")) {
                                    // Run against all - no restriction for binned based calculation
                                    if (!is_charged_based) {
                                        ArrayList<BinMSnSpectrum> thydBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(
                                                thyd, min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                transformation, topN, is_precursor_peak_removed, 0, isNFTR),
                                                tsolBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(tsol,
                                                        min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                        transformation, topN, is_precursor_peak_removed, 0,
                                                        isNFTR);
                                        if (!thydBinSpectra.isEmpty() && !tsolBinSpectra.isEmpty()) {
                                            LOGGER.info("Size of BinSpectra at spectra.folder="
                                                    + thydBinSpectra.size());
                                            LOGGER.info("Size of BinSpectra at spectra.to.compare.folder="
                                                    + tsolBinSpectra.size());
                                            calculate_BinBasedScores(thydBinSpectra, tsolBinSpectra, bw, 0,
                                                    precTol, fragment_tolerance, scoreType);
                                        }
                                        // Run only the same charge state
                                    } else if (is_charged_based) {
                                        for (int charge : charges) {
                                            ArrayList<BinMSnSpectrum> thydBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(
                                                    thyd, min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                    transformation, topN, is_precursor_peak_removed, charge,
                                                    isNFTR),
                                                    tsolBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(
                                                            tsol, min_mz, max_mz, fragment_tolerance,
                                                            noiseFiltering, transformation, topN,
                                                            is_precursor_peak_removed, charge, isNFTR);
                                            if (!thydBinSpectra.isEmpty() && !tsolBinSpectra.isEmpty()) {
                                                LOGGER.info("Size of BinSpectra at spectra.folder="
                                                        + thydBinSpectra.size());
                                                LOGGER.info("Size of BinSpectra at spectra.to.compare.folder="
                                                        + tsolBinSpectra.size());
                                                calculate_BinBasedScores(thydBinSpectra, tsolBinSpectra, bw,
                                                        charge, precTol, fragment_tolerance, scoreType);
                                            }
                                        }
                                    }
                                } else if (!is_charged_based) {
                                    // Run against all for MSRobin
                                    ArrayList<MSnSpectrum> thydMSnSpectra = prepareData(thyd, transformation,
                                            noiseFiltering, topN, percentage, is_precursor_peak_removed, 0,
                                            fragment_tolerance),
                                            tsolMSnSpectra = prepareData(tsol, transformation, noiseFiltering,
                                                    topN, percentage, is_precursor_peak_removed, 0,
                                                    fragment_tolerance);
                                    if (!thydMSnSpectra.isEmpty() && !tsolMSnSpectra.isEmpty()) {

                                        LOGGER.info("Size of MSnSpectra at spectra.folder="
                                                + thydMSnSpectra.size());
                                        LOGGER.info("Size of MSnSpectra at spectra.to.compare.folder="
                                                + tsolMSnSpectra.size());

                                        calculate_MSRobins(tsolMSnSpectra, thydMSnSpectra, bw,
                                                fragment_tolerance, precTol, calculationOptionIntensityMSRobin,
                                                msRobinCalculationOption);
                                    }
                                } else if (is_charged_based) {
                                    for (int charge : charges) {
                                        ArrayList<MSnSpectrum> thydMSnSpectra = prepareData(thyd,
                                                transformation, noiseFiltering, topN, percentage,
                                                is_precursor_peak_removed, charge, fragment_tolerance),
                                                tsolMSnSpectra = prepareData(tsol, transformation,
                                                        noiseFiltering, topN, percentage,
                                                        is_precursor_peak_removed, charge, fragment_tolerance);
                                        if (!thydMSnSpectra.isEmpty() && !tsolMSnSpectra.isEmpty()) {
                                            LOGGER.info("Charge=" + charge);
                                            LOGGER.info("Size of MSnSpectra at spectra.folder="
                                                    + thydMSnSpectra.size());
                                            LOGGER.info("Size of MSnSpectra at spectra.to.compare.folder="
                                                    + tsolMSnSpectra.size());
                                            calculate_MSRobins(tsolMSnSpectra, thydMSnSpectra, bw,
                                                    fragment_tolerance, precTol,
                                                    calculationOptionIntensityMSRobin,
                                                    msRobinCalculationOption);
                                        }
                                    }
                                }
                            }
                            // Calculate all against all..
                        } else {
                            //                            LOGGER.info("slice number (spectra.folder and spectra.to.compare.folder)=" + thydIndex + "\t" + tsolIndex);
                            LOGGER.info("a name of an mgf from the spectra.folder=" + thyd.getName());
                            LOGGER.info(
                                    "a name of an mgf from the spectra.to.compare.folder=" + tsol.getName());
                            if (!scoreType.equals("msrobin")) {
                                // Run against all - no restriction for binned based calculation
                                if (!is_charged_based) {
                                    ArrayList<BinMSnSpectrum> thydBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(
                                            thyd, min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                            transformation, topN, is_precursor_peak_removed, 0, isNFTR),
                                            tsolBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(tsol,
                                                    min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                    transformation, topN, is_precursor_peak_removed, 0, isNFTR);
                                    LOGGER.info("Size of BinMSnSpectra spectra at spectra.folder="
                                            + thydBinSpectra.size());
                                    LOGGER.info("Size of BinMSnSpectra spectra at spectra.to.compare.folder="
                                            + tsolBinSpectra.size());
                                    calculate_BinBasedScores(thydBinSpectra, tsolBinSpectra, bw, 0, precTol,
                                            fragment_tolerance, scoreType);
                                    // Run only the same charge state
                                } else if (is_charged_based) {
                                    for (int charge : charges) {
                                        ArrayList<BinMSnSpectrum> thydBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(
                                                thyd, min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                transformation, topN, is_precursor_peak_removed, charge,
                                                isNFTR),
                                                tsolBinSpectra = convert_all_MSnSpectra_to_BinMSnSpectra(tsol,
                                                        min_mz, max_mz, fragment_tolerance, noiseFiltering,
                                                        transformation, topN, is_precursor_peak_removed, charge,
                                                        isNFTR);
                                        LOGGER.info("Size of BinMSnSpectra spectra at spectra.folder="
                                                + thydBinSpectra.size());
                                        LOGGER.info(
                                                "Size of BinMSnSpectra spectra at spectra.to.compare.folder="
                                                        + tsolBinSpectra.size());
                                        calculate_BinBasedScores(thydBinSpectra, tsolBinSpectra, bw, charge,
                                                precTol, fragment_tolerance, scoreType);
                                    }
                                }
                            } else if (!is_charged_based) {
                                // Run against all for MSRobin
                                ArrayList<MSnSpectrum> thydMSnSpectra = prepareData(thyd, transformation,
                                        noiseFiltering, topN, percentage, is_precursor_peak_removed, 0,
                                        fragment_tolerance),
                                        tsolMSnSpectra = prepareData(tsol, transformation, noiseFiltering, topN,
                                                percentage, is_precursor_peak_removed, 0, fragment_tolerance);
                                LOGGER.info("Size of MSnSpectra at spectra.folder=" + thydMSnSpectra.size());
                                LOGGER.info("Size of MSnSpectra at spectra.to.compare.folder="
                                        + tsolMSnSpectra.size());

                                calculate_MSRobins(tsolMSnSpectra, thydMSnSpectra, bw, fragment_tolerance,
                                        precTol, calculationOptionIntensityMSRobin, msRobinCalculationOption);
                            } else if (is_charged_based) {
                                for (int charge : charges) {
                                    ArrayList<MSnSpectrum> thydMSnSpectra = prepareData(thyd, transformation,
                                            noiseFiltering, topN, percentage, is_precursor_peak_removed, charge,
                                            fragment_tolerance),
                                            tsolMSnSpectra = prepareData(tsol, transformation, noiseFiltering,
                                                    topN, percentage, is_precursor_peak_removed, charge,
                                                    fragment_tolerance);
                                    LOGGER.info(
                                            "Size of MSnSpectra at spectra.folder=" + thydMSnSpectra.size());
                                    LOGGER.info("Size of MSnSpectra at spectra.to.compare.folder="
                                            + tsolMSnSpectra.size());
                                    calculate_MSRobins(tsolMSnSpectra, thydMSnSpectra, bw, fragment_tolerance,
                                            precTol, calculationOptionIntensityMSRobin,
                                            msRobinCalculationOption);
                                }
                            }
                        }
                    }
                }
            }
            index++;
        }
    }
    //        System.exit(0);
}

From source file:userInteface.Patient.ManageVitalSignsJPanel.java

private void createChart() {
    DefaultCategoryDataset vitalSignDataset = new DefaultCategoryDataset();
    int selectedRow = viewPatientsJTable.getSelectedRow();
    Person person = (Person) viewPatientsJTable.getValueAt(selectedRow, 0);
    Patient patient = person.getPatient();
    if (patient == null) {
        JOptionPane.showMessageDialog(this, "Patient not created, Please create Patient first.", "Error",
                JOptionPane.ERROR_MESSAGE);
        return;/*from ww w.  j  av  a 2  s  .co  m*/
    }

    ArrayList<VitalSign> vitalSignList = patient.getVitalSignHistory().getHistory();
    /*At least 2 vital sign records needed to show chart */
    if (vitalSignList.isEmpty() || vitalSignList.size() == 1) {
        JOptionPane.showMessageDialog(this,
                "No vital signs or only one vital sign found. At least 2 vital sign records needed to show chart!",
                "Warning", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    for (VitalSign vitalSign : vitalSignList) {
        vitalSignDataset.addValue(vitalSign.getRespiratoryRate(), "RR", vitalSign.getTimestamp());
        vitalSignDataset.addValue(vitalSign.getHeartRate(), "HR", vitalSign.getTimestamp());
        vitalSignDataset.addValue(vitalSign.getBloodPressure(), "BP", vitalSign.getTimestamp());
        vitalSignDataset.addValue(vitalSign.getWeight(), "WT", vitalSign.getTimestamp());
    }

    JFreeChart vitalSignChart = ChartFactory.createBarChart3D("Vital Sign Chart", "Time Stamp", "Rate",
            vitalSignDataset, PlotOrientation.VERTICAL, true, false, false);
    vitalSignChart.setBackgroundPaint(Color.white);
    CategoryPlot vitalSignChartPlot = vitalSignChart.getCategoryPlot();
    vitalSignChartPlot.setBackgroundPaint(Color.lightGray);

    CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis();
    vitalSignDomainAxis
            .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis();
    vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    ChartFrame chartFrame = new ChartFrame("Chart", vitalSignChart);
    chartFrame.setVisible(true);
    chartFrame.setSize(500, 500);

}

From source file:gov.nih.nci.integration.catissue.client.CaTissueParticipantClient.java

private String getShortTitleForParticipant(Participant participant) {
    String shortTitle = "";
    final ArrayList<CollectionProtocolRegistration> cprColl = new ArrayList<CollectionProtocolRegistration>(
            participant.getCollectionProtocolRegistrationCollection());
    if (!cprColl.isEmpty()) {
        // We are expecting only ONE CPR here
        final CollectionProtocolRegistration cpr = cprColl.get(0);
        final CollectionProtocol collectionProtocol = cpr.getCollectionProtocol();
        shortTitle = collectionProtocol.getShortTitle();
    }//from  w  ww . j  av  a 2 s.  co  m
    return shortTitle;
}

From source file:lyonlancer5.karasu.block.BlockRedstoneWire.java

/**
 * Creates a list of all horizontal sides that can get powered by a wire.
 * The list is ordered the same as the facingsHorizontal.
 * /*from w w w.j  a va 2s . c o  m*/
 * @param worldIn   World
 * @param pos      Position of the wire
 * @return         List of all facings that can get powered by this wire
 */
private List<EnumFacing> getSidesToPower(World worldIn, BlockPos pos) {
    ArrayList<EnumFacing> retval = Lists.<EnumFacing>newArrayList();
    for (EnumFacing facing : facingsHorizontal) {
        if (isPowerSourceAt(worldIn, pos, facing))
            retval.add(facing);
    }
    if (retval.isEmpty())
        return Lists.<EnumFacing>newArrayList(facingsHorizontal);
    boolean northsouth = retval.contains(EnumFacing.NORTH) || retval.contains(EnumFacing.SOUTH);
    boolean eastwest = retval.contains(EnumFacing.EAST) || retval.contains(EnumFacing.WEST);
    if (northsouth) {
        retval.remove(EnumFacing.EAST);
        retval.remove(EnumFacing.WEST);
    }
    if (eastwest) {
        retval.remove(EnumFacing.NORTH);
        retval.remove(EnumFacing.SOUTH);
    }
    return retval;
}

From source file:data.services.BaseParamService.java

public void addHeap(String heap) {
    String[] baseParamsplit = heap.trim().split(";;");
    String exception = "";
    int cnt = 0;//from   www .  ja v a 2 s.  c o  m
    for (String param : baseParamsplit) {
        cnt++;
        if (!param.equals("")) {
            String[] paramslist = param.split("::");
            try {
                BaseParam exampl = getBaseParam(paramslist);
                /*BaseParam supbp = new BaseParam();
                 supbp.setUid(paramslist[0].trim());*/
                if (validate(exampl)) {
                    if (!exampl.getUid().equals("")) {
                        List<BaseParam> oldParamList = baseParamDao.findByUid(paramslist[0]);
                        if (!oldParamList.isEmpty()) {
                            for (BaseParam obp : oldParamList) {
                                percentParamService.delete(obp);
                                baseParamDao.delete(obp);
                            }
                            baseParamDao.save(exampl);
                        } else {
                            baseParamDao.save(exampl);
                        }
                        if (!paramslist[9].equals("")) {
                            ArrayList<PercentParam> percParamList = getPercentParams(exampl,
                                    paramslist[9].trim());
                            if (!percParamList.isEmpty()) {
                                for (PercentParam pp : percParamList) {
                                    percentParamService.createParam(pp);
                                }
                            }
                        }
                    } else {
                        addError(" " + cnt + ": UID    ?");
                    }
                }
            } catch (Exception e) {
                addError(" " + cnt + ":" + StringAdapter.getStackTraceException(e));
            }
        }
    }
}

From source file:com.moorestudio.seniorimageprocessing.SeniorSorter.java

public void sortImages() {
    LinkedList<Map.Entry<String, Long>> timestampList = new LinkedList<>(timestampData.entrySet());
    sort(timestampList, (x, y) -> x.getValue() > y.getValue() ? -1 : x.getValue().equals(y.getValue()) ? 0 : 1);
    // Sort in reverse so that the most recent timestamps are first.e so that the most recent timestamps are first.

    LinkedList<Map.Entry<File, Long>> imageDataList = new LinkedList<>(imageData.entrySet());
    sort(imageDataList, (x, y) -> x.getValue() > y.getValue() ? -1 : x.getValue().equals(y.getValue()) ? 0 : 1); // Sort in reverse so that the most recent timestamps are first.

    // For the gui update
    int idCount = imageDataList.size();

    //Take the first image and the first timestamp scan taken, which is last in the list, 
    //and sync the camera time to the timestamp time.Both are throwaways.
    if (!timestampList.isEmpty() && !imageDataList.isEmpty() && parent.syncTime) {
        Map.Entry<File, Long> iData = imageDataList.pollLast();
        Map.Entry<String, Long> tsData = timestampList.pollLast();

        //Make the offset
        cameraTimeOffset = tsData.getValue() - iData.getValue();
    }/*w w  w.ja  v  a 2 s  .c om*/

    //add the file to the top timestamp student until it is no longer more than it
    while (!timestampList.isEmpty() && !imageDataList.isEmpty()) {
        Map.Entry<File, Long> iData = imageDataList.peekFirst();
        Map.Entry<String, Long> tsData = timestampList.pollFirst();
        ArrayList<File> studentImages = new ArrayList<>();
        while (!imageDataList.isEmpty() && iData.getValue() + cameraTimeOffset > tsData.getValue()) {
            iData = imageDataList.pollFirst();
            studentImages.add(iData.getKey());
            iData = imageDataList.peekFirst();
            //update the GUI
            parent.addProgress((.125 / parent.numThreads) / idCount);
        }
        if (!studentImages.isEmpty()) {
            parent.addImagesToStudent(tsData.getKey(), studentImages);
        }
    }

    //add the unsorted images to the parent's unsorted queue
    for (Map.Entry<File, Long> entry : imageDataList) {
        parent.unsortedFiles.add(entry.getKey());
        //update the GUI
        parent.addProgress((.125 / parent.numThreads) / idCount);
    }
}