示例#1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM MUTABLE OBJECTS             //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ComputationCore"/> class.
        /// </summary>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        /// <param name="mutableObject">
        /// The mutable object. 
        /// </param>
        /// <exception cref="SdmxSemmanticException">
        /// Throws Validate exception.
        /// </exception>
        public ComputationCore(IIdentifiableObject parent, IComputationMutableObject mutableObject)
            : base(mutableObject, parent)
        {
            this.description = new List<ITextTypeWrapper>();
            this.localId = mutableObject.LocalId;
            this.softwareLanguage = mutableObject.SoftwareLanguage;
            this.softwarePackage = mutableObject.SoftwarePackage;
            this.softwareVersion = mutableObject.SoftwareVersion;
            if (mutableObject.Descriptions != null)
            {
                foreach (ITextTypeWrapperMutableObject currentTT in mutableObject.Descriptions)
                {
                    if (!string.IsNullOrWhiteSpace(currentTT.Value))
                    {
                        this.description.Add(new TextTypeWrapperImpl(currentTT, this));
                    }
                }
            }

            try
            {
                this.Validate();
            }
            catch (SdmxSemmanticException ex)
            {
                throw new SdmxSemmanticException(ex, ExceptionCode.ObjectStructureConstructionError, this);
            }
            catch (Exception th)
            {
                throw new SdmxException(th, ExceptionCode.ObjectStructureConstructionError, this);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessStepMutableCore"/> class.
        /// </summary>
        /// <param name="objTarget">
        /// The obj target. 
        /// </param>
        public ProcessStepMutableCore(IProcessStepObject objTarget)
            : base(objTarget)
        {
            this._input = new List<IInputOutputMutableObject>();
            this._output = new List<IInputOutputMutableObject>();
            this._transitions = new List<ITransitionMutableObject>();
            this._processSteps = new List<IProcessStepMutableObject>();

            if (objTarget.Input != null)
            {
                foreach (IInputOutputObject currentIo in objTarget.Input)
                {
                    this._input.Add(new InputOutputMutableCore(currentIo));
                }
            }

            if (objTarget.Output != null)
            {
                foreach (IInputOutputObject currentIo0 in objTarget.Output)
                {
                    this._output.Add(new InputOutputMutableCore(currentIo0));
                }
            }

            // make into mutable objTarget lists
            if (objTarget.ProcessSteps != null)
            {
                foreach (IProcessStepObject processStepObject in objTarget.ProcessSteps)
                {
                    this.AddProcessStep(new ProcessStepMutableCore(processStepObject));
                }
            }

            if (objTarget.Transitions != null)
            {
                foreach (ITransition t in objTarget.Transitions)
                {
                    this.AddTransition(new TransitionMutableCore(t));
                }
            }

            if (objTarget.Computation != null)
            {
                this._computation = new ComputationMutableCore(objTarget.Computation);
            }
        }