CDXRefDataParams.java

  1. package org.drip.product.params;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

  5. /*!
  6.  * Copyright (C) 2020 Lakshmi Krishnamurthy
  7.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  8.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  9.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  10.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  11.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  12.  * Copyright (C) 2014 Lakshmi Krishnamurthy
  13.  * Copyright (C) 2013 Lakshmi Krishnamurthy
  14.  * Copyright (C) 2012 Lakshmi Krishnamurthy
  15.  *
  16.  *  This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
  17.  *      asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
  18.  *      analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
  19.  *      equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
  20.  *      numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
  21.  *      and computational support.
  22.  *  
  23.  *      https://lakshmidrip.github.io/DROP/
  24.  *  
  25.  *  DROP is composed of three modules:
  26.  *  
  27.  *  - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
  28.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  29.  *  - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
  30.  *
  31.  *  DROP Product Core implements libraries for the following:
  32.  *  - Fixed Income Analytics
  33.  *  - Loan Analytics
  34.  *  - Transaction Cost Analytics
  35.  *
  36.  *  DROP Portfolio Core implements libraries for the following:
  37.  *  - Asset Allocation Analytics
  38.  *  - Asset Liability Management Analytics
  39.  *  - Capital Estimation Analytics
  40.  *  - Exposure Analytics
  41.  *  - Margin Analytics
  42.  *  - XVA Analytics
  43.  *
  44.  *  DROP Computational Core implements libraries for the following:
  45.  *  - Algorithm Support
  46.  *  - Computation Support
  47.  *  - Function Analysis
  48.  *  - Model Validation
  49.  *  - Numerical Analysis
  50.  *  - Numerical Optimizer
  51.  *  - Spline Builder
  52.  *  - Statistical Learning
  53.  *
  54.  *  Documentation for DROP is Spread Over:
  55.  *
  56.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  57.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  58.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  59.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  60.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  61.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  62.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  63.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  64.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  65.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  66.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  67.  *
  68.  *  Licensed under the Apache License, Version 2.0 (the "License");
  69.  *      you may not use this file except in compliance with the License.
  70.  *  
  71.  *  You may obtain a copy of the License at
  72.  *      http://www.apache.org/licenses/LICENSE-2.0
  73.  *  
  74.  *  Unless required by applicable law or agreed to in writing, software
  75.  *      distributed under the License is distributed on an "AS IS" BASIS,
  76.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  77.  *  
  78.  *  See the License for the specific language governing permissions and
  79.  *      limitations under the License.
  80.  */

  81. /**
  82.  * <i>CDXRefDataParams</i> contains the complete set of reference data that corresponds to the contract of a
  83.  * standard CDX. It consists of the following category and fields:
  84.  *
  85.  * <br><br>
  86.  *  <ul>
  87.  *      <li>
  88.  *          Descriptive - Index Label, Index Name, Curve Name, Index Class, Index Group Name, Index Short
  89.  *              Group Name, Index Short Name, Short Name
  90.  *      </li>
  91.  *      <li>
  92.  *          Issuer ID - Curve ID, Red ID, Series, Version, Curvy Curve ID, Location, Bloomberg Ticker
  93.  *      </li>
  94.  *      <li>
  95.  *          Quote Details - Quote As CDS
  96.  *      </li>
  97.  *      <li>
  98.  *          Date - Issue Date, Maturity Date
  99.  *      </li>
  100.  *      <li>
  101.  *          Coupon Parameters - Coupon Rate, Currency, Day Count, Full First Stub, Frequency
  102.  *      </li>
  103.  *      <li>
  104.  *          Component Details - Original Count, Defaulted Count
  105.  *      </li>
  106.  *      <li>
  107.  *          Payoff Details - Knock-out on Default, Pay Accrued Amount, Recovery on Default
  108.  *      </li>
  109.  *      <li>
  110.  *          Other - Index Life Span, Index Factor
  111.  *      </li>
  112.  *  </ul>
  113.  * <br><br>
  114.  *  
  115.  * It also exports serialization into and de-serialization out of byte arrays.
  116.  *
  117.  * <br><br>
  118.  *  <ul>
  119.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  120.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  121.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/product/README.md">Product Components/Baskets for Credit, FRA, FX, Govvie, Rates, and Option AssetClasses</a></li>
  122.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/product/params/README.md">Fixed Income Product Customization Parameters</a></li>
  123.  *  </ul>
  124.  * <br><br>
  125.  *
  126.  * @author Lakshmi Krishnamurthy
  127.  */

  128. public class CDXRefDataParams {

  129.     /**
  130.      * Index Curve ID
  131.      */

  132.     public java.lang.String _strCurveID = "";

  133.     /**
  134.      * Index Curve SPN
  135.      */

  136.     public java.lang.String _strSPN = "";

  137.     /**
  138.      * Index Label
  139.      */

  140.     public java.lang.String _strIndexLabel = "";

  141.     /**
  142.      * Index Name
  143.      */

  144.     public java.lang.String _strIndexName = "";

  145.     /**
  146.      * Index Curve Name
  147.      */

  148.     public java.lang.String _strCurveName = "";

  149.     /**
  150.      * Index Issue Date
  151.      */

  152.     public org.drip.analytics.date.JulianDate _dtIssue = null;

  153.     /**
  154.      * Index Maturity Date
  155.      */

  156.     public org.drip.analytics.date.JulianDate _dtMaturity = null;

  157.     /**
  158.      * Index Coupon (bp)
  159.      */

  160.     public double _dblCoupon = java.lang.Double.NaN;

  161.     /**
  162.      * Index Currency
  163.      */

  164.     public java.lang.String _strCurrency = "";

  165.     /**
  166.      * Index DayCount
  167.      */

  168.     public java.lang.String _strDayCount = "";

  169.     /**
  170.      * Index Full First Stub
  171.      */

  172.     public boolean _bFullFirstStub = false;

  173.     /**
  174.      * Index Recovery
  175.      */

  176.     public double _dblRecovery = java.lang.Double.NaN;

  177.     /**
  178.      * Index Frequency
  179.      */

  180.     public int _iFrequency = 0;

  181.     /**
  182.      * Index Red ID
  183.      */

  184.     public java.lang.String _strRedID = "";

  185.     /**
  186.      * Index Class
  187.      */

  188.     public java.lang.String _strIndexClass = "";

  189.     /**
  190.      * Index Series
  191.      */

  192.     public int _iIndexSeries = 0;

  193.     /**
  194.      * Index Group Name
  195.      */

  196.     public java.lang.String _strIndexGroupName = "";

  197.     /**
  198.      * Index Short Name
  199.      */

  200.     public java.lang.String _strIndexShortName = "";

  201.     /**
  202.      * Index Short Group Name
  203.      */

  204.     public java.lang.String _strIndexShortGroupName = "";

  205.     /**
  206.      * Index Version
  207.      */

  208.     public int _iIndexVersion = 0;

  209.     /**
  210.      * Index Life Span
  211.      */

  212.     public int _iIndexLifeSpan = 0;

  213.     /**
  214.      * Index Curvy Curve ID
  215.      */

  216.     public java.lang.String _strCurvyCurveID = "";

  217.     /**
  218.      * Index Factor
  219.      */

  220.     public double _dblIndexFactor = java.lang.Double.NaN;

  221.     /**
  222.      * Index Original Component Count
  223.      */

  224.     public int _iOriginalComponentCount = 0;

  225.     /**
  226.      * Index Defaulted Component Count
  227.      */

  228.     public int _iDefaultedComponentCount = 0;

  229.     /**
  230.      * Index Location
  231.      */

  232.     public java.lang.String _strLocation = "";

  233.     /**
  234.      * Index Pay Accrued
  235.      */

  236.     public boolean _bPayAccrued = false;

  237.     /**
  238.      * Index Knock-out On Default
  239.      */

  240.     public boolean _bKnockOutOnDefault = false;

  241.     /**
  242.      * Index Quote As CDS
  243.      */

  244.     public boolean _bQuoteAsCDS = false;

  245.     /**
  246.      * Index Bloomberg Ticker
  247.      */

  248.     public java.lang.String _strBBGTicker = "";

  249.     /**
  250.      * Index Short Name
  251.      */

  252.     public java.lang.String _strShortName = "";

  253.     /**
  254.      * Create a CDXRefData instance from valid individual parameters (so no additional validation is
  255.      *  performed).
  256.      *
  257.      * @param strCurveID Index Curve ID
  258.      * @param strSPN Index SPN
  259.      * @param strIndexLabel Index Label
  260.      * @param strIndexName Index Name
  261.      * @param strCurveName Index Curve Name
  262.      * @param iIssueDate Index Issue Date
  263.      * @param iMaturityDate Index Maturity Date
  264.      * @param dblCoupon Index Coupon
  265.      * @param strCurrency Index Currency
  266.      * @param strDayCount Index Day Count Convention
  267.      * @param bFullFirstStub Index Flag indicating whether it is a full front stub
  268.      * @param dblRecovery Index Recovery Rate
  269.      * @param iFrequency Index Frequency
  270.      * @param strRedID Index Reference Entity Database ID
  271.      * @param strIndexClass Index Class
  272.      * @param iIndexSeries Index Series
  273.      * @param strIndexGroupName Index Group Name
  274.      * @param strIndexShortName Index Short Name
  275.      * @param strIndexShortGroupName Index SHort Group Name
  276.      * @param iIndexVersion Index Version
  277.      * @param iIndexLifeSpan Index Life Span
  278.      * @param strCurvyCurveID Full Index Curve ID
  279.      * @param dblIndexFactor Index Factor
  280.      * @param iOriginalComponentCount Original Index Component Count
  281.      * @param iDefaultedComponentCount Defaulted Component Count in the Index
  282.      * @param strLocation Index Domicile Location
  283.      * @param bPayAccrued Does Index Pay Accrued
  284.      * @param bKnockOutOnDefault Does the Index Knock Out On Default
  285.      * @param bQuoteAsCDS Is the Index Quoted as a CDS (i.e., spread/up-front)
  286.      * @param strBBGTicker Index Bloomberg Ticker
  287.      * @param strShortName Index Short Name
  288.      *
  289.      * @return The CDXRefData instance
  290.      */

  291.     public static final CDXRefDataParams CreateCDXRefDataBuilder (
  292.         final java.lang.String strCurveID,
  293.         final java.lang.String strSPN,
  294.         final java.lang.String strIndexLabel,
  295.         final java.lang.String strIndexName,
  296.         final java.lang.String strCurveName,
  297.         final int iIssueDate,
  298.         final int iMaturityDate,
  299.         final double dblCoupon,
  300.         final java.lang.String strCurrency,
  301.         final java.lang.String strDayCount,
  302.         final boolean bFullFirstStub,
  303.         final double dblRecovery,
  304.         final int iFrequency,
  305.         final java.lang.String strRedID,
  306.         final java.lang.String strIndexClass,
  307.         final int iIndexSeries,
  308.         final java.lang.String strIndexGroupName,
  309.         final java.lang.String strIndexShortName,
  310.         final java.lang.String strIndexShortGroupName,
  311.         final int iIndexVersion,
  312.         final int iIndexLifeSpan,
  313.         final java.lang.String strCurvyCurveID,
  314.         final double dblIndexFactor,
  315.         final int iOriginalComponentCount,
  316.         final int iDefaultedComponentCount,
  317.         final java.lang.String strLocation,
  318.         final boolean bPayAccrued,
  319.         final boolean bKnockOutOnDefault,
  320.         final boolean bQuoteAsCDS,
  321.         final java.lang.String strBBGTicker,
  322.         final java.lang.String strShortName)
  323.     {
  324.         CDXRefDataParams cdxrd = new CDXRefDataParams();

  325.         cdxrd.setCurveID (strCurveID);

  326.         cdxrd.setSPN (strSPN);

  327.         cdxrd.setIndexLabel (strIndexLabel);

  328.         cdxrd.setIndexName (strIndexName);

  329.         cdxrd.setCurveName (strCurveName);

  330.         cdxrd.setIssueDate (new org.drip.analytics.date.JulianDate (iIssueDate));

  331.         cdxrd.setMaturityDate (new org.drip.analytics.date.JulianDate (iMaturityDate));

  332.         cdxrd.setCoupon (dblCoupon);

  333.         cdxrd.setCurrency (strCurrency);

  334.         cdxrd.setDayCount (strDayCount);

  335.         cdxrd.setFullFirstStub (bFullFirstStub);

  336.         cdxrd.setRecovery (dblRecovery);

  337.         cdxrd.setFrequency (iFrequency);

  338.         cdxrd.setRedID (strRedID);

  339.         cdxrd.setIndexClass (strIndexClass);

  340.         cdxrd.setIndexSeries (iIndexSeries);

  341.         cdxrd.setIndexGroupName (strIndexGroupName);

  342.         cdxrd.setIndexShortName (strIndexShortName);

  343.         cdxrd.setIndexShortGroupName (strIndexShortGroupName);

  344.         cdxrd.setIndexVersion (iIndexVersion);

  345.         cdxrd.setIndexLifeSpan (iIndexLifeSpan);

  346.         cdxrd.setCurvyCurveID (strCurvyCurveID);

  347.         cdxrd.setIndexFactor (dblIndexFactor);

  348.         cdxrd.setOriginalComponentCount (iOriginalComponentCount);

  349.         cdxrd.setDefaultedComponentCount (iDefaultedComponentCount);

  350.         cdxrd.setLocation (strLocation);

  351.         cdxrd.setPayAccrued (bPayAccrued);

  352.         cdxrd.setKnockOutOnDefault (bKnockOutOnDefault);

  353.         cdxrd.setQuoteAsCDS (bQuoteAsCDS);

  354.         cdxrd.setBBGTicker (strBBGTicker);

  355.         cdxrd.setShortName (strShortName);

  356.         if (!cdxrd.validate()) return null;

  357.         return cdxrd;
  358.     }

  359.      /**
  360.      * Empty Default constructor
  361.      */

  362.     public CDXRefDataParams()
  363.     {
  364.     }

  365.     /**
  366.      * Set the Index Curve ID
  367.      *
  368.      * @param strCurveID Index Curve ID
  369.      *
  370.      * @return TRUE if successful
  371.      */

  372.     public boolean setCurveID (
  373.         final java.lang.String strCurveID)
  374.     {
  375.         if (null == (_strCurveID = strCurveID) || _strCurveID.isEmpty()) return false;

  376.         return true;
  377.     }

  378.     /**
  379.      * Set the Index SPN
  380.      *
  381.      * @param strSPN Index SPN
  382.      *
  383.      * @return TRUE if successful
  384.      */

  385.     public boolean setSPN (
  386.         final java.lang.String strSPN)
  387.     {
  388.         if (null == (_strSPN = strSPN) || _strSPN.isEmpty()) return false;

  389.         return true;
  390.     }

  391.     /**
  392.      * Set the Index Label
  393.      *
  394.      * @param strIndexLabel Index Label
  395.      *
  396.      * @return TRUE if successful
  397.      */

  398.     public boolean setIndexLabel (
  399.         final java.lang.String strIndexLabel)
  400.     {
  401.         if (null == (_strIndexLabel = strIndexLabel) || _strIndexLabel.isEmpty()) return false;

  402.         return true;
  403.     }

  404.     /**
  405.      * Set the Index Name
  406.      *
  407.      * @param strIndexName Index Name
  408.      *
  409.      * @return TRUE if successful
  410.      */

  411.     public boolean setIndexName (
  412.         final java.lang.String strIndexName)
  413.     {
  414.         if (null == (_strIndexName = strIndexName) || _strIndexName.isEmpty()) return false;

  415.         return true;
  416.     }

  417.     /**
  418.      * Set the Index Curve Name
  419.      *
  420.      * @param strCurveName Index Curve Name
  421.      *
  422.      * @return TRUE if successful
  423.      */

  424.     public boolean setCurveName (
  425.         final java.lang.String strCurveName)
  426.     {
  427.         if (null == (_strCurveName = strCurveName) || _strCurveName.isEmpty()) return false;

  428.         return true;
  429.     }

  430.     /**
  431.      * Set the Index Issue Date
  432.      *
  433.      * @param dtIssue Index Issue Date
  434.      *
  435.      * @return TRUE if successful
  436.      */

  437.     public boolean setIssueDate (
  438.         final org.drip.analytics.date.JulianDate dtIssue)
  439.     {
  440.         if (null == (_dtIssue = dtIssue)) return false;

  441.         return true;
  442.     }

  443.     /**
  444.      * Set the Index Maturity Date
  445.      *
  446.      * @param dtMaturity Index Maturity Date
  447.      *
  448.      * @return TRUE if successful
  449.      */

  450.     public boolean setMaturityDate (
  451.         final org.drip.analytics.date.JulianDate dtMaturity)
  452.     {
  453.         if (null == (_dtMaturity = dtMaturity)) return false;

  454.         return true;
  455.     }

  456.     /**
  457.      * Set the Index Coupon
  458.      *
  459.      * @param dblCoupon Index Coupon
  460.      *
  461.      * @return TRUE if successful
  462.      */

  463.     public boolean setCoupon (
  464.         final double dblCoupon)
  465.     {
  466.         return org.drip.numerical.common.NumberUtil.IsValid (_dblCoupon = dblCoupon);
  467.     }

  468.     /**
  469.      * Set the Index Currency
  470.      *
  471.      * @param strCurrency Index Currency
  472.      *
  473.      * @return TRUE if successful
  474.      */

  475.     public boolean setCurrency (
  476.         final java.lang.String strCurrency)
  477.     {
  478.         if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) return false;

  479.         return true;
  480.     }

  481.     /**
  482.      * Set the Index Day Count
  483.      *
  484.      * @param strDayCount Index Day Count
  485.      *
  486.      * @return TRUE if successful
  487.      */

  488.     public boolean setDayCount (
  489.         final java.lang.String strDayCount)
  490.     {
  491.         if (null == (_strDayCount = strDayCount) || _strDayCount.isEmpty()) return false;

  492.         return true;
  493.     }

  494.     /**
  495.      * Set the flag indicating whether the Index has a Full First Stub
  496.      *
  497.      * @param bFullFirstStub Flag indicating whether the Index has a Full First Stub
  498.      *
  499.      * @return TRUE if successful
  500.      */

  501.     public boolean setFullFirstStub (
  502.         final boolean bFullFirstStub)
  503.     {
  504.         _bFullFirstStub = bFullFirstStub;
  505.         return true;
  506.     }

  507.     /**
  508.      * Set the Index Recovery
  509.      *
  510.      * @param dblRecovery Index Recovery
  511.      *
  512.      * @return TRUE if successful
  513.      */

  514.     public boolean setRecovery (
  515.         final double dblRecovery)
  516.     {
  517.         return org.drip.numerical.common.NumberUtil.IsValid (_dblRecovery = dblRecovery);
  518.     }

  519.     /**
  520.      * Set the Index Coupon Frequency
  521.      *
  522.      * @param iFrequency Index Coupon Frequency
  523.      *
  524.      * @return TRUE if successful
  525.      */

  526.     public boolean setFrequency (
  527.         final int iFrequency)
  528.     {
  529.         _iFrequency = iFrequency;
  530.         return true;
  531.     }

  532.     /**
  533.      * Set the Index Red ID
  534.      *
  535.      * @param strRedID Index Red ID
  536.      *
  537.      * @return TRUE if successful
  538.      */

  539.     public boolean setRedID (
  540.         final java.lang.String strRedID)
  541.     {
  542.         if (null == (_strRedID = strRedID) || _strRedID.isEmpty()) return false;

  543.         return true;
  544.     }

  545.     /**
  546.      * Set the Index Class
  547.      *
  548.      * @param strIndexClass Index Class
  549.      *
  550.      * @return TRUE if successful
  551.      */

  552.     public boolean setIndexClass (
  553.         final java.lang.String strIndexClass)
  554.     {
  555.         if (null == (_strIndexClass = strIndexClass) || _strIndexClass.isEmpty()) return false;

  556.         return true;
  557.     }

  558.     /**
  559.      * Set the Index Series
  560.      *
  561.      * @param iIndexSeries Index Series
  562.      *
  563.      * @return TRUE if successful
  564.      */

  565.     public boolean setIndexSeries (
  566.         final int iIndexSeries)
  567.     {
  568.         _iIndexSeries = iIndexSeries;
  569.         return true;
  570.     }

  571.     /**
  572.      * Set the Index Group Name
  573.      *
  574.      * @param strIndexGroupName Index Group Name
  575.      *
  576.      * @return TRUE if successful
  577.      */

  578.     public boolean setIndexGroupName (
  579.         final java.lang.String strIndexGroupName)
  580.     {
  581.         if (null == (_strIndexGroupName = strIndexGroupName) || _strIndexGroupName.isEmpty()) return false;

  582.         return true;
  583.     }

  584.     /**
  585.      * Set the Index Short Name
  586.      *
  587.      * @param strIndexShortName Index Short Name
  588.      *
  589.      * @return TRUE if successful
  590.      */

  591.     public boolean setIndexShortName (
  592.         final java.lang.String strIndexShortName)
  593.     {
  594.         if (null == (_strIndexShortName = strIndexShortName) || _strIndexShortName.isEmpty()) return false;

  595.         return true;
  596.     }

  597.     /**
  598.      * Set the Index Short Group Name
  599.      *
  600.      * @param strIndexShortGroupName Index Short Group Name
  601.      *
  602.      * @return TRUE if successful
  603.      */

  604.     public boolean setIndexShortGroupName (
  605.         final java.lang.String strIndexShortGroupName)
  606.     {
  607.         if (null == (_strIndexShortGroupName = strIndexShortGroupName) || _strIndexShortGroupName.isEmpty())
  608.             return false;

  609.         return true;
  610.     }

  611.     /**
  612.      * Set the Index Version
  613.      *
  614.      * @param iIndexVersion Index Version
  615.      *
  616.      * @return TRUE if successful
  617.      */

  618.     public boolean setIndexVersion (
  619.         final int iIndexVersion)
  620.     {
  621.         _iIndexVersion = iIndexVersion;
  622.         return true;
  623.     }

  624.     /**
  625.      * Set the Index Life Span
  626.      *
  627.      * @param iIndexLifeSpan Index Life Span
  628.      *
  629.      * @return TRUE if successful
  630.      */

  631.     public boolean setIndexLifeSpan (
  632.         final int iIndexLifeSpan)
  633.     {
  634.         _iIndexLifeSpan = iIndexLifeSpan;
  635.         return true;
  636.     }

  637.     /**
  638.      * Set the Index Composite Curve ID
  639.      *
  640.      * @param strCurvyCurveID Index Composite Curve ID
  641.      *
  642.      * @return TRUE if successful
  643.      */

  644.     public boolean setCurvyCurveID (
  645.         final java.lang.String strCurvyCurveID)
  646.     {
  647.         if (null == (_strCurvyCurveID = strCurvyCurveID) || _strCurvyCurveID.isEmpty()) return false;

  648.         return true;
  649.     }

  650.     /**
  651.      * Set the Index Factor
  652.      *
  653.      * @param dblIndexFactor Index Factor
  654.      *
  655.      * @return TRUE if successful
  656.      */

  657.     public boolean setIndexFactor (
  658.         final double dblIndexFactor)
  659.     {
  660.         return org.drip.numerical.common.NumberUtil.IsValid (_dblIndexFactor = dblIndexFactor);
  661.     }

  662.     /**
  663.      * Set the Number of Original Components in the Index
  664.      *
  665.      * @param iOriginalComponentCount Number of Original Components in the Index
  666.      *
  667.      * @return TRUE if successful
  668.      */

  669.     public boolean setOriginalComponentCount (
  670.         final int iOriginalComponentCount)
  671.     {
  672.         _iOriginalComponentCount = iOriginalComponentCount;
  673.         return true;
  674.     }

  675.     /**
  676.      * Set the Number of Defaulted Components in the Index
  677.      *
  678.      * @param iDefaultedComponentCount Number of Defaulted Components in the Index
  679.      *
  680.      * @return TRUE if successful
  681.      */

  682.     public boolean setDefaultedComponentCount (
  683.         final int iDefaultedComponentCount)
  684.     {
  685.         _iDefaultedComponentCount = iDefaultedComponentCount;
  686.         return true;
  687.     }

  688.     /**
  689.      * Set the Index Location
  690.      *
  691.      * @param strLocation Index Location
  692.      *
  693.      * @return TRUE if successful
  694.      */

  695.     public boolean setLocation (
  696.         final java.lang.String strLocation)
  697.     {
  698.         if (null == (_strLocation = strLocation) || _strLocation.isEmpty()) return false;

  699.         return true;
  700.     }

  701.     /**
  702.      * Set if the Index pays accrued on termination
  703.      *
  704.      * @param bPayAccrued Flag indicating if the Index pays accrued on termination
  705.      *
  706.      * @return TRUE if successful
  707.      */

  708.     public boolean setPayAccrued (
  709.         final boolean bPayAccrued)
  710.     {
  711.         _bPayAccrued = bPayAccrued;
  712.         return true;
  713.     }

  714.     /**
  715.      * Set if the Index knocks out on Default
  716.      *
  717.      * @param bKnockOutOnDefault Flag indicating if the Index knocks out on Default
  718.      *
  719.      * @return TRUE if successful
  720.      */

  721.     public boolean setKnockOutOnDefault (
  722.         final boolean bKnockOutOnDefault)
  723.     {
  724.         _bKnockOutOnDefault = bKnockOutOnDefault;
  725.         return true;
  726.     }

  727.     /**
  728.      * Set whether the quote is marked as a CDS
  729.      *
  730.      * @param bQuoteAsCDS Flag indicating whether the quote is marked as a CDS
  731.      *
  732.      * @return TRUE if successful
  733.      */

  734.     public boolean setQuoteAsCDS (
  735.         final boolean bQuoteAsCDS)
  736.     {
  737.         _bQuoteAsCDS = bQuoteAsCDS;
  738.         return true;
  739.     }

  740.     /**
  741.      * Set the Index BBG Ticker
  742.      *
  743.      * @param strBBGTicker Index BBG Ticker
  744.      *
  745.      * @return TRUE if successful
  746.      */

  747.     public boolean setBBGTicker (
  748.         final java.lang.String strBBGTicker)
  749.     {
  750.         if (null == (_strBBGTicker = strBBGTicker) || strBBGTicker.isEmpty()) return false;

  751.         return true;
  752.     }

  753.     /**
  754.      * Set the index short name
  755.      *
  756.      * @param strShortName Index Short Name
  757.      *
  758.      * @return TRUE if successful
  759.      */

  760.     public boolean setShortName (
  761.         final java.lang.String strShortName)
  762.     {
  763.         if (null == (_strShortName = strShortName) || _strShortName.isEmpty()) return false;

  764.         return true;
  765.     }

  766.     /**
  767.      * Validate the CDXRefData instance
  768.      *
  769.      * @return TRUE if successful
  770.      */

  771.     public boolean validate()
  772.     {
  773.         if (null == _strCurveID || _strCurveID.isEmpty() || null == _strSPN || _strSPN.isEmpty() || null ==
  774.             _strIndexLabel || _strIndexLabel.isEmpty() || null == _strIndexName || _strIndexName.isEmpty() ||
  775.                 null == _strCurveName || _strCurveName.isEmpty() || null == _dtIssue || null == _dtMaturity
  776.                     || _dtIssue.julian() >= _dtMaturity.julian() || !org.drip.numerical.common.NumberUtil.IsValid
  777.                         (_dblCoupon) || null == _strCurrency || _strCurrency.isEmpty() || null ==
  778.                             _strDayCount || _strDayCount.isEmpty() ||
  779.                                 !org.drip.numerical.common.NumberUtil.IsValid (_dblRecovery) || null == _strRedID
  780.                                     || _strRedID.isEmpty() || null == _strIndexClass ||
  781.                                         _strIndexClass.isEmpty() || null == _strIndexGroupName ||
  782.                                             _strIndexGroupName.isEmpty())
  783.             return false;

  784.         return true;
  785.     }

  786.     /**
  787.      * Return the stringified set of parameters in a java call that can be statically used to re-construct
  788.      *  the index.
  789.      *
  790.      * @return Set of Stringified parameters as a java call.
  791.      */

  792.     public java.lang.String setConstructionString()
  793.     {
  794.         java.lang.StringBuffer sb = new java.lang.StringBuffer();

  795.         java.lang.String strCDXCode = _strIndexClass + "." + _strIndexGroupName + "." + _iIndexLifeSpan +
  796.             "Y." + _iIndexSeries + "." + _iIndexVersion;

  797.         sb.append ("\t\tUpdateCDXRefDataMap (" + org.drip.numerical.common.StringUtil.MakeStringArg (strCDXCode) +
  798.             ",\n\t\t\torg.drip.product.creator.CDXRefDataBuilder.CreateCDXRefDataBuilder (");

  799.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strCurveID) + ", ");

  800.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strSPN) + ",\n\t\t\t\t");

  801.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexLabel) + ", ");

  802.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexName) + ",\n\t\t\t\t\t");

  803.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strCurveName) + ", ");

  804.         sb.append (_dtIssue.julian() + ", ");

  805.         sb.append (_dtMaturity.julian() + ", ");

  806.         sb.append (_dblCoupon + ", ");

  807.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strCurrency) + ",\n\t\t\t\t\t\t");

  808.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strDayCount) + ", ");

  809.         sb.append (_bFullFirstStub + ", ");

  810.         sb.append (_dblRecovery + ", ");

  811.         sb.append (_iFrequency + ", ");

  812.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strRedID) + ", ");

  813.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexClass) + ", ");

  814.         sb.append (_iIndexSeries + ", ");

  815.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexGroupName) + ", ");

  816.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexShortName) + ", ");

  817.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strIndexShortGroupName) + ", ");

  818.         sb.append (_iIndexVersion + ", ");

  819.         sb.append (_iIndexLifeSpan + ",\n\t\t\t\t\t\t\t");

  820.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strCurvyCurveID) + ", ");

  821.         sb.append (_dblIndexFactor + ", ");

  822.         sb.append (_iOriginalComponentCount + ", ");

  823.         sb.append (_iDefaultedComponentCount + ", ");

  824.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strLocation) + ", ");

  825.         sb.append (_bPayAccrued + ", ");

  826.         sb.append (_bKnockOutOnDefault + ", ");

  827.         sb.append (_bQuoteAsCDS + ", ");

  828.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strBBGTicker) + ", ");

  829.         sb.append (org.drip.numerical.common.StringUtil.MakeStringArg (_strShortName) + "));\n\n");

  830.         return sb.toString();
  831.     }
  832. }