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.payments.derivative.CapFloorIbor.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;/*from   w  ww  . ja va  2  s  .c  o m*/
    temp = Double.doubleToLongBits(_fixingAccrualFactor);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_fixingPeriodEndTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_fixingPeriodStartTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((_forwardCurveName == null) ? 0 : _forwardCurveName.hashCode());
    result = prime * result + _index.hashCode();
    result = prime * result + (_isCap ? 1231 : 1237);
    temp = Double.doubleToLongBits(_strike);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Arrays.hashCode(_conversionFactor);
    result = prime * result + Arrays.hashCode(_deliveryBasket);
    result = prime * result + _deliveryFirstDate.hashCode();
    result = prime * result + _deliveryLastDate.hashCode();
    result = prime * result + _noticeFirstDate.hashCode();
    result = prime * result + _noticeLastDate.hashCode();
    long temp;// w  w  w.  j  a  v a  2  s  . c  om
    temp = Double.doubleToLongBits(_notional);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _settlementDays;
    result = prime * result + _tradingLastDate.hashCode();
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + ((_accrualEndDate == null) ? 0 : _accrualEndDate.hashCode());
    result = prime * result + ((_accrualStartDate == null) ? 0 : _accrualStartDate.hashCode());
    long temp;//  w  ww . j a v  a 2 s.c om
    temp = Double.doubleToLongBits(_amount);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_fixedRate);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;/*  ww w .ja  v a 2  s. co  m*/
    temp = Double.doubleToLongBits(_fixingPeriodEndTime);
    result = prime * result + (int) (temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(_fixingPeriodStartTime);
    result = prime * result + (int) (temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(_fixingAccrualFactor);
    result = prime * result + (int) (temp ^ temp >>> 32);
    result = prime * result + (_forwardCurveName == null ? 0 : _forwardCurveName.hashCode());
    temp = Double.doubleToLongBits(_spread);
    result = prime * result + (int) (temp ^ temp >>> 32);
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + Arrays.hashCode(_fixingPeriodAccrualFactors);
    result = prime * result + Arrays.hashCode(_fixingPeriodEndTimes);
    result = prime * result + Arrays.hashCode(_fixingPeriodStartTimes);
    result = prime * result + Arrays.hashCode(_fixingTimes);
    result = prime * result + (_forwardCurveName == null ? 0 : _forwardCurveName.hashCode());
    result = prime * result + _index.hashCode();
    long temp;//from ww w . ja v  a2s. co m
    temp = Double.doubleToLongBits(_notionalAccrued);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + Arrays.hashCode(_paymentAccrualFactors);
    return result;
}

From source file:com.alibaba.citrus.util.internal.apache.lang.HashCodeBuilderTests.java

public void testDoubleArray() {
    assertEquals(17 * 37, new HashCodeBuilder(17, 37).append((double[]) null).toHashCode());
    double[] obj = new double[2];
    assertEquals(17 * 37 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
    obj[0] = 5.4d;//from  w  w w .  ja  v  a2 s. c om
    long l1 = Double.doubleToLongBits(5.4d);
    int h1 = (int) (l1 ^ l1 >> 32);
    assertEquals((17 * 37 + h1) * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
    obj[1] = 6.3d;
    long l2 = Double.doubleToLongBits(6.3d);
    int h2 = (int) (l2 ^ l2 >> 32);
    assertEquals((17 * 37 + h1) * 37 + h2, new HashCodeBuilder(17, 37).append(obj).toHashCode());
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*w  w w.  j  a  v  a  2s. com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final CashDefinition other = (CashDefinition) obj;
    if (Double.doubleToLongBits(_accrualFactor) != Double.doubleToLongBits(other._accrualFactor)) {
        return false;
    }
    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(_notional) != Double.doubleToLongBits(other._notional)) {
        return false;
    }
    if (Double.doubleToLongBits(_rate) != Double.doubleToLongBits(other._rate)) {
        return false;
    }
    return true;
}

From source file:com.sm.store.hessian.HessianWriter.java

/**
 * Writes a double value to the stream.  The double will be written
 * with the following syntax:/*from   www.  j av  a2 s  .  c  om*/
 *
 * <code><pre>
 * D b64 b56 b48 b40 b32 b24 b16 b8
 * </pre></code>
 *
 * @param value the double value to write.
 */
public void writeDouble(double value) {
    checkOverFlow(10);
    int offset = this.offset;

    int intValue = (int) value;

    if (intValue == value) {
        if (intValue == 0) {
            buffer[offset++] = (byte) BC_DOUBLE_ZERO;

            this.offset = offset;

            return;
        } else if (intValue == 1) {
            buffer[offset++] = (byte) BC_DOUBLE_ONE;

            this.offset = offset;

            return;
        } else if (-0x80 <= intValue && intValue < 0x80) {
            buffer[offset++] = (byte) BC_DOUBLE_BYTE;
            buffer[offset++] = (byte) intValue;

            this.offset = offset;

            return;
        } else if (-0x8000 <= intValue && intValue < 0x8000) {
            buffer[offset + 0] = (byte) BC_DOUBLE_SHORT;
            buffer[offset + 1] = (byte) (intValue >> 8);
            buffer[offset + 2] = (byte) intValue;

            this.offset = offset + 3;

            return;
        }
    }

    int mills = (int) (value * 1000);

    if (0.001 * mills == value) {
        buffer[offset + 0] = (byte) (BC_DOUBLE_MILL);
        buffer[offset + 1] = (byte) (mills >> 24);
        buffer[offset + 2] = (byte) (mills >> 16);
        buffer[offset + 3] = (byte) (mills >> 8);
        buffer[offset + 4] = (byte) (mills);

        this.offset = offset + 5;

        return;
    }

    long bits = Double.doubleToLongBits(value);

    buffer[offset + 0] = (byte) 'D';
    buffer[offset + 1] = (byte) (bits >> 56);
    buffer[offset + 2] = (byte) (bits >> 48);
    buffer[offset + 3] = (byte) (bits >> 40);
    buffer[offset + 4] = (byte) (bits >> 32);
    buffer[offset + 5] = (byte) (bits >> 24);
    buffer[offset + 6] = (byte) (bits >> 16);
    buffer[offset + 7] = (byte) (bits >> 8);
    buffer[offset + 8] = (byte) (bits);

    this.offset = offset + 9;
}

From source file:com.eTilbudsavis.etasdk.model.Store.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    Store other = (Store) obj;/*from www .j a  v  a 2s  . c o m*/
    if (mBranding == null) {
        if (other.mBranding != null)
            return false;
    } else if (!mBranding.equals(other.mBranding))
        return false;
    if (mCity == null) {
        if (other.mCity != null)
            return false;
    } else if (!mCity.equals(other.mCity))
        return false;
    if (mContact == null) {
        if (other.mContact != null)
            return false;
    } else if (!mContact.equals(other.mContact))
        return false;
    if (mCountry == null) {
        if (other.mCountry != null)
            return false;
    } else if (!mCountry.equals(other.mCountry))
        return false;
    if (mDealer == null) {
        if (other.mDealer != null)
            return false;
    } else if (!mDealer.equals(other.mDealer))
        return false;
    if (mDealerId == null) {
        if (other.mDealerId != null)
            return false;
    } else if (!mDealerId.equals(other.mDealerId))
        return false;
    if (mDealerUrl == null) {
        if (other.mDealerUrl != null)
            return false;
    } else if (!mDealerUrl.equals(other.mDealerUrl))
        return false;
    if (mErn == null) {
        if (other.mErn != null)
            return false;
    } else if (!mErn.equals(other.mErn))
        return false;
    if (Double.doubleToLongBits(mLatitude) != Double.doubleToLongBits(other.mLatitude))
        return false;
    if (Double.doubleToLongBits(mLongitude) != Double.doubleToLongBits(other.mLongitude))
        return false;
    if (mStreet == null) {
        if (other.mStreet != null)
            return false;
    } else if (!mStreet.equals(other.mStreet))
        return false;
    if (mZipcode == null) {
        if (other.mZipcode != null)
            return false;
    } else if (!mZipcode.equals(other.mZipcode))
        return false;
    return true;
}