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:net.mintern.primitive.pair.DoubleIntPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from  w  w w.  j ava2  s  .  c o m*/
@Override
public int compareTo(DoubleIntPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Integer.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from  w  ww . j av a 2 s .c o  m
@Override
public int compareTo(DoubleBytePair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleLongPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from w  w  w .  java  2 s .  com
@Override
public int compareTo(DoubleLongPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Long.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleCharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from w w w.jav  a2  s .com
@Override
public int compareTo(DoubleCharPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleFloatPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///  w  w  w  .  ja  va 2 s  . c o  m
@Override
public int compareTo(DoubleFloatPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Float.compare(getRight(), other.getRight());
}

From source file:com.mgmtp.perfload.loadprofiles.ui.util.Point.java

@Override
public int compareTo(final Point other) {
    int result = Double.compare(x, other.x);
    if (result == 0) {
        result = Double.compare(y, other.y);
    }//w  ww.  j  a v  a2s.c om
    return result;
}

From source file:net.mintern.primitive.pair.DoubleBooleanPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from   w ww.  j  a  v  a  2  s .co  m
@Override
public int compareTo(DoubleBooleanPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Boolean.compare(getRight(), other.getRight());
}

From source file:com.github.tomakehurst.wiremock.matching.MatchResult.java

@Override
public int compareTo(MatchResult other) {
    return Double.compare(other.getDistance(), getDistance());
}

From source file:edu.umich.robot.soar.SetHeadingCommand.java

@Override
boolean isComplete() {
    double currentYaw = output.getPose().getYaw();
    double difference = targetYaw - currentYaw;
    difference = Math.abs(difference);
    return Double.compare(difference, TOLERANCE) < 0;
}

From source file:io.fouad.jtb.core.beans.InputLocationMessageContent.java

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

    InputLocationMessageContent that = (InputLocationMessageContent) o;

    if (Double.compare(that.latitude, latitude) != 0)
        return false;
    return Double.compare(that.longitude, longitude) == 0;

}