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:monasca.common.model.alarm.AlarmSubExpression.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((function == null) ? 0 : function.hashCode());
    result = prime * result + ((metricDefinition == null) ? 0 : metricDefinition.hashCode());
    result = prime * result + ((operator == null) ? 0 : operator.hashCode());
    result = prime * result + period;// w ww. j a va 2  s  .  c  om
    result = prime * result + periods;
    result = prime * result + Boolean.valueOf(this.deterministic).hashCode();
    long temp;
    temp = Double.doubleToLongBits(threshold);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:HashCode.java

/**
 * Generate a hash code for a double value.
 * // w  w  w  .  ja va 2s. co  m
 * @param value
 *          Double value to generate hash code from.
 * @return Hash code.
 */
public static int generate(final double value) {
    return generate(Double.doubleToLongBits(value));
}

From source file:com.inform.jamps.solver.gurobi.GurobiExpression.java

@Override
public final int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + linearTerms.hashCode();
    long temp;/*from  w  w  w .jav a2 s.  c  o m*/
    temp = Double.doubleToLongBits(constant);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*  w w w. j av  a  2s  .  com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BondFuturesTransactionDefinition other = (BondFuturesTransactionDefinition) 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(_underlyingFuture, other._underlyingFuture)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.equity.option.EquityIndexOptionDefinition.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _currency.hashCode();
    result = prime * result + _exerciseType.hashCode();
    result = prime * result + _expiryDT.hashCode();
    result = prime * result + (_isCall ? 1231 : 1237);
    long temp;/* ww  w .  j  a v  a 2s  .  co  m*/
    temp = Double.doubleToLongBits(_pointValue);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _settlementDate.hashCode();
    result = prime * result + _settlementType.hashCode();
    temp = Double.doubleToLongBits(_strike);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.model.interestrate.definition.G2ppPiecewiseConstantParameters.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 (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final G2ppPiecewiseConstantParameters other = (G2ppPiecewiseConstantParameters) obj;
    if (Double.doubleToLongBits(_correlation) != Double.doubleToLongBits(other._correlation)) {
        return false;
    }
    if (!Arrays.equals(_meanReversion, other._meanReversion)) {
        return false;
    }
    if (!Arrays.equals(_volatility, other._volatility)) {
        return false;
    }
    if (!ObjectUtils.equals(_volatilityTime, other._volatilityTime)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.forex.definition.ForexNonDeliverableForwardDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww w . j a  v  a2  s . c om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ForexNonDeliverableForwardDefinition other = (ForexNonDeliverableForwardDefinition) obj;
    if (!ObjectUtils.equals(_currency1, other._currency1)) {
        return false;
    }
    if (!ObjectUtils.equals(_currency2, other._currency2)) {
        return false;
    }
    if (Double.doubleToLongBits(_exchangeRate) != Double.doubleToLongBits(other._exchangeRate)) {
        return false;
    }
    if (!ObjectUtils.equals(_fixingDate, other._fixingDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_paymentDate, other._paymentDate)) {
        return false;
    }
    if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.MatrixPrimitiveUtils.java

/**
 * Boolean on whether a matrix is upper triangular
 * @param aMatrix an array of arrays representation of the matrix to be tested.
 * @return boolean, true if matrix is Upper Triangular, false if matrix is not.
 * @throws IllegalArgumentException// w  w  w .  j a  va 2s. c o m
 */
public static boolean isUpperTriangular(double[][] aMatrix) throws IllegalArgumentException {
    if (!isSquare(aMatrix)) {
        throw new IllegalArgumentException(
                "Matrix is not square so the notion of Upper Triangular isn't clear cut enough to be implemented");
    }
    int rows = aMatrix.length;

    for (int i = 1; i < rows; i++) {
        for (int j = 0; j < i; j++) {
            if (Double.doubleToLongBits(aMatrix[i][j]) != 0) {
                return false;
            }
        }
    }
    return true;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _currency.hashCode();
    result = prime * result + (_discountingCurveName == null ? 0 : _discountingCurveName.hashCode());
    long temp;//from  w  w w.j av  a 2  s .co m
    temp = Double.doubleToLongBits(_endTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_initialAmount);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_interestAmount);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_notional);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_paymentAccrualFactor);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((_rate == null) ? 0 : _rate.hashCode());
    temp = Double.doubleToLongBits(_startTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.financial.instrument.bond.BillTransactionDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*w  w  w .  j  a  v  a2s  .c om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BillTransactionDefinition other = (BillTransactionDefinition) obj;
    if (Double.doubleToLongBits(_quantity) != Double.doubleToLongBits(other._quantity)) {
        return false;
    }
    if (Double.doubleToLongBits(_settlementAmount) != Double.doubleToLongBits(other._settlementAmount)) {
        return false;
    }
    if (!ObjectUtils.equals(_settlementDate, other._settlementDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlying, other._underlying)) {
        return false;
    }
    return true;
}