Ejemplo n.º 1
0
 /// <summary>Gets the object names with respect to a specific object type.
 /// </summary>
 /// <param name="excelPoolItemType">The type of the pool element in its <see cref="ExcelPoolItemType"/> representation.</param>
 /// <returns>The names of the objects in the <see cref="ExcelPool"/> where the object type is equal to <paramref name="excelPoolItemType"/>;
 /// the name of the return value is equal to the name of <paramref name="excelPoolItemType"/>.</returns>
 /// <exception cref="ArgumentNullException">Thrown, if <paramref name="excelPoolItemType"/> is <c>null</c>.</exception>
 public static IExcelDataAdvice GetObjectNames(ExcelPoolItemType excelPoolItemType)
 {
     if (excelPoolItemType == null)
     {
         throw new ArgumentNullException("excelPoolItemType");
     }
     return(ExcelDataAdvice.Create((from item in sm_Pool
                                    where item.ObjectType.Identifier == excelPoolItemType.Identifier
                                    select item.ObjectName),
                                   excelPoolItemType.Name.String));
 }
Ejemplo n.º 2
0
        /// <summary>Initializes a new instance of the <see cref="ExcelPoolItemCreator"/> struct.
        /// </summary>
        /// <param name="excelPoolItemType">The type of the object to create in its <see cref="ExcelPoolItemType"/> representation.</param>
        /// <param name="excelPoolItemCreatingFunction">The creating function.</param>
        /// <exception cref="ArgumentNullException">Thrown, if one of the arguments is <c>null</c>.</exception>
        /// <remarks>Use the <see cref="ExcelPoolItemCreator.Initialize"/> event to store the <see cref="ExcelPoolItemCreator"/> instance.</remarks>
        public ExcelPoolItemCreator(ExcelPoolItemType excelPoolItemType, TryCreateExcelPoolItems excelPoolItemCreatingFunction)
        {
            if (excelPoolItemType == null)
            {
                throw new ArgumentNullException("excelPoolItemType");
            }
            ObjectType = excelPoolItemType;

            if (excelPoolItemCreatingFunction == null)
            {
                throw new ArgumentNullException("excelPoolItemCreatingFunction");
            }
            CreatingFunction = (IIdentifierStringDictionary <IExcelDataQuery> excelDataQueries, out IEnumerable <ExcelPoolItem> values, out string errorMessage) =>
            {
                return(excelPoolItemCreatingFunction(excelDataQueries, out values, out errorMessage));
            };
        }
Ejemplo 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>
        /// <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;
        }
Ejemplo n.º 4
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)
 {
 }
Ejemplo n.º 5
0
 /// <summary>Initializes the current <see cref="ExcelBackgroundWorker"/> object.
 /// </summary>
 /// <param name="excelBackgroundWorker">The <see cref="ExcelBackgroundWorker"/> object.</param>
 /// <param name="excelPoolItemType">The <see cref="ExcelPoolItemType"/> object of the <see cref="ExcelPoolItem"/> object(s) to create.</param>
 /// <param name="maximalNumberOfCalculationSteps">The maximal number of calculation steps.</param>
 /// <param name="calculationStepSize">The step size of the calculation.</param>
 public static void Initialize(this ExcelBackgroundWorker excelBackgroundWorker, ExcelPoolItemType excelPoolItemType, int maximalNumberOfCalculationSteps, int calculationStepSize = 1)
 {
     excelBackgroundWorker.Initialize(String.Format(XLResources.ExcelPoolItemBackgroundWorkerCreationTitle, excelPoolItemType.Name.String), maximalNumberOfCalculationSteps, calculationStepSize);
 }
Ejemplo n.º 6
0
 /// <summary>Initializes the current <see cref="ExcelBackgroundWorker"/> object.
 /// </summary>
 /// <param name="excelBackgroundWorker">The <see cref="ExcelBackgroundWorker"/> object.</param>
 /// <param name="excelPoolItemType">The <see cref="ExcelPoolItemType"/> object of the <see cref="ExcelPoolItem"/> object(s) to create.</param>
 public static void Initialize(this ExcelBackgroundWorker excelBackgroundWorker, ExcelPoolItemType excelPoolItemType)
 {
     excelBackgroundWorker.Initialize(String.Format(XLResources.ExcelPoolItemBackgroundWorkerCreationTitle, excelPoolItemType.Name.String));
 }
Ejemplo n.º 7
0
 /// <summary>Gets the <see cref="ExcelPoolItem"/> objects with respect to a specific <see cref="ExcelPoolItemType"/>.
 /// </summary>
 /// <param name="excelPoolItemType">The type of the excel pool item.</param>
 /// <returns>A collection of the <see cref="ExcelPoolItem"/> objects in the <see cref="ExcelPool"/> of with respect to <paramref name="excelPoolItemType"/>.</returns>
 public static IEnumerable <ExcelPoolItem> GetItems(ExcelPoolItemType excelPoolItemType)
 {
     return((from item in sm_Pool
             where item.ObjectType.Identifier == excelPoolItemType.Identifier
             select item).ToArray());
 }