Example #1
0
        public static void setCouponPricer(List <CashFlow> leg, FloatingRateCouponPricer pricer)
        {
            PricerSetter setter = new PricerSetter(pricer);

            foreach (CashFlow cf in leg)
            {
                cf.accept(setter);
            }
        }
Example #2
0
        public static void setCouponPricers(List <CashFlow> leg, List <FloatingRateCouponPricer> pricers)
        {
            int nCashFlows = leg.Count;

            Utils.QL_REQUIRE(nCashFlows > 0, () => "no cashflows");

            int nPricers = pricers.Count;

            Utils.QL_REQUIRE(nCashFlows >= nPricers, () =>
                             "mismatch between leg size (" + nCashFlows +
                             ") and number of pricers (" + nPricers + ")");

            for (int i = 0; i < nCashFlows; ++i)
            {
                PricerSetter setter = new PricerSetter(i < nPricers ? pricers[i] : pricers[nPricers - 1]);
                leg[i].accept(setter);
            }
        }