Example usage for java.lang Float doubleValue

List of usage examples for java.lang Float doubleValue

Introduction

In this page you can find the example usage for java.lang Float doubleValue.

Prototype

public double doubleValue() 

Source Link

Document

Returns the value of this Float as a double after a widening primitive conversion.

Usage

From source file:org.apache.stanbol.enhancer.engine.disambiguation.mlt.DisambiguatorEngine.java

protected List<Suggestion> rankResults(QueryResultList<Entity> results, boolean casesensitive, String language,
        String savedEntityLabel) {
    List<Suggestion> matches = new ArrayList<Suggestion>(results.size());
    Float maxScore = null;/* ww w  . j av  a 2  s .c o m*/
    Float maxExactScore = null;

    for (Iterator<Entity> guesses = results.iterator(); guesses.hasNext();) {
        Suggestion match = new Suggestion(guesses.next());
        Representation rep = match.getEntity().getRepresentation();
        Float score = rep.getFirst(RdfResourceEnum.resultScore.getUri(), Float.class);
        match.setURI(rep.getId());
        if (maxScore == null) {
            maxScore = score;
        }
        Iterator<Text> labels = rep.getText(RDFS_LABEL.getUnicodeString());
        while (labels.hasNext() && match.getLevenshtein() < 1.0) {
            Text label1 = labels.next();
            if (language == null || // if the content language is unknown -> accept all labels
                    label1.getLanguage() == null || // accept labels with no language
                    // and labels in the same language as the content
                    (language != null && label1.getLanguage().startsWith(language))) {
                double actMatch = levenshtein(casesensitive ? label1.getText().toLowerCase() : label1.getText(),
                        savedEntityLabel);
                if (actMatch > match.getLevenshtein()) {
                    match.setLevenshtein(actMatch);
                    //JOptionPane.showMessageDialog(null, "++"+label1);
                    match.setMatchedLabel(label1);
                }
            }
        }
        if (match.getMatchedLabel() != null) {
            if (match.getLevenshtein() == 1.0) {
                if (maxExactScore == null) {
                    maxExactScore = score;
                }
                // normalise exact matches against the best exact score
                match.setScore(score.doubleValue() / maxExactScore.doubleValue());
            } else {
                // normalise partial matches against the best match and the
                // Levenshtein similarity with the label
                match.setScore(score.doubleValue() * match.getLevenshtein() / maxScore.doubleValue());
            }
            matches.add(match);
        } else {
            LOG.info("No value of {} for Entity {}!", RDFS_LABEL.getUnicodeString(), match.getEntity().getId());
        }
    }
    return matches;
}

From source file:org.etudes.jforum.view.admin.ForumAction.java

/**
 * send grades to gradebook// w  w w  .  j a  v  a 2  s. c o  m
 * @param grade         grade
 * @param gradebookUid   gradebookuid
 * @param jForumGBService   jforum gradebook service
 * @throws Exception
 */
protected void sendGradesToGradebook(Grade grade, String gradebookUid, JForumGBService jForumGBService)
        throws Exception {
    if (grade.isAddToGradeBook()) {
        // send grades to gradebook
        List<Evaluation> evaluations = null;
        EvaluationDAO.EvaluationsSort evalSort = EvaluationDAO.EvaluationsSort.last_name_a;
        evaluations = DataAccessDriver.getInstance().newEvaluationDAO()
                .selectForumEvaluations(grade.getForumId(), evalSort);

        Map<String, Double> scores = new HashMap<String, Double>();
        for (Evaluation eval : evaluations) {
            if (eval.isReleased()) {
                String key = eval.getSakaiUserId();
                Float userScore = eval.getScore();
                scores.put(key, (userScore == null) ? null : Double.valueOf(userScore.doubleValue()));
            }
        }
        jForumGBService.updateExternalAssessmentScores(gradebookUid,
                "discussions-" + String.valueOf(grade.getId()), scores);
    }
}

From source file:pcgen.core.Equipment.java

/**
 * Sets the qty attribute of the Equipment object
 * /*  w  w w  .j  av a2  s  .  c o  m*/
 * @param aFloat
 *            The new qty value
 */
public void setQty(final Float aFloat) {
    setQty(aFloat.doubleValue());
}