List of usage examples for java.lang Double doubleToLongBits
@HotSpotIntrinsicCandidate public static long doubleToLongBits(double value)
From source file:com.opengamma.analytics.math.statistics.distribution.NormalDistribution.java
@Override public int hashCode() { final int prime = 31; int result = 1; long temp;/*from w w w . ja v a2s.c o m*/ temp = Double.doubleToLongBits(_mean); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_standardDeviation); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from w w w. j a v a2s.co m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final InterestRateFutureOptionMarginTransaction other = (InterestRateFutureOptionMarginTransaction) obj; if (_quantity != other._quantity) { return false; } if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) { return false; } if (!ObjectUtils.equals(_underlyingOption, other._underlyingOption)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.interestrate.future.derivative.DeliverableSwapFuturesSecurity.java
@Override public int hashCode() { final int prime = 31; int result = 1; long temp;/*from w w w . j ava 2s . c om*/ temp = Double.doubleToLongBits(_deliveryTime); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_lastTradingTime); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_notional); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _underlyingSwap.hashCode(); return result; }
From source file:com.kinesisboard.amazonaws.model.StockTrade.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (int) (id ^ (id >>> 32)); long temp;//from w w w .j av a2 s . c o m temp = Double.doubleToLongBits(price); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + (int) (quantity ^ (quantity >>> 32)); result = prime * result + ((tickerSymbol == null) ? 0 : tickerSymbol.hashCode()); result = prime * result + ((timeInMillis == null) ? 0 : timeInMillis.hashCode()); result = prime * result + ((tradeType == null) ? 0 : tradeType.hashCode()); return result; }
From source file:com.opengamma.analytics.financial.model.option.definition.CappedPowerOptionDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }/*from w w w . j a v a 2s . c o m*/ if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } final CappedPowerOptionDefinition other = (CappedPowerOptionDefinition) obj; if (Double.doubleToLongBits(_cap) != Double.doubleToLongBits(other._cap)) { return false; } if (Double.doubleToLongBits(_power) != Double.doubleToLongBits(other._power)) { return false; } return true; }
From source file:com.opengamma.analytics.financial.model.option.pricing.tree.BinomialTreeBuilder.java
/** * Builds a tree of an asset prices/* w w w . j a v a 2 s. c o m*/ * @param maturity The time span (in years) of the tree * @param data OptionDataBundle * @param nSteps The number of steps in the tree (need at least 1 step) * @return tree of an asset prices */ @SuppressWarnings("unchecked") public RecombiningBinomialTree<BinomialTreeNode<Double>> buildAssetTree(final double maturity, final T data, final int nSteps) { final BinomialTreeNode<Double>[][] tree = new BinomialTreeNode[nSteps + 1][]; double t = 0; final double spot = data.getSpot(); final double dt = maturity / nSteps; double[] spots = new double[1]; spots[0] = spot; for (int i = 1; i <= nSteps; i++) { t = (i - 1) * dt; final double[] forwards = getForwards(spots, data, t, dt); final double[] nodes = new double[i + 1]; int jPlus; int jMinus; if (i % 2 == 0) { // central node set equal to spot final int k = i / 2; jPlus = k + 1; jMinus = k - 1; nodes[k] = spot; // TODO have an option for the centre node to follow the forward rather than the spot } else { final int k = (i - 1) / 2; jPlus = k + 2; jMinus = k - 1; final double sigma = data.getVolatility(t, spots[k]); final DoublesPair nodePair = getCentralNodePair(dt, sigma, forwards[k], spot); nodes[k] = nodePair.first; nodes[k + 1] = nodePair.second; } for (int j = jPlus; j <= i; j++) { final double sigma = data.getVolatility(t, spots[j - 1]); nodes[j] = getNextHigherNode(dt, sigma, forwards[j - 1], nodes[j - 1]); } for (int j = jMinus; j >= 0; j--) { final double sigma = data.getVolatility(t, spots[j]); nodes[j] = getNextLowerNode(dt, sigma, forwards[j], nodes[j + 1]); } tree[i - 1] = new BinomialTreeNode[i]; for (int j = 0; j < i; j++) { final double diff = nodes[j + 1] - nodes[j]; double p; if (diff == 0.0) { // some branches of the tree are stuck at spot = 0.0 - this is not a problem as such Validate.isTrue(Double.doubleToLongBits(forwards[j]) == Double.doubleToLongBits(nodes[j]), "inconsistent nodes"); p = 0.5; // Arbitrary as nodes are degenerate } else { p = (forwards[j] - nodes[j]) / diff; } tree[i - 1][j] = new BinomialTreeNode<>(spots[j], p); } spots = nodes; } // fill out the final column of nodes - probability is set to zero tree[nSteps] = new BinomialTreeNode[nSteps + 1]; for (int j = 0; j <= nSteps; j++) { tree[nSteps][j] = new BinomialTreeNode<>(spots[j], 0.0); } return new RecombiningBinomialTree<>(tree); }
From source file:com.opengamma.financial.analytics.volatility.surface.FunctionalVolatilitySurfaceData.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _nX;//from w w w .j a va 2 s.com long temp; temp = Double.doubleToLongBits(_nY); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _surface.hashCode(); result = prime * result + _xLabel.hashCode(); temp = Double.doubleToLongBits(_xMaximum); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_xMinimum); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + _yLabel.hashCode(); temp = Double.doubleToLongBits(_yMaximum); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_yMinimum); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_zMaximum); result = prime * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(_zMinimum); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.eTilbudsavis.etasdk.model.Pricing.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mCurrency == null) ? 0 : mCurrency.hashCode()); result = prime * result + ((mPrePrice == null) ? 0 : mPrePrice.hashCode()); long temp;/*from w w w.j a v a 2s . c om*/ temp = Double.doubleToLongBits(mPrice); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; }
From source file:com.hybris.mobile.lib.location.geofencing.data.GeofenceObject.java
@Override public int hashCode() { int result;//from w w w .j ava2 s . c om long temp; result = id != null ? id.hashCode() : 0; 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 + (radius != +0.0f ? Float.floatToIntBits(radius) : 0); result = 31 * result + (int) (expirationDuration ^ (expirationDuration >>> 32)); result = 31 * result + transitionType; result = 31 * result + (notificationByTransition != null ? notificationByTransition.hashCode() : 0); return result; }
From source file:com.opengamma.analytics.financial.simpleinstruments.definition.SimpleFXFutureDefinition.java
@Override public boolean equals(final Object obj) { if (this == obj) { return true; }//from w w w .j av a2s.co m if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimpleFXFutureDefinition other = (SimpleFXFutureDefinition) 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(_payCurrency, other._payCurrency)) { return false; } if (!ObjectUtils.equals(_receiveCurrency, other._receiveCurrency)) { return false; } if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) { return false; } return true; }