Example usage for java.lang Double compare

List of usage examples for java.lang Double compare

Introduction

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

Prototype

public static int compare(double d1, double d2) 

Source Link

Document

Compares the two specified double values.

Usage

From source file:com.milaboratory.mitools.merger.MergerParameters.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;

    MergerParameters that = (MergerParameters) o;

    if (Double.compare(that.minimalIdentity, minimalIdentity) != 0)
        return false;
    if (minimalOverlap != that.minimalOverlap)
        return false;

    return true;/*  w w  w  .  j  av  a2  s  .c  o m*/
}

From source file:io.appform.jsonrules.expressions.numeric.NumericJsonPathBasedExpression.java

@Override
protected final boolean evaluate(ExpressionEvaluationContext context, String path, JsonNode evaluatedNode) {
    if (null == evaluatedNode || !evaluatedNode.isNumber()) {
        return false;
    }//from w w w . j a  v a  2s .  com
    int comparisonResult = 0;
    if (evaluatedNode.isIntegralNumber()) {
        comparisonResult = Long.compare(evaluatedNode.asLong(), value.longValue());
    } else if (evaluatedNode.isFloatingPointNumber()) {
        comparisonResult = Double.compare(evaluatedNode.asDouble(), value.doubleValue());
    }
    return evaluate(context, comparisonResult);
}

From source file:io.seldon.client.beans.ItemSimilarityNodeBean.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (!(o instanceof ItemSimilarityNodeBean))
        return false;

    ItemSimilarityNodeBean that = (ItemSimilarityNodeBean) o;

    if (Double.compare(that.sim, sim) != 0)
        return false;
    if (item != null ? !item.equals(that.item) : that.item != null)
        return false;

    return true;/*from  w  w w . ja v  a 2s .c  o m*/
}

From source file:org.opensextant.placedata.ScoredPlace.java

@Override
// compare by score
public int compareTo(Object o) {
    if (o instanceof ScoredPlace) {
        return -1 * Double.compare(getScore(), ((ScoredPlace) o).getScore());
    } else {//  www.j  av  a  2  s.  c o  m
        return 0;
    }
}

From source file:org.jberet.support.io.StockTrade.java

@Override
public boolean equals(final Object o) {
    if (this == o)
        return true;
    if (!(o instanceof StockTrade))
        return false;

    final StockTrade that = (StockTrade) o;

    if (Double.compare(that.close, close) != 0)
        return false;
    if (Double.compare(that.high, high) != 0)
        return false;
    if (Double.compare(that.low, low) != 0)
        return false;
    if (Double.compare(that.open, open) != 0)
        return false;
    if (Double.compare(that.volume, volume) != 0)
        return false;
    if (!date.equals(that.date))
        return false;
    if (!time.equals(that.time))
        return false;

    return true;//from   w w  w.j  a va2 s.  co  m
}

From source file:uk.ac.cam.cl.dtg.teaching.programmingtest.java.FittedCurve.java

@Override
public int compareTo(FittedCurve o) {
    if (rsq == o.rsq) {
        return Integer.compare(System.identityHashCode(this), System.identityHashCode(o));
    } else {//  w  w  w .  j a va2s. com
        return Double.compare(rsq, o.rsq);
    }
}

From source file:edu.cmu.sv.modelinference.eventtool.classification.Clusterer1D.java

private static ClassificationResult buildResult(List<? extends Cluster<DataWrapper>> results) {
    LinkedList<EventClass> clusters = new LinkedList<>();
    for (int i = 0; i < results.size(); i++) {
        TreeMultiset<Event> clusterDataPoints = TreeMultiset.create(new Comparator<Event>() {
            @Override/*from   w  w w . j  a  va2s  .c om*/
            public int compare(Event o1, Event o2) {
                return Double.compare(o1.getFeature().getData(), o2.getFeature().getData());
            }
        });
        for (DataWrapper dataWrapper : results.get(i).getPoints()) {
            clusterDataPoints.add(dataWrapper.getWrappedData());
        }
        clusters.addLast(new EventClass(clusterDataPoints));
    }
    return new ClassificationResult(clusters);
}

From source file:org.jberet.support.io.StockTradeWithJoda.java

@Override
public boolean equals(final Object o) {
    if (this == o)
        return true;
    if (!(o instanceof StockTradeWithJoda))
        return false;

    final StockTradeWithJoda that = (StockTradeWithJoda) o;

    if (Double.compare(that.close, close) != 0)
        return false;
    if (Double.compare(that.high, high) != 0)
        return false;
    if (Double.compare(that.low, low) != 0)
        return false;
    if (Double.compare(that.open, open) != 0)
        return false;
    if (Double.compare(that.volume, volume) != 0)
        return false;
    if (!date.equals(that.date))
        return false;
    if (!time.equals(that.time))
        return false;

    return true;//from w  ww  .  j  a  v  a2s  .c  o m
}

From source file:com.vsthost.rnd.jdeoptim.utils.Utils.java

/**
 * Returns the order of the values, ie. ordered indices sorted by comparing the elements of the array.
 *
 * @param values The vector of which the indices will be ordered.
 * @return The indices of the vector ordered according to sorted elements.
 *//* w w w.  j  a  v a2  s  .  com*/
public static int[] order(final double[] values) {
    // Initialize the return vector:
    Integer[] vector = Utils.toObject(Utils.sequence(values.length));

    // Order:
    Arrays.sort(vector, new Comparator<Integer>() {
        @Override
        public int compare(Integer o1, Integer o2) {
            return Double.compare(values[o1], values[o2]);
        }
    });

    // Done, return indices:
    return Utils.toPrimitive(vector);
}

From source file:kr.ac.cau.mecs.cass.cae.ActionScoreEntity.java

@Override
public int compareTo(ActionScoreEntity o) {
    return Double.compare(this.score, o.score);
}