List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:com.github.errantlinguist.latticevisualiser.StateSizeTransformer.java
/** * //from w ww . j a v a 2 s. c o m * @return The hash code. */ private int calculateHashCode() { final int prime = 31; int result = 1; // Get the identity hash code of the graph because it may change during // runtime (it is mutable) result = prime * result + (graph == null ? 0 : System.identityHashCode(graph)); result = prime * result + minSize; long temp; temp = Double.doubleToLongBits(stateSizeMultiplier); result = prime * result + (int) (temp ^ temp >>> 32); return result; }
From source file:com.opengamma.analytics.financial.model.option.definition.EuropeanStandardBarrierOptionDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w. ja va 2 s.c o m if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final EuropeanStandardBarrierOptionDefinition other = (EuropeanStandardBarrierOptionDefinition) obj; return ObjectUtils.equals(_barrier, other._barrier) && Double.doubleToLongBits(_rebate) == Double.doubleToLongBits(other._rebate); }
From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.SparseCoordinateFormatMatrix.java
/** * Construct from DoubleMatrix2D type//from www. j a va 2s. c o m * @param aMatrix is a DoubleMatrix2D */ public SparseCoordinateFormatMatrix(final DoubleMatrix2D aMatrix) { Validate.notNull(aMatrix); //get number of elements _els = aMatrix.getNumberOfElements(); // tmp arrays, in case we get in a fully populated matrix, intelligent design upstream should ensure that this is overkill! double[] valuesTmp = new double[_els]; int[] xTmp = new int[_els]; int[] yTmp = new int[_els]; // we need unwind the array aMatrix into coordinate form int localmaxEntriesInARow; _maxEntriesInARow = -1; // set max entries in a column negative, so that maximiser will work int ptr = 0; for (int i = 0; i < aMatrix.getNumberOfRows(); i++) { localmaxEntriesInARow = 0; for (int j = 0; j < aMatrix.getNumberOfColumns(); j++) { if (Double.doubleToLongBits(aMatrix.getEntry(i, j)) != 0L) { xTmp[ptr] = j; yTmp[ptr] = i; valuesTmp[ptr] = aMatrix.getEntry(i, j); ptr++; localmaxEntriesInARow++; } } if (localmaxEntriesInARow > _maxEntriesInARow) { _maxEntriesInARow = localmaxEntriesInARow; } } _values = Arrays.copyOfRange(valuesTmp, 0, ptr); _x = Arrays.copyOfRange(xTmp, 0, ptr); _y = Arrays.copyOfRange(yTmp, 0, ptr); _rows = aMatrix.getNumberOfRows(); _cols = aMatrix.getNumberOfColumns(); }
From source file:monasca.api.app.command.CreateMetricCommand.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CreateMetricCommand other = (CreateMetricCommand) obj; if (dimensions == null) { if (other.dimensions != null) return false; } else if (!dimensions.equals(other.dimensions)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (timestamp != other.timestamp) return false; if (Double.doubleToLongBits(value) != Double.doubleToLongBits(other.value)) return false; return true;/* w ww . ja v a 2 s . c om*/ }
From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.formula.AmericanVanillaOption.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w. ja v a 2 s.co m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AmericanVanillaOption other = (AmericanVanillaOption) obj; if (_isCall != other._isCall) { return false; } if (Double.doubleToLongBits(_strike) != Double.doubleToLongBits(other._strike)) { return false; } if (Double.doubleToLongBits(_timeToExpiry) != Double.doubleToLongBits(other._timeToExpiry)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.equity.future.derivative.EquityFuture.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _currency.hashCode(); long temp;/*from w ww .j av a 2 s . c o m*/ temp = Double.doubleToLongBits(_unitAmount); result = prime * result + (int) (temp ^ temp >>> 32); temp = Double.doubleToLongBits(_strike); result = prime * result + (int) (temp ^ temp >>> 32); temp = Double.doubleToLongBits(_timeToSettlement); result = prime * result + (int) (temp ^ temp >>> 32); temp = Double.doubleToLongBits(_timeToExpiry); result = prime * result + (int) (temp ^ temp >>> 32); return result; }
From source file:Main.java
/** Hash code for <tt>double</tt> primitives. */ public static int hash(int aSeed, double aDouble) { return hash(aSeed, Double.doubleToLongBits(aDouble)); }
From source file:Util.java
private static int binarySearch(double[] a, double key, int low, int high) { while (low <= high) { int mid = (low + high) / 2; double midVal = a[mid]; int cmp;//from w ww .jav a 2 s . c o m if (midVal > key) { cmp = -1; // Neither val is NaN, thisVal is smaller } else if (midVal < key) { cmp = 1; // Neither val is NaN, thisVal is larger } else { long midBits = Double.doubleToLongBits(midVal); long keyBits = Double.doubleToLongBits(key); cmp = (midBits == keyBits ? 0 : (midBits < keyBits ? -1 : 1)); // (0.0, -0.0) or (NaN, !NaN) } if (cmp < 0) { low = mid + 1; } else if (cmp > 0) { high = mid - 1; } else { return mid; // key found } } return -(low + 1); // key not found. }
From source file:org.hawkular.metrics.core.api.NumericData.java
@Override public int hashCode() { int result = super.hashCode(); long temp;/* w w w . ja v a 2 s .co m*/ temp = Double.doubleToLongBits(value); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.eTilbudsavis.etasdk.model.Dimension.java
@Override public int hashCode() { final int prime = 31; int result = 1; long temp;/* www . j a v a 2s. co m*/ temp = Double.doubleToLongBits(mHeight); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(mWidth); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }