예제 #1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Summarizes this swap into string form.
        /// </summary>
        /// <returns> the summary description </returns>
        public string summaryDescription()
        {
            // 5Y USD 2mm Rec USD-LIBOR-6M / Pay 1% : 21Jan17-21Jan22
            StringBuilder buf = new StringBuilder(64);

            buf.Append(SummarizerUtils.datePeriod(StartDate.Unadjusted, EndDate.Unadjusted));
            buf.Append(' ');
            if (Legs.size() == 2 && PayLeg.Present && ReceiveLeg.Present && Legs.All(leg => leg is RateCalculationSwapLeg))
            {
                // normal swap
                SwapLeg payLeg      = PayLeg.get();
                SwapLeg recLeg      = ReceiveLeg.get();
                string  payNotional = notional(payLeg);
                string  recNotional = notional(recLeg);
                if (payNotional.Equals(recNotional))
                {
                    buf.Append(recNotional);
                    buf.Append(" Rec ");
                    buf.Append(legSummary(recLeg));
                    buf.Append(" / Pay ");
                    buf.Append(legSummary(payLeg));
                }
                else
                {
                    buf.Append("Rec ");
                    buf.Append(legSummary(recLeg));
                    buf.Append(' ');
                    buf.Append(recNotional);
                    buf.Append(" / Pay ");
                    buf.Append(legSummary(payLeg));
                    buf.Append(' ');
                    buf.Append(payNotional);
                }
            }
            else
            {
                // abnormal swap
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
                buf.Append(Legs.Select(leg => (SummarizerUtils.payReceive(leg.PayReceive) + " " + legSummary(leg) + " " + notional(leg)).Trim()).collect(joining(" / ")));
            }
            buf.Append(" : ");
            buf.Append(SummarizerUtils.dateRange(StartDate.Unadjusted, EndDate.Unadjusted));
            return(buf.ToString());
        }