List of usage examples for java.lang Float floatToIntBits
@HotSpotIntrinsicCandidate public static int floatToIntBits(float value)
From source file:com.sindicetech.siren.search.node.NodePhraseQuery.java
@Override public int hashCode() { return Float.floatToIntBits(this.getBoost()) ^ terms.hashCode() ^ positions.hashCode() ^ levelConstraint ^ upperBound ^ lowerBound;//from w w w . jav a2 s. co m }
From source file:com.alibaba.citrus.util.internal.apache.lang.HashCodeBuilderTests.java
public void testFloatArray() { assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((float[]) null).toHashCode()); float[] obj = new float[2]; assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode()); obj[0] = 5.4f;/*from w w w. j a v a2 s . c o m*/ int h1 = Float.floatToIntBits(5.4f); assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode()); obj[1] = 6.3f; int h2 = Float.floatToIntBits(6.3f); assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append(obj).toHashCode()); }
From source file:com.alibaba.citrus.util.internal.apache.lang.HashCodeBuilderTests.java
public void testFloatArrayAsObject() { float[] obj = new float[2]; assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode()); obj[0] = 5.4f;/*from w ww . ja va 2s. co m*/ int h1 = Float.floatToIntBits(5.4f); assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode()); obj[1] = 6.3f; int h2 = Float.floatToIntBits(6.3f); assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append((Object) obj).toHashCode()); }
From source file:com.sindicetech.siren.search.node.MultiNodeTermQuery.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Float.floatToIntBits(this.getBoost()); result = prime * result + rewriteMethod.hashCode(); result = prime * result + lowerBound; result = prime * result + upperBound; result = prime * result + levelConstraint; if (field != null) result = prime * result + field.hashCode(); return result; }
From source file:org.fhcrc.cpl.toolbox.proteomics.feature.Feature.java
/** * Needs to be defined when redefining equals. Seems likely to be unique... * * There are definitely pieces of code that depend on this method NOT hashing * features with the same scan, mz and intensity but different charge/KL to the same * value (FeatureStrategyPeakClusters)./*from www.j a v a2s . c o m*/ * * There may or may not be code out there that depends on this method hashing things * that agree on all these values, but have other values that are different, hashing * to the same value. * * TODO: make this agree with equals() */ public int hashCode() { return scan ^ Float.floatToIntBits(mz) ^ (Float.floatToIntBits(intensity) << charge) ^ Float.floatToIntBits(kl); }
From source file:HashCodeBuilder.java
/** * Append a hashCode for a float.//ww w . j a va 2 s . c o m * * @param value the float to add to the hashCode * @return this */ public HashCodeBuilder append(float value) { iTotal = iTotal * iConstant + Float.floatToIntBits(value); return this; }
From source file:org.apache.vxquery.runtime.functions.cast.CastToStringOperation.java
@Override public void convertFloat(FloatPointable floatp, DataOutput dOut) throws SystemException, IOException { abvsInner.reset();//from w ww. ja v a 2s. c o m float value = floatp.getFloat(); if (!Float.isInfinite(value) && !Float.isNaN(value) && Math.abs(value) >= 0.000001 && Math.abs(value) <= 1000000) { CastToDecimalOperation castToDecimal = new CastToDecimalOperation(); castToDecimal.convertFloat(floatp, dOutInner); XSDecimalPointable decp = (XSDecimalPointable) XSDecimalPointable.FACTORY.createPointable(); decp.set(abvsInner.getByteArray(), abvsInner.getStartOffset() + 1, abvsInner.getLength()); convertDecimal(decp, dOut); } else if (value == -0.0f || value == 0.0f) { long bits = Float.floatToIntBits(value); boolean negative = ((bits >> 31) == 0) ? false : true; if (negative) { FunctionHelper.writeChar('-', dOutInner); } FunctionHelper.writeCharSequence("0", dOutInner); sendStringDataOutput(dOut); } else { convertFloatCanonical(floatp, dOut); } }
From source file:me.pagekite.glen3b.library.bukkit.Utilities.java
/** * Determines if two objects are equal.//from w w w.j a va 2 s . com * @param left The left object. * @param right The right object. * @return True if and only if the two objects are equal. * @see Float#floatToIntBits(float) */ public static final boolean equals(float left, float right) { return Float.floatToIntBits(left) == Float.floatToIntBits(right); }
From source file:org.sybila.parasim.model.verification.stl.LinearPredicate.java
@Override public int hashCode() { final int prime = 29; int result = mapping.hashCode(); result = prime * result + Float.floatToIntBits(constant); result = prime * result + terms.hashCode(); result = prime * result + type.hashCode(); return result; }
From source file:com.sindicetech.siren.search.node.MultiNodeTermQuery.java
@Override public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (this.getClass() != obj.getClass()) return false; final MultiNodeTermQuery other = (MultiNodeTermQuery) obj; if (Float.floatToIntBits(this.getBoost()) != Float.floatToIntBits(other.getBoost())) return false; if (!rewriteMethod.equals(other.rewriteMethod)) { return false; }//from w w w . j av a 2 s. c om if (!(this.lowerBound == other.lowerBound && this.upperBound == other.upperBound && this.levelConstraint == other.levelConstraint && StringUtils.equals(this.datatype, other.datatype))) { return false; } return (other.field == null ? field == null : other.field.equals(field)); }