コード例 #1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM MUTABLE OBJECT                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TimeRangeCore"/> class.
        /// </summary>
        /// <param name="mutable">
        /// The mutable. 
        /// </param>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        public TimeRangeCore(ITimeRangeMutableObject mutable, ISdmxStructure parent)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.TimeRange), parent)
        {
            if (mutable.StartDate != null)
            {
                this._startDate = new SdmxDateCore(mutable.StartDate, TimeFormatEnumType.DateTime);
            }

            if (mutable.EndDate != null)
            {
                this._endDate = new SdmxDateCore(mutable.EndDate, TimeFormatEnumType.DateTime);
            }

            this._isRange = mutable.IsRange;
            this._isStartInclusive = mutable.IsStartInclusive;
            this._isEndInclusive = mutable.IsEndInclusive;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM IMMUTABLE OBJECT                 //////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="KeyValuesMutableImpl"/> class.
        /// </summary>
        /// <param name="immutable">
        /// The immutable. 
        /// </param>
        public KeyValuesMutableImpl(IKeyValues immutable)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.KeyValues))
        {
            this.values = new List<string>(immutable.Values);
            this.cascadeList = new List<string>();
            this.id = immutable.Id;
            
            foreach (string each in this.values)
            {
                if (immutable.IsCascadeValue(each))
                {
                    this.cascadeList.Add(each);
                }
            }

            if (immutable.TimeRange != null)
            {
                this.timeRange = new TimeRangeMutableCore(immutable.TimeRange);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyValuesMutableImpl"/> class.
        /// </summary>
        /// <param name="keyValueType">
        /// The key value type. 
        /// </param>
        public KeyValuesMutableImpl(ComponentValueSetType keyValueType)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.KeyValues))
        {
            this.values = new List<string>();
            this.cascadeList = new List<string>();

            this.id = keyValueType.id;

            if (keyValueType.Value != null)
            {
                foreach (SimpleValueType dataKeyType in keyValueType.Value)
                {
                    this.values.Add(dataKeyType.TypedValue);
                    if (dataKeyType.cascadeValues)
                    {
                        this.cascadeList.Add(dataKeyType.TypedValue);
                    }
                }
            }

            if (keyValueType.TimeRange != null)
            {
                this.timeRange = new TimeRangeMutableCore(keyValueType.TimeRange);
            }
        }