Example usage for java.lang Double toString

List of usage examples for java.lang Double toString

Introduction

In this page you can find the example usage for java.lang Double toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of this Double object.

Usage

From source file:com.nikolak.weatherapp.MainActivity.java

public void saveLocation(Double lat, Double lon) {
    long lastUpdateDate = System.currentTimeMillis() / 1000L;
    SharedPreferences.Editor prefEditor = settings.edit();
    prefEditor.putString("latitude", lat.toString());
    prefEditor.putString("longitude", lon.toString());
    prefEditor.putLong("lastUpdate", lastUpdateDate);
    prefEditor.apply();/*from  w ww.  jav  a 2s .  c  om*/
}

From source file:com.cloudera.flume.reporter.ganglia.GangliaSink.java

/**
 * This currently only outputs one metric from a report, and relies on the
 * sink constructor to give details about the typing information.
 * /* www.j  a  va  2s.  co m*/
 * This may become moot if typing information is provided by flume's data.
 */
@Override
public void append(Event e) throws IOException {
    String value;
    switch (type) {
    case LONG: {
        Long l = Attributes.readLong(e, attr);
        if (l == null) {
            // attribute not present, drop
            return;
        }
        value = l.toString();
        break;
    }
    case INT: {
        Integer i = Attributes.readInt(e, attr);
        if (i == null) {
            // attribute not present, drop
            return;
        }
        value = i.toString();
        break;
    }
    case STRING: {
        String s = Attributes.readString(e, attr);
        if (s == null) {
            // attribute not present, drop
            return;
        }
        value = s;
        break;
    }
    case DOUBLE: {
        Double d = Attributes.readDouble(e, attr);
        if (d == null) {
            // attribute not present,drop
            return;
        }
        value = d.toString();
        break;
    }
    default:
        return;
    }
    emitMetric(attr, typeTable.get(type), value, units);
    super.append(e);
}

From source file:net.metanotion.json.JsonWriter.java

@Override
public Handler<T> decimal(final Double val) {
    try {//  w w  w . j  ava  2 s .  c o  m
        out.append(val.toString());
        return this;
    } catch (final IOException ioe) {
        throw new RuntimeException(ioe);
    }
}

From source file:org.inbio.modeling.web.controller.IntervalsController.java

private void calculateDensity(GrassLayerDTO layer, Double resolution, String maxIntervalQuantity,
        Long currentSessionId) throws Exception {

    Double radioInMeters = Double.valueOf(layer.getCategories().get(0).getValue());
    Double conversionRate = Double.parseDouble(configManager.retrieveResolution());

    Double cellNumber = (radioInMeters * conversionRate) / resolution;

    if ((cellNumber % 2) == 0)
        cellNumber++;//from  w  w w  . ja v a2s .  c  om

    layer.getCategories().get(0).setValue(cellNumber.toString());

    try {
        this.grassManagerImpl.calculateDensity(layer, radioInMeters.toString(), maxIntervalQuantity,
                currentSessionId);
    } catch (Exception ex) {
        throw new Exception("errors.cantCreateImage", ex);
    }
}

From source file:edu.harvard.iq.dataverse.ingest.tabulardata.impl.plugins.rdata.RTabFileParser.java

public int read(BufferedReader csvReader, DataTable dataTable, PrintWriter pwout) throws IOException {
    dbgLog.warning("RTabFileParser: Inside R Tab file parser");

    int varQnty = 0;

    try {//from  w  w  w.j  a va2 s.  c o m
        varQnty = dataTable.getVarQuantity().intValue();
    } catch (Exception ex) {
        //return -1;
        throw new IOException("R Tab File Parser: Could not obtain varQnty from the dataset metadata.");
    }

    if (varQnty == 0) {
        //return -1;
        throw new IOException("R Tab File Parser: varQnty=0 in the dataset metadata!");
    }

    dbgLog.fine("CSV reader; varQnty: " + varQnty);
    dbgLog.fine("CSV reader; delimiter: " + delimiterChar);

    String[] caseRow = new String[varQnty];

    String line;
    String[] valueTokens;

    int lineCounter = 0;

    boolean[] isCharacterVariable = new boolean[varQnty];
    boolean[] isContinuousVariable = new boolean[varQnty];
    boolean[] isTimeVariable = new boolean[varQnty];
    boolean[] isBooleanVariable = new boolean[varQnty];

    if (dataTable.getDataVariables() != null) {
        for (int i = 0; i < varQnty; i++) {
            DataVariable var = dataTable.getDataVariables().get(i);
            if (var == null) {
                // throw exception!
            }
            if (var.getType() == null) {
                // throw exception!
            }
            if (var.isTypeCharacter()) {
                isCharacterVariable[i] = true;
                isContinuousVariable[i] = false;

                if (var.getFormatCategory() != null && (var.getFormatCategory().startsWith("date")
                        || var.getFormatCategory().startsWith("time"))) {
                    isTimeVariable[i] = true;
                }

            } else if (var.isTypeNumeric()) {
                isCharacterVariable[i] = false;

                if (var.getInterval() == null) {
                    // throw exception!
                }
                if (var.isIntervalContinuous()) {
                    isContinuousVariable[i] = true;
                } else {
                    // discrete by default:
                    isContinuousVariable[i] = false;
                    if (var.getFormatCategory() != null && var.getFormatCategory().equals("Boolean")) {
                        isBooleanVariable[i] = true;
                    }
                }
            } else {
                // throw excepion "unknown variable format type" - ?
            }

        }
    } else {
        // throw exception!
    }

    while ((line = csvReader.readLine()) != null) {
        // chop the line:
        line = line.replaceFirst("[\r\n]*$", "");
        valueTokens = line.split("" + delimiterChar, -2);

        if (valueTokens == null) {
            throw new IOException("Failed to read line " + (lineCounter + 1) + " of the Data file.");

        }

        if (valueTokens.length != varQnty) {
            throw new IOException("Reading mismatch, line " + (lineCounter + 1) + " of the Data file: "
                    + varQnty + " delimited values expected, " + valueTokens.length + " found.");
        }

        //dbgLog.fine("case: "+lineCounter);

        for (int i = 0; i < varQnty; i++) {
            //dbgLog.fine("value: "+valueTokens[i]);

            if (isCharacterVariable[i]) {
                // String. Adding to the table, quoted.
                // Empty strings stored as " " (one white space):
                if (valueTokens[i] != null && (!valueTokens[i].equals(""))) {
                    String charToken = valueTokens[i];
                    // Dealing with quotes: 
                    // remove the leading and trailing quotes, if present:
                    charToken = charToken.replaceFirst("^\"", "");
                    charToken = charToken.replaceFirst("\"$", "");
                    // escape the remaining ones:
                    charToken = charToken.replace("\"", "\\\"");
                    // final pair of quotes:
                    if (isTimeVariable == null || (!isTimeVariable[i])) {
                        charToken = "\"" + charToken + "\"";
                    }
                    caseRow[i] = charToken;
                } else {
                    // missing value:
                    caseRow[i] = "";
                }

            } else if (isContinuousVariable[i]) {
                // Numeric, Double:
                // This is the major case of special/custom processing,
                // specific for R ingest. It was found to be impossible
                // to write a numeric/continuous column into the tab file
                // while unambiguously preserving both NA and NaNs, if both
                // are present. At least, not if using the standard 
                // write.table function. So it seemed easier to treat this
                // as a special case, rather than write our own write.table
                // equivalent in R. On the R side, if any special values 
                // are present in the columns, the values will be 
                // converted into a character vector. The NAs and NaNs will 
                // be replaced with the character tokens "NA" and "NaN" 
                // respectively. Of course R will add double quotes around 
                // the tokens, hence the post-processing - we'll just need 
                // to remove all these quotes, and then we'll be fine. 

                dbgLog.fine("R Tab File Parser; double value: " + valueTokens[i]);
                // Dealing with quotes: 
                // remove the leading and trailing quotes, if present:
                valueTokens[i] = valueTokens[i].replaceFirst("^\"", "");
                valueTokens[i] = valueTokens[i].replaceFirst("\"$", "");
                if (valueTokens[i] != null && valueTokens[i].equalsIgnoreCase("NA")) {
                    caseRow[i] = "";
                } else if (valueTokens[i] != null && valueTokens[i].equalsIgnoreCase("NaN")) {
                    caseRow[i] = "NaN";
                } else if (valueTokens[i] != null && (valueTokens[i].equalsIgnoreCase("Inf")
                        || valueTokens[i].equalsIgnoreCase("+Inf"))) {
                    caseRow[i] = "Inf";
                } else if (valueTokens[i] != null && valueTokens[i].equalsIgnoreCase("-Inf")) {
                    caseRow[i] = "-Inf";
                } else {
                    try {
                        Double testDoubleValue = new Double(valueTokens[i]);
                        caseRow[i] = testDoubleValue.toString();//valueTokens[i];
                    } catch (Exception ex) {
                        dbgLog.fine("caught exception reading numeric value; variable: " + i + ", case: "
                                + lineCounter + "; value: " + valueTokens[i]);

                        //dataTable[i][lineCounter] = (new Double(0)).toString();
                        caseRow[i] = "";

                        // TODO:
                        // decide if we should rather throw an exception and exit here; 
                        // all the values in this file at this point must be 
                        // legit numeric values (?) -- L.A.
                    }
                }
            } else if (isBooleanVariable[i]) {
                if (valueTokens[i] != null) {
                    String charToken = valueTokens[i];
                    // remove the leading and trailing quotes, if present:
                    charToken = charToken.replaceFirst("^\"", "");
                    charToken = charToken.replaceFirst("\"$", "");

                    if (charToken.equals("FALSE")) {
                        caseRow[i] = "0";
                    } else if (charToken.equals("TRUE")) {
                        caseRow[i] = "1";
                    } else if (charToken.equals("")) {
                        // Legit case - Missing Value!
                        caseRow[i] = charToken;
                    } else {
                        throw new IOException(
                                "Unexpected value for the Boolean variable (" + i + "): " + charToken);
                    }
                } else {
                    throw new IOException("Couldn't read Boolean variable (" + i + ")!");
                }

            } else {
                // Numeric, Integer:
                // One special case first: R NA (missing value) needs to be 
                // converted into the DVN's missing value - an empty String;
                // (strictly speaking, this isn't necessary - an attempt to 
                // create an Integer object from the String "NA" would
                // result in an exception, that would be intercepted below,
                // with the same end result)
                dbgLog.fine("R Tab File Parser; integer value: " + valueTokens[i]);
                if (valueTokens[i] != null && valueTokens[i].equalsIgnoreCase("NA")) {
                    caseRow[i] = "";
                } else {
                    try {
                        Integer testIntegerValue = new Integer(valueTokens[i]);
                        caseRow[i] = testIntegerValue.toString();
                    } catch (Exception ex) {
                        dbgLog.fine("caught exception reading numeric value; variable: " + i + ", case: "
                                + lineCounter + "; value: " + valueTokens[i]);

                        //dataTable[i][lineCounter] = "0";
                        caseRow[i] = "";
                    }
                }
            }
        }

        pwout.println(StringUtils.join(caseRow, "\t"));

        lineCounter++;
    }

    //csvData.setData(dataTable);
    //return csvData;

    pwout.close();
    return lineCounter;
}

From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java

@Override
public String getNearestAirports(Double latitude, Double longitude, LanguageCode lang)
        throws HttpErrorResponseException {
    ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl();
    try {//w w  w.  ja  v a2 s. c  o  m
        URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("airports", ""),
                (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair("nearest",
                        latitude.toString() + "," + longitude.toString())),
                Arrays.asList((NameValuePair) new BasicNameValuePair("lang",
                        (lang == null) ? ("") : (lang.toString()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:net.ceos.project.poi.annotated.core.CsvHandler.java

/**
 * Apply a double value at the field./*  ww w.j  av  a 2 s  . c o  m*/
 * 
 * @param value
 *            the value
 * @param formatMask
 *            the decorator mask
 * @param transformMask
 *            the transformation mask
 * @return false if problem otherwise true
 */
protected static String toDouble(final Double value, final String formatMask, final String transformMask) {
    if (value != null) {
        if (StringUtils.isNotBlank(transformMask)) {
            // apply transformation mask
            DecimalFormat df = new DecimalFormat(transformMask);
            return df.format((Double) value).replace(Constants.COMMA, Constants.DOT);

        } else if (StringUtils.isNotBlank(formatMask)) {
            // apply format mask
            DecimalFormat df = new DecimalFormat(formatMask);
            return df.format((Double) value).replace(Constants.COMMA, Constants.DOT);

        } else {
            return value.toString().replace(Constants.COMMA, Constants.DOT); // the
            // exact
            // value
        }
    }
    return StringUtils.EMPTY; // empty field
}

From source file:com.google.flightmap.parsing.faa.amr.AviationMasterRecordParser.java

/**
 * Parse file and add airport data to the database.
 *//*from w ww. j a va2s .  c o  m*/
private void addAirportDataToDb() throws SQLException, IOException {
    final BufferedReader in = new BufferedReader(new FileReader(airportSourceFile));
    try {
        String line = in.readLine();
        if (line == null) {
            throw new RuntimeException("Airport Master Record file is empty.");
        }
        // Parse first line to determine headers
        final String[] headers = line.split("\\t");
        removeEnclosingQuotes(headers);
        final IndexedArray<String, String> fields = new IndexedArray<String, String>(headers);
        dbWriter.initAirportTables();
        dbWriter.initAirportCommTable();
        dbWriter.beginTransaction();
        // Parse airport lines
        while ((line = in.readLine()) != null) {
            fields.setFields(line.split("\\t"));
            // icao
            final String iata = fields.get(AIRPORT_LOCATION_ID_HEADER);
            final String icao = getIcao(iata);
            // name
            String name = fields.get(AIRPORT_FACILITY_NAME_HEADER);
            name = getAirportNameToDisplay(icao, name);
            // type
            String type = fields.get(AIRPORT_TYPE_HEADER);
            type = StringUtils.capitalize(type.toLowerCase());
            // city
            final String city = fields.get(AIRPORT_CITY_HEADER);
            // lat, lng
            final String latitudeS = fields.get(AIRPORT_LATITUDE_HEADER);
            final String longitudeS = fields.get(AIRPORT_LONGITUDE_HEADER);
            final LatLng position = LatLngParsingUtils.parseLatLng(latitudeS, longitudeS);
            // is_open
            final String status = fields.get(AIRPORT_STATUS_HEADER);
            final boolean isOpen = "O".equals(status);
            // is_public
            final String use = fields.get(AIRPORT_USE_HEADER);
            final boolean isPublic = "PU".equals(use);
            // is_towered
            final String controlTower = fields.get(AIRPORT_CONTROL_TOWER_HEADER);
            final boolean isTowered = "Y".equals(controlTower);
            // is_military
            final String ownership = fields.get(AIRPORT_OWNERSHIP_HEADER);
            final boolean isMilitary = ownership.startsWith("M");
            // cell_id
            int cellId = CustomGridUtil.getCellId(position);
            // rank: Insert bogus value, will be replaced in second run
            final int rank = -1;
            // Insert in airport db
            dbWriter.insertAirport(icao, name, type, city, position.lat, position.lng, isOpen, isPublic,
                    isTowered, isMilitary, cellId, rank);
            // Retrieve db id of freshly added airport
            final int id = dbReader.getAirportIdByIcao(icao);
            if (id == -1) {
                throw new RuntimeException("Could not determine db id of airport: " + icao);
            }
            // Map SiteNumber to icao code for future reference by runway parser
            final String siteNumber = fields.tryGet(AIRPORT_SITE_NUMBER_HEADER);
            siteNumberToId.put(siteNumber, id);

            // Common traffic advisory frequency. (CTAF)
            String ctaf = fields.tryGet(AIRPORT_CTAF_HEADER);
            if (ctaf != null && !ctaf.isEmpty()) {
                try { // Parse frequency and convert it back to String to eliminate leading/trailing 0s.
                    Double freq = Double.valueOf(ctaf);
                    ctaf = freq.toString();
                } catch (NumberFormatException nfe) {
                    // Safe to ignore exception here: frequency MAY be not parseable.
                }
                dbWriter.insertAirportComm(id, "CTAF", ctaf, null);
            }

            // Additional properties
            // Elevation
            final String elevation = fields.get(AIRPORT_ELEVATION_HEADER);
            addAirportProperty(id, AIRPORT_ELEVATION_HEADER, elevation);
            // Beacon Color
            final String beaconColor = AirportParsingUtils
                    .parseAirportBeaconColor(fields.tryGet(AIRPORT_BEACON_COLOR_HEADER));
            addAirportProperty(id, AIRPORT_BEACON_COLOR_HEADER, beaconColor);
            // Fuel Types
            final String fuelTypes = AirportParsingUtils
                    .parseAirportFuelTypes(fields.tryGet(AIRPORT_FUEL_TYPES_HEADER));
            addAirportProperty(id, AIRPORT_FUEL_TYPES_HEADER, fuelTypes);
            // Non-Commercial Landing Fee
            final String landingFee = AirportParsingUtils
                    .parseBoolean(fields.tryGet(AIRPORT_LANDING_FEE_HEADER));
            addAirportProperty(id, AIRPORT_LANDING_FEE_HEADER, landingFee);
            // Segmented circle
            final String segmentedCircle = AirportParsingUtils
                    .parseBoolean(fields.tryGet(AIRPORT_SEGMENTED_CIRCLE_HEADER));
            addAirportProperty(id, AIRPORT_SEGMENTED_CIRCLE_HEADER, segmentedCircle);
            // Effective date
            final String effectiveDate = fields.tryGet(AIRPORT_EFFECTIVE_DATE_HEADER);
            addAirportProperty(id, AIRPORT_EFFECTIVE_DATE_HEADER, effectiveDate);
            // Wind indicator 
            final String windIndicator = AirportParsingUtils
                    .parseAirportWindIndicator(fields.tryGet(AIRPORT_WIND_INDICATOR_HEADER));
            addAirportProperty(id, AIRPORT_WIND_INDICATOR_HEADER, windIndicator);
        }
        dbWriter.commit();
    } finally {
        in.close();
    }
}

From source file:gate.termraider.output.CsvGenerator.java

private void writeContent(PrintWriter writer, Term term, Double score, Set<String> documents,
        Integer frequency) {//from   w ww.  j a v  a2  s.  c o  m
    StringBuilder sb = new StringBuilder();
    sb.append(StringEscapeUtils.escapeCsv(term.getTermString()));
    sb.append(',');
    sb.append(StringEscapeUtils.escapeCsv(term.getLanguageCode()));
    sb.append(',');
    sb.append(StringEscapeUtils.escapeCsv(term.getType()));
    sb.append(',');
    sb.append(StringEscapeUtils.escapeCsv(this.scorePropertyName));
    sb.append(',');
    sb.append(StringEscapeUtils.escapeCsv(score.toString()));
    sb.append(',');
    sb.append(StringEscapeUtils.escapeCsv(Integer.toString(documents.size())));
    sb.append(',').append(StringEscapeUtils.escapeCsv(frequency.toString()));
    writer.println(sb.toString());
}

From source file:gov.nih.nci.caintegrator.analysis.server.GeneralizedLinearModelTaskR.java

public void run() {
    logger.debug("starting glm with " + this.getDebugRcommands());
    GeneralizedLinearModelRequest glmRequest = (GeneralizedLinearModelRequest) getRequest();
    glmResult = new GeneralizedLinearModelResult(glmRequest.getSessionId(), glmRequest.getTaskId());

    logger.info(getExecutingThreadName() + ": processing generalized linear model request=" + glmRequest);

    // Validate that all the groups are correct and not overlapping

    List<GLMSampleGroup> groups = glmRequest.getComparisonGroups();
    //groups.add((GLMSampleGroup) glmRequest.getBaselineGroup());

    boolean errorCondition = false;
    SampleGroup idsSeen = new SampleGroup();
    String errorMsg = null;/*from w  w  w .j  a  v a  2  s.  co  m*/
    for (SampleGroup group : groups) {
        if (group.size() < 2) {
            errorMsg = "Group: " + group.getGroupName() + " has less than two members. Sending exception.";
            logger.error(errorMsg);
            errorCondition = true;
            break;
        }

        if (idsSeen.containsAny(group)) {
            errorMsg = "Group: " + group.getGroupName() + " contains overlapping ids. Sending exception.";
            logger.error(errorMsg);
            errorCondition = true;
            break;
        }

        idsSeen.addAll(group);
    }

    if (errorCondition) {
        AnalysisServerException ex = new AnalysisServerException(
                "One or more groups have overlapping members or contain less than 3 entries.");
        ex.setFailedRequest(glmRequest);
        logger.error("Groups have overlapping members or less than 3 entries.");
        setException(ex);
        return;
    }

    // set the data file
    // check to see if the data file on the compute connection is the
    // same as that for the analysis task

    try {
        setDataFile(glmRequest.getDataFileName());
    } catch (AnalysisServerException e) {
        e.setFailedRequest(glmRequest);
        logger.error("Internal Error. Error setting data file to fileName for generalized linear model ="
                + glmRequest.getDataFileName());
        setException(e);
        return;
    }

    // Execute the tasks to perform the GLM analysis
    try {
        SampleGroup baselineGroup = glmRequest.getBaselineGroup();
        List<GLMSampleGroup> sampleGroups = glmRequest.getComparisonGroups();

        String glmPatients = "GLMPATIENTS";
        String glmGroups = "GLMGROUPS";
        logger.debug("building");
        List<String> allPatients = null;
        allPatients = createPatientList(baselineGroup, sampleGroups);
        String groupPatientCmd = getGlmPatientGroupCommand(glmPatients, allPatients);
        String groupNameCommand = getGlmGroupNameCommand(glmGroups, allPatients, baselineGroup, sampleGroups);
        logger.debug("about to invoke r");
        doRvoidEval(groupPatientCmd);
        doRvoidEval(groupNameCommand);
        logger.debug("invoking r");

        // Filter by gene variance to invrease performance
        Double geneVariance = glmRequest.getGeneVariance();
        String varianceCommand = "subMatrix<-GeneFilterVariance(dataMatrix," + geneVariance.toString() + ")";
        doRvoidEval(varianceCommand);
        String glmCommand = null;
        String commandName = null;

        StatisticalMethodType method = glmRequest.getStatisticalMethod();
        if (StatisticalMethodType.ANOVA.equals(method)) {
            commandName = "eagle.anova.array";
        } else if (StatisticalMethodType.GLM.equals(method)) {
            commandName = "eagle.glm.array";
        } else {
            throw new AnalysisServerException("Invalid Statistical Method");
        }

        List<CoVariateType> coVariateTypes = glmRequest.getCoVariateTypes();
        if (coVariateTypes == null || coVariateTypes.size() == 0) {
            glmCommand = "glmResult<-" + commandName + "(subMatrix, " + glmPatients + ", " + glmGroups
                    + ", FALSE, " + "null" + ")";
        } else {
            String matrixName = constructDataMatrix(allPatients, (GLMSampleGroup) baselineGroup, sampleGroups);
            glmCommand = "glmResult<-" + commandName + "(subMatrix, " + glmPatients + ", " + glmGroups
                    + ", TRUE, " + matrixName + ")";
        }

        doRvoidEval(glmCommand);

        // get the labels
        Vector reporterIds = doREval("glmReporters <- dimnames(glmResult)[[1]]").asVector();
        List<SampleGroup> resultSampleGroups = new ArrayList<SampleGroup>();

        if (glmRequest.getComparisonGroups().size() < 2
                && (glmRequest.getCoVariateTypes() == null || glmRequest.getCoVariateTypes().size() < 1)) {
            String groupId = doREval("glmGroups <- dimnames(glmResult)[[2]]").asString();
            resultSampleGroups.add(new SampleGroup(groupId));
        } else {
            Vector groupIds = new Vector();
            groupIds = doREval("glmGroups <- dimnames(glmResult)[[2]]").asVector();
            for (Object groupId : groupIds) {
                resultSampleGroups.add(new SampleGroup(((REXP) groupId).asString()));
            }
        }

        glmResult.setSampleGroups(resultSampleGroups);

        List<GeneralizedLinearModelResultEntry> entries = new ArrayList<GeneralizedLinearModelResultEntry>();
        for (int i = 0; i < reporterIds.size(); i++) {

            GeneralizedLinearModelResultEntry entry = new GeneralizedLinearModelResultEntry();
            String reporter = ((REXP) reporterIds.get(i)).asString();
            entry.setReporterId(reporter);
            double[] pvals = doREval("pval <- glmResult[" + (i + 1) + ",]").asDoubleArray();
            entry.setGroupPvalues(pvals);
            entries.add(entry);
        }
        glmResult.setGlmResultEntries(entries);
        logger.debug("reporterIds.size=" + reporterIds.size());
        logger.debug("groupIds.size=" + resultSampleGroups.size());

        // glmResult.setSampleGroups(sampleGroups);

    } catch (AnalysisServerException asex) {
        AnalysisServerException aex = new AnalysisServerException(
                "Problem computing GLM. Caught AnalysisServerException in FTestTaskR." + asex.getMessage());
        aex.setFailedRequest(glmRequest);
        setException(aex);
        logger.error("Caught AnalysisServerException in GLM");
        logStackTrace(logger, asex);
        return;
    } catch (Exception ex) {
        AnalysisServerException asex = new AnalysisServerException(
                "Internal Error. Caught Exception in GLM exClass=" + ex.getClass() + " msg=" + ex.getMessage());
        asex.setFailedRequest(glmRequest);
        setException(asex);
        logger.error("Caught Exception in GLM");
        logStackTrace(logger, ex);
        return;
    }

}