List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:MutableDouble.java
/** * Compares this object against the specified object. The result is * <code>true</code> if and only if the argument is not <code>null</code> * and is a <code>Double</code> object that represents a double that has the * identical bit pattern to the bit pattern of the double represented by this * object. For this purpose, two <code>double</code> values are considered * to be the same if and only if the method * {@link Double#doubleToLongBits(double)}returns the same long value when * applied to each.// w w w . j a v a 2 s .c o m * <p> * Note that in most cases, for two instances of class <code>Double</code>,<code>d1</code> * and <code>d2</code>, the value of <code>d1.equals(d2)</code> is * <code>true</code> if and only if <blockquote> * * <pre> * d1.doubleValue() == d2.doubleValue() * </pre> * * </blockquote> * <p> * also has the value <code>true</code>. However, there are two exceptions: * <ul> * <li>If <code>d1</code> and <code>d2</code> both represent * <code>Double.NaN</code>, then the <code>equals</code> method returns * <code>true</code>, even though <code>Double.NaN==Double.NaN</code> has * the value <code>false</code>. * <li>If <code>d1</code> represents <code>+0.0</code> while * <code>d2</code> represents <code>-0.0</code>, or vice versa, the * <code>equal</code> test has the value <code>false</code>, even though * <code>+0.0==-0.0</code> has the value <code>true</code>. This allows * hashtables to operate properly. * </ul> * * @param obj * the object to compare with. * @return <code>true</code> if the objects are the same; <code>false</code> * otherwise. */ public boolean equals(Object obj) { return (obj instanceof MutableDouble) && (Double.doubleToLongBits(((MutableDouble) obj).value) == Double.doubleToLongBits(value)); }
From source file:com.opengamma.analytics.financial.instrument.future.SwapFuturesPriceDeliverableTransactionDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w. j a v a 2 s . c o m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SwapFuturesPriceDeliverableTransactionDefinition other = (SwapFuturesPriceDeliverableTransactionDefinition) obj; if (_quantity != other._quantity) { return false; } if (!ObjectUtils.equals(_transactionDate, other._transactionDate)) { return false; } if (Double.doubleToLongBits(_transactionPrice) != Double.doubleToLongBits(other._transactionPrice)) { return false; } if (!ObjectUtils.equals(_underlying, other._underlying)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.instrument.future.SwapFuturesPriceDeliverableSecurityDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from ww w.j a v a2 s .co m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SwapFuturesPriceDeliverableSecurityDefinition other = (SwapFuturesPriceDeliverableSecurityDefinition) obj; if (!ObjectUtils.equals(_deliveryDate, other._deliveryDate)) { return false; } if (!ObjectUtils.equals(_lastTradingDate, other._lastTradingDate)) { return false; } if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) { return false; } if (!ObjectUtils.equals(_underlyingSwap, other._underlyingSwap)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.bond.definition.BillSecurity.java
@Override public int hashCode() { final int prime = 31; int result = 1; long temp;//from w w w . java2 s.c o m temp = Double.doubleToLongBits(_accrualFactor); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + (_creditCurveName == null ? 0 : _creditCurveName.hashCode()); result = prime * result + _currency.hashCode(); result = prime * result + (_discountingCurveName == null ? 0 : _discountingCurveName.hashCode()); temp = Double.doubleToLongBits(_endTime); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _issuer.hashCode(); temp = Double.doubleToLongBits(_notional); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_settlementTime); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _yieldConvention.hashCode(); return result; }
From source file:com.opengamma.analytics.financial.instrument.future.FederalFundsFutureTransactionDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from www . j a va2 s .c om*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final FederalFundsFutureTransactionDefinition other = (FederalFundsFutureTransactionDefinition) 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.model.interestrate.curve.ForwardCurve.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/* ww w.ja v a2s . c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ForwardCurve other = (ForwardCurve) obj; if (!ObjectUtils.equals(_drift, other._drift)) { return false; } if (!ObjectUtils.equals(_fwdCurve, other._fwdCurve)) { return false; } if (Double.doubleToLongBits(_spot) != Double.doubleToLongBits(other._spot)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.CouponIbor.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*ww w .j a v a 2 s . c o m*/ if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CouponIbor other = (CouponIbor) obj; if (Double.doubleToLongBits(_fixingPeriodEndTime) != Double.doubleToLongBits(other._fixingPeriodEndTime)) { return false; } if (Double.doubleToLongBits(_fixingPeriodStartTime) != Double .doubleToLongBits(other._fixingPeriodStartTime)) { return false; } if (Double.doubleToLongBits(_fixingAccrualFactor) != Double.doubleToLongBits(other._fixingAccrualFactor)) { return false; } if (!ObjectUtils.equals(_forwardCurveName, other._forwardCurveName)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.CouponON.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }// w w w . j a va 2s. c om if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CouponON other = (CouponON) obj; if (Double.doubleToLongBits(_fixingPeriodAccrualFactor) != Double .doubleToLongBits(other._fixingPeriodAccrualFactor)) { return false; } if (Double.doubleToLongBits(_fixingPeriodEndTime) != Double.doubleToLongBits(other._fixingPeriodEndTime)) { return false; } if (Double.doubleToLongBits(_fixingPeriodStartTime) != Double .doubleToLongBits(other._fixingPeriodStartTime)) { return false; } if (!ObjectUtils.equals(_index, other._index)) { return false; } if (Double.doubleToLongBits(_notionalAccrued) != Double.doubleToLongBits(other._notionalAccrued)) { return false; } return true; }
From source file:MutableDouble.java
/** * Returns a suitable hashcode for this mutable. * //from ww w . j a v a2s. c o m * @return a suitable hashcode */ public int hashCode() { long bits = Double.doubleToLongBits(value); return (int) (bits ^ (bits >>> 32)); }
From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.CouponIborCompoundingFlatSpread.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }//from w w w .j a va 2s. c om if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } CouponIborCompoundingFlatSpread other = (CouponIborCompoundingFlatSpread) obj; if (Double.doubleToLongBits(_compoundingPeriodAmountAccumulated) != Double .doubleToLongBits(other._compoundingPeriodAmountAccumulated)) { return false; } if (!Arrays.equals(_fixingSubperiodsAccrualFactors, other._fixingSubperiodsAccrualFactors)) { return false; } if (!Arrays.equals(_fixingSubperiodsEndTimes, other._fixingSubperiodsEndTimes)) { return false; } if (!Arrays.equals(_fixingSubperiodsStartTimes, other._fixingSubperiodsStartTimes)) { return false; } if (!Arrays.equals(_fixingTimes, other._fixingTimes)) { return false; } if (!ObjectUtils.equals(_index, other._index)) { return false; } if (Double.doubleToLongBits(_spread) != Double.doubleToLongBits(other._spread)) { return false; } if (!Arrays.equals(_subperiodsAccrualFactors, other._subperiodsAccrualFactors)) { return false; } return true; }