Exemple #1
0
        public CustomQualitySpecification Customize(
            [NotNull] IEnumerable <Dataset> verifiedDatasets)
        {
            Assert.ArgumentNotNull(verifiedDatasets, nameof(verifiedDatasets));
            Assert.True(CanCustomize, "cannot customize quality specification '{0}'", Name);
            Assert.False(IsCustom, "quality specification '{0}' is already customized", Name);

            string name = $"{Name} (Customized)";

            CustomQualitySpecification result =
                InitCustomSpecification(name, copyUuid: true);

            var datasets = new HashSet <Dataset>(verifiedDatasets);

            foreach (QualitySpecificationElement element in _elements)
            {
                if (IsQualityConditionApplicable(element.QualityCondition, datasets))
                {
                    result.AddElement(element.QualityCondition.Clone(),
                                      element.StopOnError,
                                      element.AllowErrors,
                                      !element.Enabled);
                }
            }

            return(result);
        }
Exemple #2
0
        protected virtual CustomQualitySpecification GetCustomizableCore()
        {
            CustomQualitySpecification clone =
                InitCustomSpecification($"{Name} (Clone)",
                                        copyUuid: true);

            foreach (QualitySpecificationElement element in _elements)
            {
                clone.AddElement(element.QualityCondition.Clone(),
                                 element.StopOnError,
                                 element.AllowErrors,
                                 !element.Enabled);
            }

            return(clone);
        }
Exemple #3
0
        private CustomQualitySpecification InitCustomSpecification(
            [NotNull] string name,
            bool copyUuid = false)
        {
            var result = new CustomQualitySpecification(BaseSpecification,
                                                        name,
                                                        assignUuid: !copyUuid);

            CopyPropertiesTo(result);

            if (copyUuid)
            {
                result.Uuid = Uuid;
            }

            return(result);
        }