/// <summary>Initializes a new instance of the <see cref="HolidayDateCollection"/> class.
 /// </summary>
 /// <param name="holidayName">The (language independent) name of the holiday in its <see cref="IdentifierString"/> representation.</param>
 /// <param name="holidayCollection">The collection of holidays in its <see cref="DateTime"/> representation.</param>
 /// <param name="holidayLongName">The (language dependent) long name of the holiday.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="holidayName"/> or <paramref name="holidayCollection"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException">Thrown, if two holidays in <paramref name="holidayCollection"/> are given with respect to the same year.</exception>
 public HolidayDateCollection(IdentifierString holidayName, IEnumerable <DateTime> holidayCollection, IdentifierString holidayLongName = null)
 {
     if (holidayName == null)
     {
         throw new ArgumentNullException("holidayName");
     }
     Name     = holidayName;
     LongName = (holidayLongName != null) ? holidayLongName : holidayName;
     if (holidayCollection == null)
     {
         throw new ArgumentNullException("holidayCollection");
     }
     m_FixHolidays = new Dictionary <int, DateTime>();
     foreach (DateTime date in holidayCollection)
     {
         if (m_FixHolidays.ContainsKey(date.Year) == true)
         {
             throw new ArgumentException("The collection of 'holidays with respect to fixed dates' are not given with respect to different years.");
         }
         m_FixHolidays.Add(date.Year, date);
     }
 }
Esempio n. 2
0
        /// <summary>Initializes a new instance of the <see cref="ExcelTableQueryHeader"/> class.
        /// </summary>
        /// <param name="excelReference">The Excel Range ('header').</param>
        /// <param name="excelDataQueryName">The name of the Excel data query.</param>
        /// <param name="maxRowCount">The maximal number of rows to take into account.</param>
        /// <exception cref="ArgumentException">Thrown, if the value of <paramref name="excelReference"/> is not represented by an two-dimensional array (for example a single row header) or a <see cref="System.String"/>.</exception>
        public ExcelTableQueryHeader(ExcelReference excelReference, string excelDataQueryName, int maxRowCount)
        {
            if (excelReference == null)
            {
                throw new ArgumentNullException("excelRangeValue");
            }

            m_HeaderRange      = excelReference;
            m_BelowHeaderRange = new ExcelReference(m_HeaderRange.RowFirst + 1, maxRowCount - m_HeaderRange.RowLast - 1, m_HeaderRange.ColumnFirst, m_HeaderRange.ColumnLast, m_HeaderRange.SheetId);

            var value = m_HeaderRange.GetValue();

            if (value is object[, ])
            {
                m_HeaderData = (object[, ])value;
                RowCount     = m_HeaderData.GetLength(0);
                ColumnCount  = m_HeaderData.GetLength(1);
            }
            else if (value is String)
            {
                m_HeaderData       = new object[1, 1];
                m_HeaderData[0, 0] = value as String;
                ColumnCount        = 1;
            }
            else
            {
                throw new ArgumentException("excelRangeValue");
            }
            RowCount          = (m_HeaderRange.RowLast - m_HeaderRange.RowFirst + 1) + (m_BelowHeaderRange.RowLast - m_BelowHeaderRange.RowFirst + 1);
            m_BelowHeaderData = m_BelowHeaderRange.GetValue() as object[, ];

            if (excelDataQueryName == null)
            {
                throw new ArgumentNullException("excelDataQueryName");
            }
            Name = LongName = new IdentifierString(excelDataQueryName);
            m_GuidedExcelDataQuery = new GuidedExcelDataQuery(excelDataQueryName, rowCount: RowCount, columnCount: ColumnCount);
        }
Esempio n. 3
0
        /// <summary>Gets a specific <see cref="DataTable"/> object.
        /// </summary>
        /// <param name="tableName">The name of the table.</param>
        /// <param name="value">The <see cref="DataTable"/> and its name in its <see cref="IdentifierString"/> representation (output).</param>
        /// <param name="dataTableType">The type of the tables to take into account.</param>
        /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
        public bool TryGetDataTable(IdentifierString tableName, out DataTable value, DataTableType dataTableType = DataTableType.Single)
        {
            if (dataTableType.HasFlag(DataTableType.Single) == true)
            {
                if (m_Tables.TryGetValue(tableName, out value) == true)
                {
                    return(true);
                }
            }
            if (dataTableType.HasFlag(DataTableType.Parent) == true)
            {
                if (m_ParentChildTables.TryGetValue(tableName, out InfoOutputParentChildDataTable parentChildDataTable) == true)
                {
                    value = parentChildDataTable.ParentDataTable;
                    return(true);
                }
            }
            if (dataTableType.HasFlag(DataTableType.Child) == true)
            {
                int index = tableName.IDString.IndexOf(ParentChildTableNameSeparator);
                if (index >= 0)
                {
                    string parentTableName = tableName.IDString.Substring(0, index);
                    string childTableName  = tableName.IDString.Substring(index + ParentChildTableNameSeparator.Length, tableName.IDString.Length - index - ParentChildTableNameSeparator.Length);

                    if (m_ParentChildTables.TryGetValue(parentTableName, out InfoOutputParentChildDataTable parentChildDataTable) == true)
                    {
                        if (parentChildDataTable.ChildDataTable.TableName.ToIDString() == childTableName.ToIDString())
                        {
                            value = parentChildDataTable.ChildDataTable;
                            return(true);
                        }
                    }
                }
            }
            value = null;
            return(false);
        }
Esempio n. 4
0
 /// <summary>Initializes a new instance of the <see cref="CBlasNativeWrapper" /> class.
 /// </summary>
 /// <param name="name">The name of the Library.</param>
 /// <param name="level1">The implementation of level 1 BLAS functions.</param>
 /// <param name="level2">The implementation of level 2 BLAS functions.</param>
 /// <param name="level3">The implementation of level 3 BLAS functions.</param>
 protected CBlasNativeWrapper(IdentifierString name, ILevel1BLAS level1, ILevel2BLAS level2, ILevel3BLAS level3)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     m_Name = name;
     if (level1 == null)
     {
         throw new ArgumentNullException("level1");
     }
     m_Level1 = level1;
     if (level2 == null)
     {
         throw new ArgumentNullException("level2");
     }
     m_Level2 = level2;
     if (level3 == null)
     {
         throw new ArgumentNullException("level3");
     }
     m_Level3 = level3;
 }
        public AbstractJSBPart(IdentifierString name, string description, bool isRequired,
                               T defaultValue, List <T> examples, List <T> enums)
        {
            var type = typeof(T);

            _tIsString    = type.Name.Equals("String");
            _tIsJsonValue = type.Name.Equals("JsonValue");
            _tIsNullable  = Nullable.GetUnderlyingType(type) != null;
            if (!(_tIsString || _tIsJsonValue || _tIsNullable))
            {
                throw new JsonSchemaBuilderException($"Only allowed types are nullable or classes string and JsonValue as direct use of value types gives errors");
            }

            Name        = name;
            Description = description;
            IsRequired  = isRequired;
            if (!Equals(defaultValue, default(T)))
            {
                DefaultValue = defaultValue;
            }
            if (examples == null)
            {
                Examples = new List <T>();
            }
            else
            {
                Examples = examples;
            }
            if (enums == null)
            {
                Enums = new List <T>();
            }
            else
            {
                Enums = enums;
            }
        }
        /// <summary>Initializes a new instance of the <see cref="ExcelPropertyQuerySingle"/> class.
        /// </summary>
        /// <param name="propertyName">The name of the property.</param>
        /// <param name="propertyValue">The value of the property.</param>
        /// <param name="excelDataQueryName">The name of the Excel data query.</param>
        public ExcelPropertyQuerySingle(object propertyName, object propertyValue, string excelDataQueryName)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }
            if (propertyValue == null)
            {
                throw new ArgumentNullException("propertyValue");
            }
            if (((propertyName is String) == false) && ((propertyName is ExcelReference) == false))
            {
                throw new ArgumentException("Invalid Property name input.");
            }
            m_PropertyName  = propertyName;
            m_PropertyValue = propertyValue;

            if (excelDataQueryName == null)
            {
                throw new ArgumentNullException("excelDataQueryName");
            }
            m_Name = new IdentifierString(excelDataQueryName);
            m_GuidedExcelDataQuery = new GuidedExcelDataQuery(excelDataQueryName, rowCount: 1);
        }
Esempio n. 7
0
 /// <summary>Gets the <see cref="System.Data.DataTable"/> objects with homogeneous informations, and the table name in its <see cref="IdentifierString"/> representation.
 /// </summary>
 /// <param name="dataTableType">The type of the tables to take into account.</param>
 /// <returns>The tables and table names.</returns>
 /// <remarks>The table name of an <see cref="DataTable"/> object can be changed.</remarks>
 public IEnumerable <Tuple <IdentifierString, DataTable> > GetDataTables(DataTableType dataTableType = DataTableType.Single)
 {
     if (dataTableType.HasFlag(DataTableType.Single) == true)
     {
         foreach (var namedTable in m_Tables.NamedValues)
         {
             yield return(namedTable);
         }
     }
     if (dataTableType.HasFlag(DataTableType.Parent) == true)
     {
         foreach (var namedParentChildTables in m_ParentChildTables.NamedValues)
         {
             yield return(Tuple.Create(namedParentChildTables.Item1, namedParentChildTables.Item2.ParentDataTable));
         }
     }
     if (dataTableType.HasFlag(DataTableType.Child) == true)
     {
         foreach (var namedParentChildTables in m_ParentChildTables.NamedValues)
         {
             yield return(Tuple.Create(IdentifierString.Create(namedParentChildTables.Item2.ParentDataTable.TableName + ParentChildTableNameSeparator + namedParentChildTables.Item2.ChildDataTable.TableName), namedParentChildTables.Item2.ChildDataTable));
         }
     }
 }
Esempio n. 8
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;
        }
Esempio n. 9
0
 /// <summary>Initializes a new instance of the <see cref="BasicHolidayCalendar"/> class.
 /// </summary>
 /// <param name="calendarName">The name of the calendar.</param>
 /// <param name="region">The region of the holiday calendar.</param>
 /// <param name="firstDate">The earliest date for which holiday informations are available.</param>
 /// <param name="lastDate">The lastest date for which holiday informations are available.</param>
 /// <param name="weekendRepresentation">The representation of the weekend.</param>
 /// <exception cref="ArgumentNullException">Thrown, if <paramref name="calendarName"/> or <paramref name="weekendRepresentation"/> is <c>null</c>.</exception>
 protected BasicHolidayCalendar(IdentifierString calendarName, HolidayCalendarRegion region, DateTime firstDate, DateTime lastDate, IWeekendRepresentation weekendRepresentation)
 {
     Region = region;
     if (calendarName == null)
     {
         throw new ArgumentNullException("calendarName");
     }
     Name = calendarName;
     if (firstDate < lastDate)
     {
         FirstDate = firstDate;
         LastDate  = lastDate;
     }
     else
     {
         LastDate  = firstDate;
         FirstDate = firstDate;
     }
     if (weekendRepresentation == null)
     {
         throw new ArgumentNullException("weekendRepresentation");
     }
     m_WeekendRepresentation = weekendRepresentation;
 }
Esempio n. 10
0
 /// <summary>Gets the value associated with the specified key.
 /// </summary>
 /// <param name="key">The key of the value to get.</param>
 /// <param name="value">When this method return, contains the value associated with the specified key, if the
 /// key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.</param>
 /// <returns><c>true</c> if the <see cref="IdentifierStringDictionaryBase&lt;TValue&gt;"/> contains an element with the specified key; otherwise <c>false</c>.</returns>
 public bool TryGetValue(IdentifierString key, out TValue value)
 {
     return(m_Dictionary.TryGetValue(key, out value));
 }
Esempio n. 11
0
 /// <summary>Removes the value with the specified key from the <see cref="IdentifierNameableDictionary&lt;TValue&gt;"/>.
 /// </summary>
 /// <param name="key">The key of the element to remove.</param>
 /// <returns><c>true</c> if the element is sucessfully found and removed; otherwise, <c>false</c>. This method
 /// returns <c>false</c> if <paramref name="key"/> is not found in the <see cref="IdentifierStringDictionaryBase&lt;TValue&gt;"/>.</returns>
 public new bool Remove(IdentifierString key)
 {
     return(base.Remove(key));
 }
Esempio n. 12
0
 /// <summary>Initializes a new instance of the <see cref="FirstGridPoint"/> class.
 /// </summary>
 public FirstGridPoint()
     : base(BuildingDirection.FromFirstGridPoint, CurveResource.AnnotationExtrapolationNoneFirst)
 {
     m_Name     = new IdentifierString("None:First");
     m_LongName = new IdentifierString(CurveResource.LongNameExtrapolationNoneFirst);
 }
 /// <summary>Initializes a new instance of the <see cref="UniformGenerationMode"/> class.
 /// </summary>
 /// <param name="name">The name of the generation method for uniform distributed random numbers.</param>
 /// <param name="annotation">The annotation (description) of the generation method.</param>
 protected UniformGenerationMode(IdentifierString name, string annotation)
 {
     m_Name       = name ?? throw new ArgumentNullException(nameof(name));
     m_Annotation = annotation;
 }
 /// <summary>Initializes a new instance of the <see cref="GaussianGenerationMode"/> class.
 /// </summary>
 /// <param name="name">The name of the generation method for uniform distributed random numbers.</param>
 /// <param name="annotation">The annotation (description) of the generation method.</param>
 internal GaussianGenerationMode(string name, string annotation)
     : base(IdentifierString.Create(name), annotation)
 {
 }
Esempio n. 15
0
 private string GenerateDefaultIfExisting(IdentifierString key, JSBEmail jsonSchemaBuilderEmail)
 {
     return(string.IsNullOrWhiteSpace(jsonSchemaBuilderEmail.DefaultValue) ? string.Empty : $" = new MailAddress(\"{jsonSchemaBuilderEmail.DefaultValue}\");");
 }
Esempio n. 16
0
        private void GenerateCodeFromSchema(CodeBuilder codeBuilder, JsonValue jsonValueOfSchema, IdentifierString key, JSBRef jsonSchemaBuilderUriReference)
        {
            if (jsonValueOfSchema.Type == JsonValueType.Object)
            {
                GenerateComments(codeBuilder, key, jsonSchemaBuilderUriReference);

                codeBuilder
                .L($"[JsonProperty(\"{TransformToCamelCase(key)}\")]")
                .L($"public {MakeCorrectItemType(jsonValueOfSchema)} {TransformToTitleCase(key)} {{ get; set; }}{GenerateDefaultIfExisting(key, jsonSchemaBuilderUriReference)}")
                .EmptyLine();
            }
            else
            {
                throw new CodeGenerationException($"GenerateOrdinaryUriReference {key} references an invalid schema {jsonSchemaBuilderUriReference.IriReference.OriginalString}");
            }
        }
Esempio n. 17
0
 private string GenerateDefaultIfExisting(IdentifierString key, JSBString jsonSchemaBuilderString)
 {
     return(string.IsNullOrWhiteSpace(jsonSchemaBuilderString.DefaultValue) ? string.Empty : $" = \"{jsonSchemaBuilderString.DefaultValue}\";");
 }
Esempio n. 18
0
 private void GenerateEnumBoolean(CodeBuilder codeBuilder, IdentifierString key, JSBBoolean jsonSchemaBuilderBoolean)
 {
     throw new NotImplementedException("Enum on Boolean has not been implemeneted");
 }
Esempio n. 19
0
 private string GenerateDefaultIfExisting(IdentifierString key, JSBTime jsonSchemaBuilderTime)
 {
     return(string.IsNullOrWhiteSpace(jsonSchemaBuilderTime.DefaultValue) ? string.Empty : $" = DateTime.Parse(\"{jsonSchemaBuilderTime.DefaultValue}\");");
 }
Esempio n. 20
0
 private void GenerateEnumDateTime(CodeBuilder codeBuilder, IdentifierString key, JSBDateTime jsonSchemaBuilderDateTime)
 {
     throw new NotImplementedException("Enum for DateTime had not been implemented");
 }
Esempio n. 21
0
 /// <summary>Initializes a new instance of the <see cref="GaussKronrodPatterson255ConstAbscissaIntegrator"/> class.
 /// </summary>
 /// <param name="exitCondition">The exit condition.</param>
 public GaussKronrodPatterson255ConstAbscissaIntegrator(ExitCondition exitCondition)
     : base(OneDimNumericalIntegrator.BoundDescriptor.Closed, OneDimNumericalIntegrator.BoundDescriptor.Closed)
 {
     ExitCondition = exitCondition ?? throw new ArgumentNullException(nameof(exitCondition));
     m_Name        = new IdentifierString("Gauss-Kronrod-Patterson 255 const abscissa Integrator");
 }
Esempio n. 22
0
 private void GenerateEnumEmail(CodeBuilder codeBuilder, IdentifierString key, JSBEmail jsonSchemaBuilderEmail)
 {
     throw new NotImplementedException("Enum on email has not been implemented");
 }
 /// <summary>Initializes a new instance of the <see cref="MklVectorUnitNativeWrapper" /> class.
 /// </summary>
 public MklVectorUnitNativeWrapper()
 {
     m_Name = new IdentifierString("MKL");
     m_VectorMathematicalFunctions = new MklVectorMathematicalFunctions();
 }
Esempio n. 24
0
 private void GenerateEnumNumber(CodeBuilder codeBuilder, IdentifierString key, JSBNumber jsonSchemaBuilderNumber)
 {
     throw new NotImplementedException("Enum on number has not been implemeneted");
 }
        /// <summary>Gets the holiday in its <see cref="IHoliday"/> representation.
        /// </summary>
        /// <param name="resourceManager">The <see cref="ResourceManager"/> object that contains the resource with respect to the holiday, i.e. the
        /// language depending <see cref="System.String"/> representations.</param>
        /// <returns>An instance of <see cref="IHoliday"/> that represents the holiday.
        /// </returns>
        /// <exception cref="ArgumentException">Thrown, if <paramref name="resourceManager"/> is not valid for the current instance, i.e. no resources are available for the holiday.</exception>
        public override IHoliday GetHoliday(ResourceManager resourceManager)
        {
            IdentifierString holidayLongName = IdentifierString.Create(resourceManager, ResourcePropertyName);

            return(new SingleHoliday(m_Name.ToIdentifierString(), DateOfHoliday, holidayLongName));
        }
Esempio n. 26
0
 private void GenerateEnumObject(CodeBuilder codeBuilder, IdentifierString key, JSBObject jsonSchemaBuilderObject, Dictionary <string, IJSBPart> definitions)
 {
     throw new NotImplementedException("Enum on objects has not been implemented");
 }
Esempio n. 27
0
 /// <summary>Gets a specified business day convention.
 /// </summary>
 /// <param name="name">The name of the business day convention to search.</param>
 /// <param name="value">The business day convention (output).</param>
 /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
 public static bool TryGetValue(IdentifierString name, out IBusinessDayConvention value)
 {
     return(sm_Pool.TryGetValue(name, out value));
 }
Esempio n. 28
0
 private void GenerateEnumTime(CodeBuilder codeBuilder, IdentifierString key, JSBTime jsonSchemaBuilderTime)
 {
     throw new NotImplementedException("Enum on time is not implemented");
 }
Esempio n. 29
0
 /// <summary>Initializes a new instance of the <see cref="CurveInterpolationLinear"/> class.
 /// </summary>
 internal CurveInterpolationLinear()
     : base(CurveResource.AnnotationInterpolationLinear)
 {
     m_Name     = new IdentifierString("Linear");
     m_LongName = new IdentifierString(CurveResource.LongNameInterpolationLinear);
 }
Esempio n. 30
0
        private void GenerateCodeFromInternalPart(CodeBuilder codeBuilder, IJSBPart referencedPart, IdentifierString key, JSBRef jsonSchemaBuilderUriReference)
        {
            GenerateComments(codeBuilder, key, jsonSchemaBuilderUriReference);

            codeBuilder
            .L($"[JsonProperty(\"{TransformToCamelCase(key)}\")]")
            .L($"public {MakeCorrectItemType(referencedPart)} {TransformToTitleCase(key)} {{ get; set; }}{GenerateDefaultIfExisting(key, jsonSchemaBuilderUriReference)}")
            .EmptyLine();
        }