/// <summary>
        /// Initializes a new instance of the <see cref="LevelMutableCore"/> class.
        /// </summary>
        /// <param name="level">
        /// The level. 
        /// </param>
        public LevelMutableCore(ILevelObject level)
            : base(level)
        {
            if (level.HasChild())
            {
                this.childLevel = new LevelMutableCore(level.ChildLevel);
            }

            if (level.CodingFormat != null)
            {
                this.codingFormat = new TextFormatMutableCore(level.CodingFormat);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RepresentationMutableCore"/> class.
        /// </summary>
        /// <param name="representation">
        /// The representation. 
        /// </param>
        public RepresentationMutableCore(IRepresentation representation)
            : base(representation)
        {
            if (representation.TextFormat != null)
            {
                this.textFormat = new TextFormatMutableCore(representation.TextFormat);
            }

            if (representation.Representation != null)
            {
                this.representationRef = representation.Representation.CreateMutableInstance();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RepresentationMapRefMutableCore"/> class.
        /// </summary>
        /// <param name="representationMapRef">
        /// The iref. 
        /// </param>
        public RepresentationMapRefMutableCore(IRepresentationMapRef representationMapRef)
            : base(representationMapRef)
        {
            this.valueMappings = new DictionaryOfSets<string, string>();
            if (representationMapRef.CodelistMap != null)
            {
                this.codelistMap = representationMapRef.CodelistMap.CreateMutableInstance();
            }

            if (representationMapRef.ToTextFormat != null)
            {
                this.toTextFormat = new TextFormatMutableCore(representationMapRef.ToTextFormat);
            }

            this.toValueType = representationMapRef.ToValueType;
            this.valueMappings = representationMapRef.ValueMappings;
        }
        /// <summary>
        /// Write the specified Element from the given ITextFormatMutableObject
        /// </summary>
        /// <param name="element">
        /// The TextFormatType Element
        /// </param>
        /// <param name="textFormat">
        /// The ITextFormatMutableObject to write
        /// </param>
        protected void WriteTextFormat(ElementNameTable element, ITextFormatMutableObject textFormat)
        {
            this.WriteStartElement(this.DefaultPrefix, element);
            if (textFormat.TextType != null)
            {
                this.TryWriteAttribute(AttributeNameTable.textType, textFormat.TextType.EnumType.ToString());
            }

            if (textFormat.Decimals > -1)
            {
                this.TryWriteAttribute(AttributeNameTable.decimals, textFormat.Decimals);
            }

            if (textFormat.StartValue < textFormat.EndValue)
            {
                this.TryWriteAttribute(AttributeNameTable.startValue, textFormat.StartValue);
                this.TryWriteAttribute(AttributeNameTable.endValue, textFormat.EndValue);
            }

            if (textFormat.Interval > -1)
            {
                this.TryWriteAttribute(AttributeNameTable.interval, textFormat.Interval);
            }

            this.TryWriteAttribute(AttributeNameTable.isSequence, textFormat.Sequence);

            if (textFormat.MaxLength > -1)
            {
                this.TryWriteAttribute(AttributeNameTable.maxLength, textFormat.MaxLength);
            }

            if (textFormat.MinLength > -1)
            {
                this.TryWriteAttribute(AttributeNameTable.minLength, textFormat.MinLength);
            }

            this.TryWriteAttribute(AttributeNameTable.pattern, textFormat.Pattern);
            this.WriteEndElement();
        }
 /// <summary>
 /// Write the TextFormat Element from the given ITextFormatMutableObject
 /// </summary>
 /// <param name="textFormat">
 /// The ITextFormatMutableObject to write
 /// </param>
 protected void WriteTextFormat(ITextFormatMutableObject textFormat)
 {
     this.WriteTextFormat(ElementNameTable.TextFormat, textFormat);
 }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM MUTABLE OBJECT                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////    
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TextFormatObjectCore"/> class.
        /// </summary>
        /// <param name="textFormatMutable">
        /// The text format mutable. 
        /// </param>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        public TextFormatObjectCore(ITextFormatMutableObject textFormatMutable, ISdmxObject parent)
            : base(textFormatMutable, parent)
        {
            this._isSequence = TertiaryBool.GetFromEnum(TertiaryBoolEnumType.Unset);
            this.multilingual = TertiaryBool.GetFromEnum(TertiaryBoolEnumType.Unset);
            this._textType = textFormatMutable.TextType;
            if (textFormatMutable.Sequence != null)
            {
                this._isSequence = textFormatMutable.Sequence;
            }

            this._maxLength = textFormatMutable.MaxLength;
            this._minLength = textFormatMutable.MinLength;
            this._startValue = textFormatMutable.StartValue;
            this._endValue = textFormatMutable.EndValue;
            this._maxValue = textFormatMutable.MaxValue;
            this._minValue = textFormatMutable.MinValue;
            this._interval = textFormatMutable.Interval;
            this._timeInterval = textFormatMutable.TimeInterval;
            this._decimals = textFormatMutable.Decimals;
            this._pattern = textFormatMutable.Pattern;
            this.Validate();
        }
示例#7
0
        /// <summary>
        /// Populates the text format.
        /// </summary>
        /// <param name="enumName">
        /// Name of the enumeration.
        /// </param>
        /// <param name="enumValue">
        /// The enumeration value.
        /// </param>
        /// <param name="textFormat">
        /// The text format.
        /// </param>
        /// <param name="facetValue">
        /// The facet value.
        /// </param>
        private static void PopulateTextFormat(string enumName, string enumValue, ITextFormatMutableObject textFormat, string facetValue)
        {
            switch (enumName)
            {
            case "DataType":
            {
                TextEnumType textType;
                if (Enum.TryParse(enumValue, true, out textType))
                {
                    textFormat.TextType = TextType.GetFromEnum(textType);
                }
            }

            break;

            case "FacetType":
            {
                switch (enumValue)
                {
                case "isSequence":
                    textFormat.Sequence = FacetToTristateBool(facetValue);
                    break;

                case "minLength":
                    textFormat.MinLength = FacetToInteger(facetValue);
                    break;

                case "maxLength":
                    textFormat.MaxLength = FacetToInteger(facetValue);
                    break;

                case "minValue":
                    textFormat.MinValue = FacetToDecimal(facetValue);
                    break;

                case "maxValue":
                    textFormat.MaxValue = FacetToDecimal(facetValue);
                    break;

                case "startValue":
                    textFormat.StartValue = FacetToDecimal(facetValue);
                    break;

                case "endValue":
                    textFormat.EndValue = FacetToDecimal(facetValue);
                    break;

                case "decimals":
                    textFormat.Decimals = FacetToInteger(facetValue);
                    break;

                case "interval":
                    textFormat.Interval = FacetToDecimal(facetValue);
                    break;

                case "timeInterval":
                    textFormat.TimeInterval = facetValue;
                    break;

                case "pattern":
                    textFormat.Pattern = facetValue;
                    break;

                case "isMultiLingual":
                    textFormat.Multilingual = FacetToTristateBool(facetValue);
                    break;
                }
            }

            break;
            }
        }