List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:com.opengamma.analytics.math.surface.NodalSurfaceMultiplicativeShiftFunction.java
/** * {@inheritDoc}/*from ww w .j a v a 2s . c om*/ * @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[] percentage, final String newName) { Validate.notNull(surface, "surface"); Validate.notNull(xShift, "x shift"); Validate.notNull(yShift, "y shift"); Validate.notNull(percentage, "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 == percentage.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] *= 1 + percentage[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:com.opengamma.maths.lowlevelapi.datatypes.primitive.MatrixPrimitiveUtils.java
/** * Test a vector to see if there is a block of contiguous nonzero values present. * @param aVector the vector to be tested * @return true if a contiguous block exists, false otherwise. If a vector is entirely composed of zeros it returns true as the data is contiguous but not present! */// w w w . j av a 2s. c o m public static boolean arrayHasContiguousRowEntries(double[] aVector) { int nnz = numberOfNonZeroElementsInVector(aVector); if (nnz == 0) { return true; } if (nnz == 1) { return true; } int dataStartsAt = 0; for (int i = 0; i < aVector.length; i++) { if (Double.doubleToLongBits(aVector[i]) != 0L) { dataStartsAt = i; break; } } int dataEndsAt = aVector.length - 1; for (int i = aVector.length - 1; i > 0; i--) { if (Double.doubleToLongBits(aVector[i]) != 0L) { dataEndsAt = i; break; } } if (dataEndsAt - dataStartsAt + 1 == nnz) { return true; } else { return false; } }
From source file:org.jberet.support.io.Company.java
@Override public int hashCode() { int result;/* w w w . j a v a2 s . com*/ long temp; result = symbol.hashCode(); result = 31 * result + name.hashCode(); temp = Double.doubleToLongBits(lastSale); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(marketCap); result = 31 * result + (int) (temp ^ (temp >>> 32)); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (ipoYear != null ? ipoYear.hashCode() : 0); result = 31 * result + (sector != null ? sector.hashCode() : 0); result = 31 * result + (industry != null ? industry.hashCode() : 0); result = 31 * result + (summaryQuote != null ? summaryQuote.hashCode() : 0); return result; }
From source file:com.opengamma.analytics.financial.equity.future.definition.IndexFutureDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w . ja va 2s . c o m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final IndexFutureDefinition other = (IndexFutureDefinition) obj; if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) { return false; } if (!ObjectUtils.equals(_expiryDate, other._expiryDate)) { return false; } if (!ObjectUtils.equals(_settlementDate, other._settlementDate)) { return false; } if (!ObjectUtils.equals(_currency, other._currency)) { return false; } if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) { return false; } return true; }
From source file:com.tealcube.minecraft.bukkit.mythicdrops.api.enchantments.MythicEnchantment.java
@Override public int hashCode() { int result;/* w w w. java 2s . co m*/ long temp; result = enchantment != null ? enchantment.hashCode() : 0; temp = Double.doubleToLongBits(minimumLevel); result = 31 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(maximumLevel); result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.controller.model.Product.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/*from ww w .jav a2s .c o m*/ if (obj == null) { return false; } if (!(obj instanceof Product)) { return false; } Product other = (Product) obj; if (productDescription == null) { if (other.productDescription != null) { return false; } } else if (!productDescription.equals(other.productDescription)) { return false; } if (productName == null) { if (other.productName != null) { return false; } } else if (!productName.equals(other.productName)) { return false; } if (Double.doubleToLongBits(productPrice) != Double.doubleToLongBits(other.productPrice)) { return false; } if (productSerialNumber == null) { if (other.productSerialNumber != null) { return false; } } else if (!productSerialNumber.equals(other.productSerialNumber)) { return false; } if (productSpecificationList == null) { if (other.productSpecificationList != null) { return false; } } else if (!productSpecificationList.equals(other.productSpecificationList)) { return false; } if (productImageList == null) { if (other.productImageList != null) { return false; } } else if (!productImageList.equals(other.productImageList)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.model.interestrate.curve.ForwardCurveAffineDividends.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from ww w . j a v a 2 s . c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ForwardCurveAffineDividends other = (ForwardCurveAffineDividends) obj; if (!ObjectUtils.equals(getRiskFreeCurve(), other.getRiskFreeCurve())) { return false; } if (!ObjectUtils.equals(getDividends(), other.getDividends())) { return false; } if (Double.doubleToLongBits(getSpot()) != Double.doubleToLongBits(other.getSpot())) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.CouponArithmeticAverageONSpreadSimplified.java
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); long temp;/*from w ww . j av a 2s.c om*/ 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 + _index.hashCode(); temp = Double.doubleToLongBits(_spread); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_spreadAmount); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginSecurity.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (_discountingCurveName == null ? 0 : _discountingCurveName.hashCode()); long temp;/* www . ja v a2 s . c o m*/ temp = Double.doubleToLongBits(_expirationTime); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + (_forwardCurveName == null ? 0 : _forwardCurveName.hashCode()); result = prime * result + (_isCall ? 1231 : 1237); temp = Double.doubleToLongBits(_strike); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _underlyingFuture.hashCode(); return result; }
From source file:com.opengamma.analytics.financial.model.option.definition.SimpleChooserOptionDefinition.java
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((_underlyingExpiry == null) ? 0 : _underlyingExpiry.hashCode()); long temp;//from w w w .ja v a 2 s . c om temp = Double.doubleToLongBits(_underlyingStrike); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }