Example usage for java.lang Float compare

List of usage examples for java.lang Float compare

Introduction

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

Prototype

public static int compare(float f1, float f2) 

Source Link

Document

Compares the two specified float values.

Usage

From source file:net.mintern.primitive.pair.FloatLongPair.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.co  m
@Override
public int compareTo(FloatLongPair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Long.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.FloatCharPair.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 ww w . ja  v  a  2  s. c o  m
@Override
public int compareTo(FloatCharPair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.FloatBooleanPair.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  ww w. j a  v  a2 s  .c  om*/
@Override
public int compareTo(FloatBooleanPair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Boolean.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.IntFloatPair.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  ww  w  . ja  v  a 2  s . c o m
@Override
public int compareTo(IntFloatPair other) {
    int cmp = Integer.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Float.compare(getRight(), other.getRight());
}

From source file:joachimeichborn.geotag.ui.tablecomparators.PositionViewerComparator.java

@Override
public int compare(final Viewer aViewer, final Object aObj1, final Object aObj2) {
    final PositionData p1 = (PositionData) aObj1;
    final PositionData p2 = (PositionData) aObj2;
    int rc = 0;/*  w  ww  . ja va  2 s  . co m*/
    switch (column) {
    case PositionsViewerLabelProvider.NAME_COLUMN:
        rc = p1.getName().compareTo(p2.getName());
        break;
    case PositionsViewerLabelProvider.COORDINATES_COLUMN:
        ObjectUtils.compare(p1.getCoordinates(), p2.getCoordinates());
        break;
    case PositionsViewerLabelProvider.TIMESTAMP_COLUMN:
        rc = p1.getTimeStamp().compareTo(p2.getTimeStamp());
        break;
    case PositionsViewerLabelProvider.ACCURACY_COLUMN:
        rc = Float.compare(p1.getAccuracy(), p2.getAccuracy());
        break;
    default:
        rc = 0;
    }

    if (!direction) {
        rc = -rc;
    }

    return rc;
}

From source file:net.mintern.primitive.pair.LongFloatPair.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  ww. ja  v  a  2  s . c  o m*/
@Override
public int compareTo(LongFloatPair other) {
    int cmp = Long.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Float.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
 *///from   w ww  .  j  a v a2 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:me.lizheng.deckview.helpers.DeckChildViewTransform.java

public boolean hasTranslationZChangedFrom(float v) {
    return (Float.compare(translationZ, v) != 0);
}

From source file:org.encuestame.utils.web.stats.HashTagRankingBean.java

/**
 * //from w w  w .  j av  a  2 s.c  om
 */
public int compareTo(Object o) {
    HashTagRankingBean hashTagRanking = (HashTagRankingBean) o;
    log.trace("HashTag rank position Value: " + hashTagRanking.getPosition());
    log.trace("This HashTag rank position Value: " + this.getPosition());
    int CompareToValue = Float.compare(hashTagRanking.getPosition() == null ? 0 : hashTagRanking.getPosition(),
            this.getPosition() == null ? 0 : this.getPosition());
    return CompareToValue;
}

From source file:com.hybris.mobile.lib.location.geofencing.data.GeofenceObject.java

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

    GeofenceObject that = (GeofenceObject) o;

    if (Double.compare(that.latitude, latitude) != 0)
        return false;
    if (Double.compare(that.longitude, longitude) != 0)
        return false;
    if (Float.compare(that.radius, radius) != 0)
        return false;
    if (expirationDuration != that.expirationDuration)
        return false;
    if (transitionType != that.transitionType)
        return false;
    if (id != null ? !id.equals(that.id) : that.id != null)
        return false;
    return !(notificationByTransition != null ? !notificationByTransition.equals(that.notificationByTransition)
            : that.notificationByTransition != null);
}