Example usage for java.lang Double doubleToLongBits

List of usage examples for java.lang Double doubleToLongBits

Introduction

In this page you can find the example usage for java.lang Double doubleToLongBits.

Prototype

@HotSpotIntrinsicCandidate
public static long doubleToLongBits(double value) 

Source Link

Document

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Usage

From source file:com.opengamma.analytics.financial.interestrate.fra.derivative.ForwardRateAgreement.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from w  w w.j  a v a  2s .c om*/
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ForwardRateAgreement other = (ForwardRateAgreement) obj;
    if (Double.doubleToLongBits(_fixingPeriodEndTime) != Double.doubleToLongBits(other._fixingPeriodEndTime)) {
        return false;
    }
    if (Double.doubleToLongBits(_fixingPeriodStartTime) != Double
            .doubleToLongBits(other._fixingPeriodStartTime)) {
        return false;
    }
    if (Double.doubleToLongBits(_fixingYearFraction) != Double.doubleToLongBits(other._fixingYearFraction)) {
        return false;
    }
    if (!ObjectUtils.equals(_forwardCurveName, other._forwardCurveName)) {
        return false;
    }
    if (!ObjectUtils.equals(_index, other._index)) {
        return false;
    }
    if (Double.doubleToLongBits(_rate) != Double.doubleToLongBits(other._rate)) {
        return false;
    }
    return true;
}

From source file:ac.elements.parser.SimpleDBConverter.java

/**
 * Writes a signed double (eight byte) value to the buffer, with support for
 * correct default sorting of all values. Writes values that can be read
 * using {@link TupleInput#readSortedDouble}.
 * //w  w w .ja  va  2 s  .  c  o  m
 * <p>
 * <code>Float.doubleToLongBits</code> and the following bit manipulations
 * are used to convert the signed double value to a representation that is
 * sorted correctly by default.
 * </p>
 * 
 * <pre>
 * long longVal = Double.doubleToLongBits(val);
 * longVal &circ;= (longVal &lt; 0) ? 0xffffffffffffffffL : 0x8000000000000000L;
 * </pre>
 * 
 * Based on com.sleepycat.bind.tuple (berkley db/ oracle)
 * 
 * @param val
 *            is the value to write to the buffer.
 * 
 * @return this tuple output object.
 */
private static final String encodeSortedDouble(double val) {
    long longVal = Double.doubleToLongBits(val);
    longVal ^= (longVal < 0) ? 0xffffffffffffffffL : 0x8000000000000000L;
    longVal = (long) (longVal ^ 0x8000000000000000L);

    return encodeLong(longVal);
}

From source file:com.loadtesting.core.data.TimeSerieData.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;/*ww  w  .ja  v  a 2s .  c  o m*/
    temp = Double.doubleToLongBits(closing);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(geometricMean);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(high);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(kurtosis);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(low);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(median);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((name == null) ? 0 : name.hashCode());
    temp = Double.doubleToLongBits(opening);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(populationVariance);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((samples == null) ? 0 : samples.hashCode());
    temp = Double.doubleToLongBits(sd);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(skewness);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(sma);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(sum);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(sumsq);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(typical);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((unit == null) ? 0 : unit.hashCode());
    temp = Double.doubleToLongBits(variance);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + volume;
    temp = Double.doubleToLongBits(weightedClose);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.CouponArithmeticAverageONSpread.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   w  w  w.  j  a  v  a2 s .  c  o m
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final CouponArithmeticAverageONSpread other = (CouponArithmeticAverageONSpread) obj;
    if (!Arrays.equals(_fixingPeriodAccrualFactors, other._fixingPeriodAccrualFactors)) {
        return false;
    }
    if (Double.doubleToLongBits(_fixingPeriodRemainingAccrualFactor) != Double
            .doubleToLongBits(other._fixingPeriodRemainingAccrualFactor)) {
        return false;
    }
    if (!Arrays.equals(_fixingPeriodTimes, other._fixingPeriodTimes)) {
        return false;
    }
    if (!ObjectUtils.equals(_index, other._index)) {
        return false;
    }
    if (Double.doubleToLongBits(_rateAccrued) != Double.doubleToLongBits(other._rateAccrued)) {
        return false;
    }
    if (Double.doubleToLongBits(_spread) != Double.doubleToLongBits(other._spread)) {
        return false;
    }
    if (Double.doubleToLongBits(_spreadAmount) != Double.doubleToLongBits(other._spreadAmount)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.instrument.cash.DepositZeroDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  w  w w .j ava 2 s  .c om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final DepositZeroDefinition other = (DepositZeroDefinition) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_endDate, other._endDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_startDate, other._startDate)) {
        return false;
    }
    if (Double.doubleToLongBits(_interestAmount) != Double.doubleToLongBits(other._interestAmount)) {
        return false;
    }
    if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) {
        return false;
    }
    if (Double.doubleToLongBits(_paymentAccrualFactor) != Double
            .doubleToLongBits(other._paymentAccrualFactor)) {
        return false;
    }
    if (!ObjectUtils.equals(_rate, other._rate)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.interestrate.cash.derivative.DepositZero.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }// ww  w. j a  va2  s .c  om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final DepositZero other = (DepositZero) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_discountingCurveName, other._discountingCurveName)) {
        return false;
    }
    if (Double.doubleToLongBits(_endTime) != Double.doubleToLongBits(other._endTime)) {
        return false;
    }
    if (Double.doubleToLongBits(_initialAmount) != Double.doubleToLongBits(other._initialAmount)) {
        return false;
    }
    if (Double.doubleToLongBits(_interestAmount) != Double.doubleToLongBits(other._interestAmount)) {
        return false;
    }
    if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) {
        return false;
    }
    if (Double.doubleToLongBits(_paymentAccrualFactor) != Double
            .doubleToLongBits(other._paymentAccrualFactor)) {
        return false;
    }
    if (!ObjectUtils.equals(_rate, other._rate)) {
        return false;
    }
    if (Double.doubleToLongBits(_startTime) != Double.doubleToLongBits(other._startTime)) {
        return false;
    }
    return true;
}

From source file:ArrayByte.java

public void writeDouble(double v) {
    writeLong(Double.doubleToLongBits(v));
}

From source file:com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginTransactionDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  w w w . ja  v  a2s  .  c  o  m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final InterestRateFutureOptionMarginTransactionDefinition other = (InterestRateFutureOptionMarginTransactionDefinition) obj;
    if (_quantity != other._quantity) {
        return false;
    }
    if (!ObjectUtils.equals(_tradeDate, other._tradeDate)) {
        return false;
    }
    if (Double.doubleToLongBits(_tradePrice) != Double.doubleToLongBits(other._tradePrice)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingOption, other._underlyingOption)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.equity.variance.derivative.VarianceSwap.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*ww w  . j  av a 2 s. c o m*/
    if (!(obj instanceof VarianceSwap)) {
        return false;
    }
    VarianceSwap other = (VarianceSwap) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_observations, other._observations)) {
        return false;
    }
    if (!ObjectUtils.equals(_observationWeights, other._observationWeights)) {
        return false;
    }
    if (_nObsExpected != other._nObsExpected) {
        return false;
    }
    if (Double.doubleToLongBits(_timeToObsEnd) != Double.doubleToLongBits(other._timeToObsEnd)) {
        return false;
    }
    if (Double.doubleToLongBits(_timeToObsStart) != Double.doubleToLongBits(other._timeToObsStart)) {
        return false;
    }
    if (Double.doubleToLongBits(_timeToSettlement) != Double.doubleToLongBits(other._timeToSettlement)) {
        return false;
    }
    if (Double.doubleToLongBits(_varNotional) != Double.doubleToLongBits(other._varNotional)) {
        return false;
    }
    if (Double.doubleToLongBits(_varStrike) != Double.doubleToLongBits(other._varStrike)) {
        return false;
    }
    return true;
}

From source file:org.jfree.experimental.chart.plot.dial.SimpleDialFrame.java

/**
 * Returns a hash code for this instance.
 * //w ww  .  j ava 2 s  .  com
 * @return The hash code.
 */
public int hashCode() {
    int result = 193;
    long temp = Double.doubleToLongBits(this.radius);
    result = 37 * result + (int) (temp ^ (temp >>> 32));
    result = 37 * result + HashUtilities.hashCodeForPaint(this.backgroundPaint);
    result = 37 * result + HashUtilities.hashCodeForPaint(this.foregroundPaint);
    result = 37 * result + this.stroke.hashCode();
    return result;
}