Exemplo n.º 1
0
        /// <summary>Gets a specific element of the <see cref="ExcelPool"/>.
        /// </summary>
        /// <param name="name">The name of the object.</param>
        /// <param name="value">The requested object (output).</param>
        /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
        public static bool TryGetObject(string name, out IInfoOutputQueriable value)
        {
            ExcelPoolItem item;

            if (sm_Pool.TryGetValue(name, out item) == true)
            {
                value = item.Value;
                return(true);
            }
            value = null;
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>Initializes a new instance of the <see cref="ExcelPoolItem"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="objectName">The name of <paramref name="value"/>.</param>
        /// <param name="objectType">The type of <paramref name="value"/>.</param>
        /// <param name="excelDataQueries">The excel data queries, i.e. the (user) input.</param>
        /// <param name="inputDependencyItems">A collection of <see cref="ExcelPoolItem"/> objects which are used as input for the construction of <paramref name="value"/>, i.e. dependent objects.</param>
        /// <remarks>The <see cref="IExcelDataQuery.QueryCompleted(bool)"/> will be called for each element of <paramref name="excelDataQueries"/> and the <see cref="GuidedExcelDataQuery"/> representation
        /// will be stored internally.</remarks>
        /// <example><paramref name="inputDependencyItems"/> are for example swap rates, deposit rates etc. if the current instance is a discount factor curve etc.</example>
        public ExcelPoolItem(IInfoOutputQueriable value, string objectName, ExcelPoolItemType objectType, IEnumerable <IExcelDataQuery> excelDataQueries, IEnumerable <ExcelPoolItem> inputDependencyItems = null)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            Value = value;

            if (objectName == null)
            {
                throw new ArgumentNullException("objectName");
            }
            ObjectName = objectName.ToIdentifierString();

            if (objectType == null)
            {
                throw new ArgumentNullException("objectType");
            }
            ObjectType = objectType;

            if (excelDataQueries == null)
            {
                throw new ArgumentNullException("excelDataQueries");
            }
            var guidedExcelDataQueryInput = new IdentifierStringDictionary <GuidedExcelDataQuery>(isReadOnlyExceptAdding: false);

            foreach (var inputExcelDataQuery in excelDataQueries)
            {
                inputExcelDataQuery.QueryCompleted();
                guidedExcelDataQueryInput.Add(inputExcelDataQuery.Name, inputExcelDataQuery.AsCustomizeData());
            }
            m_ExcelDataQueries = guidedExcelDataQueryInput;

            InputDependencyItems = inputDependencyItems;
            TimeStamp            = DateTime.Now;
        }
Exemplo n.º 3
0
 /// <summary>Initializes a new instance of the <see cref="ExcelPoolItem"/> class.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <param name="objectName">The name of <paramref name="value"/>.</param>
 /// <param name="objectType">The type of <paramref name="value"/>.</param>
 /// <param name="excelDataQueries">The excel data queries, i.e. the (user) input.</param>
 /// <remarks>The <see cref="IExcelDataQuery.QueryCompleted(bool)"/> will be called for each element of <paramref name="excelDataQueries"/> and the <see cref="GuidedExcelDataQuery"/> representation
 /// will be stored internally. Moreover <see cref="InputDependencyItems"/> will be set to <c>null</c>.</remarks>
 public ExcelPoolItem(IInfoOutputQueriable value, string objectName, ExcelPoolItemType objectType, params IExcelDataQuery[] excelDataQueries)
     : this(value, objectName, objectType, excelDataQueries, inputDependencyItems : null)
 {
 }