@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + Arrays.hashCode(_curves); result = prime * result + _spreadFunction.hashCode(); return result; }
/** * @param spreadFunction The spread function, not null * @param name The name of the curve * @param curves The curves, not null, contains more than one curve */ public SpreadDoublesCurve( final CurveSpreadFunction spreadFunction, final String name, final DoublesCurve... curves) { super(name); ArgumentChecker.notNull(curves, "curves"); ArgumentChecker.isTrue(curves.length > 1, "curves"); ArgumentChecker.notNull(spreadFunction, "spread operator"); _curves = curves; _spreadFunction = spreadFunction; _f = spreadFunction.evaluate(curves); }
/** * Returns a string that represents the mathematical form of this curve. For example, <i>D = (A + * (B / C))</i> * * @return The long name of this curve */ public String getLongName() { final StringBuffer sb = new StringBuffer(getName()); sb.append("="); int i = 0; sb.append("("); for (final Curve<Double, Double> curve : _curves) { if (curve instanceof SpreadDoublesCurve) { sb.append(((SpreadDoublesCurve) curve).getLongName().substring(2)); } else { sb.append(curve.getName()); } if (i != _curves.length - 1) { sb.append(_spreadFunction.getOperationName()); } i++; } sb.append(")"); return sb.toString(); }