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:me.lizheng.deckview.helpers.DeckChildViewTransform.java

/**
 * Convenience functions to compare against current property values
 *//*  ww  w.j a va 2  s .co  m*/
public boolean hasAlphaChangedFrom(float v) {
    return (Float.compare(alpha, v) != 0);
}

From source file:org.mrgeo.aggregators.MinAvgPairAggregator.java

@Override
public float aggregate(float[] values, float nodata) {
    boolean data0 = Float.compare(values[0], nodata) != 0;
    boolean data1 = Float.compare(values[1], nodata) != 0;
    boolean data2 = Float.compare(values[2], nodata) != 0;
    boolean data3 = Float.compare(values[3], nodata) != 0;

    Collection<Float> averages = new ArrayList<Float>();
    if (data0 && data1)
        averages.add(Float.valueOf((values[0] + values[1]) / 2));
    if (data0 && data2)
        averages.add(Float.valueOf((values[0] + values[2]) / 2));
    if (data0 && data3)
        averages.add(Float.valueOf((values[0] + values[3]) / 2));
    if (data1 && data2)
        averages.add(Float.valueOf((values[1] + values[2]) / 2));
    if (data1 && data3)
        averages.add(Float.valueOf((values[1] + values[3]) / 2));
    if (data2 && data3)
        averages.add(Float.valueOf((values[2] + values[3]) / 2));

    return (averages.isEmpty()) ? nodata : Collections.min(averages).floatValue();
}

From source file:me.lizheng.deckview.helpers.DeckChildViewTransform.java

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

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

From source file:mi.RankInfo.java

@Override
public int compareTo(DistInfo t) {
    return Float.compare(dist, t.dist);
}

From source file:acmi.l2.clientmod.l2smr.model.L2Map.java

@Override
public boolean equals(Object o) {
    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    L2Map map = (L2Map) o;
    return Float.compare(map.x, x) == 0 && Float.compare(map.y, y) == 0 && Float.compare(map.z, z) == 0
            && Objects.equals(staticMeshes, map.staticMeshes);
}

From source file:me.lizheng.deckview.helpers.DeckChildViewTransform.java

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

From source file:de.rallye.model.structures.MapConfig.java

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

    MapConfig that = (MapConfig) o;/*from   w  w w . j a  va 2  s  .com*/

    if (Float.compare(that.zoomLevel, zoomLevel) != 0)
        return false;
    if (!location.equals(that.location))
        return false;
    if (!name.equals(that.name))
        return false;
    return bounds.equals(that.bounds);
}

From source file:net.mintern.primitive.pair.FloatIntPair.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. ja v a2 s . com*/
@Override
public int compareTo(FloatIntPair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Integer.compare(getRight(), other.getRight());
}

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