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.bond.definition.BillTransaction.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww  w  . ja v  a 2 s. c o  m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BillTransaction other = (BillTransaction) obj;
    if (!ObjectUtils.equals(_billPurchased, other._billPurchased)) {
        return false;
    }
    if (!ObjectUtils.equals(_billStandard, other._billStandard)) {
        return false;
    }
    if (Double.doubleToLongBits(_quantity) != Double.doubleToLongBits(other._quantity)) {
        return false;
    }
    if (Double.doubleToLongBits(_settlementAmount) != Double.doubleToLongBits(other._settlementAmount)) {
        return false;
    }
    return true;
}

From source file:fr.cph.chicago.entity.BikeStation.java

@Override
public int hashCode() {
    int result;/*from   w w w.  j a v a  2s .c o m*/
    long temp;
    result = id;
    result = 31 * result + (name != null ? name.hashCode() : 0);
    result = 31 * result + availableDocks;
    result = 31 * result + totalDocks;
    temp = Double.doubleToLongBits(latitude);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(longitude);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    result = 31 * result + (statusValue != null ? statusValue.hashCode() : 0);
    result = 31 * result + (statusKey != null ? statusKey.hashCode() : 0);
    result = 31 * result + availableBikes;
    result = 31 * result + (stAddress1 != null ? stAddress1.hashCode() : 0);
    result = 31 * result + (stAddress2 != null ? stAddress2.hashCode() : 0);
    result = 31 * result + (city != null ? city.hashCode() : 0);
    result = 31 * result + (postalCode != null ? postalCode.hashCode() : 0);
    result = 31 * result + (location != null ? location.hashCode() : 0);
    result = 31 * result + (altitude != null ? altitude.hashCode() : 0);
    result = 31 * result + (testStation ? 1 : 0);
    result = 31 * result + (lastCommunicationTime != null ? lastCommunicationTime.hashCode() : 0);
    result = 31 * result + (landMark != null ? landMark.hashCode() : 0);
    return result;
}

From source file:com.opengamma.analytics.financial.model.option.pricing.tree.BarrierOptionFunctionProvider.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;//from   w  ww.  j  a v a 2s .  com
    temp = Double.doubleToLongBits(_barrier);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + ((_checker == null) ? 0 : _checker.hashCode());
    return result;
}

From source file:com.opengamma.analytics.financial.model.option.pricing.fourier.IntegratedCIRTimeChangeCharacteristicExponent.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;/* w  ww  . j  av a  2  s . c o  m*/
    temp = Double.doubleToLongBits(_kappa);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_lambda);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_theta);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}

From source file:com.opengamma.analytics.math.surface.NodalSurfaceAdditiveShiftFunction.java

/**
 * {@inheritDoc}// ww  w .j av a2s.  c  o m
 * @throws IllegalArgumentException If the points to shift are not nodal points of the surface 
 */
@Override
public NodalDoublesSurface evaluate(final NodalDoublesSurface surface, final double[] xShift,
        final double[] yShift, final double[] shift, final String newName) {
    Validate.notNull(surface, "surface");
    Validate.notNull(xShift, "x shift");
    Validate.notNull(yShift, "y shift");
    Validate.notNull(shift, "shifts");
    final int m = xShift.length;
    if (m == 0) {
        return NodalDoublesSurface.from(surface.getXDataAsPrimitive(), surface.getYDataAsPrimitive(),
                surface.getZDataAsPrimitive(), newName);
    }
    Validate.isTrue(m == yShift.length && m == shift.length);
    final double[] xData = surface.getXDataAsPrimitive();
    final double[] yData = surface.getYDataAsPrimitive();
    final double[] zData = surface.getZDataAsPrimitive();
    final int n = zData.length;
    final double[] shiftedZ = Arrays.copyOf(zData, n);
    for (int i = 0; i < xShift.length; i++) {
        final double x = xShift[i];
        final List<Integer> indices = new ArrayList<Integer>();
        for (int j = 0; j < n; j++) {
            if (Double.doubleToLongBits(xData[j]) == Double.doubleToLongBits(x)) {
                indices.add(j);
            }
        }
        if (indices.isEmpty()) {
            throw new IllegalArgumentException("No x data in surface for value " + x);
        }
        boolean foundValue = false;
        for (final int index : indices) {
            if (Double.doubleToLongBits(yData[index]) == Double.doubleToLongBits(yShift[i])) {
                shiftedZ[index] += shift[i];
                foundValue = true;
            }
        }
        if (!foundValue) {
            throw new IllegalArgumentException("No x-y data in surface for (" + x + ", " + yShift[i] + ")");
        }
    }
    return NodalDoublesSurface.from(xData, yData, shiftedZ, newName);
}

From source file:monasca.common.model.alarm.AlarmSubExpression.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    AlarmSubExpression other = (AlarmSubExpression) obj;
    if (function != other.function)
        return false;
    if (metricDefinition == null) {
        if (other.metricDefinition != null)
            return false;
    } else if (!metricDefinition.equals(other.metricDefinition))
        return false;
    if (operator != other.operator)
        return false;
    if (period != other.period)
        return false;
    if (periods != other.periods)
        return false;
    if (deterministic != other.deterministic)
        return false;
    if (Double.doubleToLongBits(threshold) != Double.doubleToLongBits(other.threshold))
        return false;
    return true;/*from   ww  w  .  j  a  v  a2s  . co m*/
}

From source file:it_minds.dk.eindberetningmobil_android.models.internal.SaveableReport.java

@Override
public int hashCode() {
    int result;// w w w  . java  2s.co  m
    long temp;
    result = jsonToSend != null ? jsonToSend.hashCode() : 0;
    result = 31 * result + (purpose != null ? purpose.hashCode() : 0);
    result = 31 * result + (rateid != null ? rateid.hashCode() : 0);
    temp = Double.doubleToLongBits(totalDistance);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
    return result;
}

From source file:com.opengamma.analytics.financial.model.option.definition.ForwardStartOptionDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from  w ww  .  ja  v  a2s .c om*/
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ForwardStartOptionDefinition other = (ForwardStartOptionDefinition) obj;
    if (!ObjectUtils.equals(_moneyness, other._moneyness)) {
        return false;
    }
    if (Double.doubleToLongBits(_percent) != Double.doubleToLongBits(other._percent)) {
        return false;
    }
    return ObjectUtils.equals(_startTime, other._startTime);
}

From source file:com.opengamma.analytics.financial.forex.derivative.ForexOptionDigital.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;/*from ww  w .java  2s .c  o m*/
    temp = Double.doubleToLongBits(_expirationTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + (_isCall ? 1231 : 1237);
    result = prime * result + (_isLong ? 1231 : 1237);
    result = prime * result + _underlyingForex.hashCode();
    return result;
}

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

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    long temp;//from  w  w w  .  ja v a 2 s.  com
    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(_fixingYearFraction);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _forwardCurveName.hashCode();
    result = prime * result + _index.hashCode();
    temp = Double.doubleToLongBits(_rate);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
}