Example #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((FeatureName?.GetHashCode() ?? 0) * 397) ^ EqualityComparer <TValue> .Default.GetHashCode(FeatureValue));
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (FeatureName != null)
         {
             hashCode = hashCode * 59 + FeatureName.GetHashCode();
         }
         if (FeatureDescription != null)
         {
             hashCode = hashCode * 59 + FeatureDescription.GetHashCode();
         }
         if (ActivePercentage != null)
         {
             hashCode = hashCode * 59 + ActivePercentage.GetHashCode();
         }
         if (CookieName != null)
         {
             hashCode = hashCode * 59 + CookieName.GetHashCode();
         }
         if (CookieMaxAge != null)
         {
             hashCode = hashCode * 59 + CookieMaxAge.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #3
0
        public void EqualsReturnFalseWhenCallsWithOtherValueObject()
        {
            FeatureName otherValue = new FeatureName(Exp.Namespace + "OtherName");

            Assert.False(basicValue == otherValue);
            Assert.False(basicValue.Equals(otherValue));
        }
Example #4
0
        public void EqualsReturnTrueWhenCallsWithSameValueObject()
        {
            FeatureName sameValue = new FeatureName(Exp.Namespace + "SomeName");

            Assert.True(basicValue == sameValue);
            Assert.True(basicValue.Equals(sameValue));
        }
 public override int GetHashCode()
 {
     unchecked
     {
         return(((FeatureName?.GetHashCode() ?? 0) * 397) ^ ErrorGain.GetHashCode());
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (FeatureName != null)
         {
             hashCode = hashCode * 59 + FeatureName.GetHashCode();
         }
         if (FeatureDescription != null)
         {
             hashCode = hashCode * 59 + FeatureDescription.GetHashCode();
         }
         if (HttpHeaderName != null)
         {
             hashCode = hashCode * 59 + HttpHeaderName.GetHashCode();
         }
         if (HttpHeaderValuepattern != null)
         {
             hashCode = hashCode * 59 + HttpHeaderValuepattern.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((FeatureName != null ? FeatureName.GetHashCode() : 0) * 397) ^ Value.GetHashCode());
     }
 }
        /// <summary>
        /// Returns true if ComAdobeGraniteFragsImplCheckHttpHeaderFlagProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeGraniteFragsImplCheckHttpHeaderFlagProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeGraniteFragsImplCheckHttpHeaderFlagProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FeatureName == other.FeatureName ||
                     FeatureName != null &&
                     FeatureName.Equals(other.FeatureName)
                     ) &&
                 (
                     FeatureDescription == other.FeatureDescription ||
                     FeatureDescription != null &&
                     FeatureDescription.Equals(other.FeatureDescription)
                 ) &&
                 (
                     HttpHeaderName == other.HttpHeaderName ||
                     HttpHeaderName != null &&
                     HttpHeaderName.Equals(other.HttpHeaderName)
                 ) &&
                 (
                     HttpHeaderValuepattern == other.HttpHeaderValuepattern ||
                     HttpHeaderValuepattern != null &&
                     HttpHeaderValuepattern.Equals(other.HttpHeaderValuepattern)
                 ));
        }
Example #9
0
        public void EqualsReturnTrueWhenCallsWithSameReference()
        {
            FeatureName sameReference = basicValue;

            Assert.True(basicValue == sameReference);
            Assert.True(basicValue.Equals(sameReference));
        }
Example #10
0
 /// <summary>
 ///     Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current <see cref="T:System.Object" />.</returns>
 public override int GetHashCode()
 {
     return(CustomProperties.GetHashCode()
            ^ (string.IsNullOrWhiteSpace(Description) ? 0 : Description.GetHashCode())
            ^ (string.IsNullOrWhiteSpace(DisplayName) ? 0 : DisplayName.GetHashCode())
            ^ (string.IsNullOrWhiteSpace(FeatureName) ? 0 : FeatureName.GetHashCode())
            ^ FeatureState.GetHashCode()
            ^ RestartRequired.GetHashCode());
 }
Example #11
0
        public void EqualsReturnFalseWhenCallsWithNullReference()
        {
            FeatureName nullReference = null;

            Assert.False(basicValue == nullReference);
            Assert.False(basicValue.Equals(nullReference));

            Assert.True(nullReference == null);
        }
        /// <summary>
        /// Finds the matching nodes of a <see cref="IClassConstantExpression"/>.
        /// </summary>
        /// <param name="node">The agent expression to check.</param>
        /// <param name="errorList">The list of errors found.</param>
        /// <param name="resolvedResult">The expression result types upon return.</param>
        /// <param name="resolvedException">Exceptions the expression can throw upon return.</param>
        /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param>
        /// <param name="expressionConstant">The expression constant upon return.</param>
        /// <param name="resolvedFinalFeature">The feature if the end of the path is a feature.</param>
        /// <param name="resolvedFinalDiscrete">The discrete if the end of the path is a discrete.</param>
        /// <param name="resolvedClassTypeName">The class type name upon return.</param>
        /// <param name="resolvedClassType">The class name upon return.</param>
        public static bool ResolveCompilerReferences(IClassConstantExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant, out IConstantFeature resolvedFinalFeature, out IDiscrete resolvedFinalDiscrete, out ITypeName resolvedClassTypeName, out IClassType resolvedClassType)
        {
            resolvedResult        = null;
            resolvedException     = null;
            constantSourceList    = new SealableList <IExpression>();
            expressionConstant    = NeutralLanguageConstant.NotConstant;
            resolvedFinalFeature  = null;
            resolvedFinalDiscrete = null;
            resolvedClassTypeName = null;
            resolvedClassType     = null;

            IIdentifier ClassIdentifier    = (IIdentifier)node.ClassIdentifier;
            IIdentifier ConstantIdentifier = (IIdentifier)node.ConstantIdentifier;
            IClass      EmbeddingClass     = node.EmbeddingClass;
            string      ValidClassText     = ClassIdentifier.ValidText.Item;
            string      ValidConstantText  = ConstantIdentifier.ValidText.Item;
            ISealableDictionary <string, IImportedClass> ClassTable = EmbeddingClass.ImportedClassTable;

            if (!ClassTable.ContainsKey(ValidClassText))
            {
                errorList.AddError(new ErrorUnknownIdentifier(ClassIdentifier, ValidClassText));
                return(false);
            }

            IClass BaseClass = ClassTable[ValidClassText].Item;

            resolvedClassTypeName = BaseClass.ResolvedClassTypeName.Item;
            resolvedClassType     = BaseClass.ResolvedClassType.Item;

            ITypeName     ConstantTypeName;
            ICompiledType ConstantType;

            ISealableDictionary <IFeatureName, IDiscrete>        DiscreteTable = BaseClass.DiscreteTable;
            ISealableDictionary <IFeatureName, IFeatureInstance> FeatureTable  = BaseClass.FeatureTable;

            if (FeatureName.TableContain(DiscreteTable, ValidConstantText, out IFeatureName Key, out IDiscrete Discrete))
            {
                if (!Expression.IsLanguageTypeAvailable(LanguageClasses.Number.Guid, node, out ITypeName NumberTypeName, out ICompiledType NumberType))
                {
                    errorList.AddError(new ErrorNumberTypeMissing(node));
                    return(false);
                }

                if (Discrete.NumericValue.IsAssigned)
                {
                    constantSourceList.Add((IExpression)Discrete.NumericValue.Item);
                }
                else
                {
                    expressionConstant = new DiscreteLanguageConstant(Discrete);
                }

                resolvedFinalDiscrete = Discrete;
                ConstantTypeName      = NumberTypeName;
                ConstantType          = NumberType;
            }
Example #13
0
        private static bool CheckAssignemntIdentifier(IErrorList errorList, ISealableDictionary <IFeatureName, IFeatureInstance> featureTable, ISealableDictionary <string, ICompiledFeature> assignedFeatureTable, IIdentifier identifierItem)
        {
            bool   Success             = true;
            string ValidIdentifierText = identifierItem.ValidText.Item;

            if (assignedFeatureTable.ContainsKey(ValidIdentifierText))
            {
                errorList.AddError(new ErrorIdentifierAlreadyListed(identifierItem, ValidIdentifierText));
                Success = false;
            }
            else
            {
                if (FeatureName.TableContain(featureTable, ValidIdentifierText, out IFeatureName Key, out IFeatureInstance FeatureItem))
                {
                    bool ValidFeature = false;

                    if (FeatureItem.Feature is AttributeFeature AsAttributeFeature)
                    {
                        ValidFeature = true;
                    }
                    else if (FeatureItem.Feature is IPropertyFeature AsPropertyFeature)
                    {
                        bool IsHandled = false;
                        switch (AsPropertyFeature.PropertyKind)
                        {
                        case BaseNode.UtilityType.ReadOnly:
                            ValidFeature = !AsPropertyFeature.GetterBody.IsAssigned;
                            IsHandled    = true;
                            break;

                        case BaseNode.UtilityType.ReadWrite:
                            ValidFeature = !(AsPropertyFeature.GetterBody.IsAssigned && !AsPropertyFeature.SetterBody.IsAssigned);
                            IsHandled    = true;
                            break;

                        case BaseNode.UtilityType.WriteOnly:
                            ValidFeature = true;
                            IsHandled    = true;
                            break;
                        }

                        Debug.Assert(IsHandled);
                    }

                    if (ValidFeature)
                    {
                        assignedFeatureTable.Add(ValidIdentifierText, FeatureItem.Feature);
                    }
                    else
                    {
                        errorList.AddError(new ErrorAttributeOrPropertyRequired(identifierItem, ValidIdentifierText));
                        Success = false;
                    }
                }
Example #14
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (Item.Owner == null)
            {
                Item.Owner = App.User;
            }

            BindingContext = Item;
            FeatureName.SetBinding(Entry.TextProperty, "Name");
            FeatureDescription.SetBinding(Entry.TextProperty, "Description");
        }
Example #15
0
        public async stt::Task GetFeatureResourceNamesAsync()
        {
            moq::Mock <GkeHub.GkeHubClient> mockGrpcClient = new moq::Mock <GkeHub.GkeHubClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetFeatureRequest request = new GetFeatureRequest
            {
                FeatureName = FeatureName.FromProjectLocationFeature("[PROJECT]", "[LOCATION]", "[FEATURE]"),
            };
            Feature expectedResponse = new Feature
            {
                FeatureName = FeatureName.FromProjectLocationFeature("[PROJECT]", "[LOCATION]", "[FEATURE]"),
                Labels      =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                ResourceState   = new FeatureResourceState(),
                Spec            = new CommonFeatureSpec(),
                MembershipSpecs =
                {
                    {
                        "key8a0b6e3c",
                        new MembershipFeatureSpec()
                    },
                },
                State            = new CommonFeatureState(),
                MembershipStates =
                {
                    {
                        "key8a0b6e3c",
                        new MembershipFeatureState()
                    },
                },
                CreateTime = new wkt::Timestamp(),
                UpdateTime = new wkt::Timestamp(),
                DeleteTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.GetFeatureAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Feature>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            GkeHubClient client = new GkeHubClientImpl(mockGrpcClient.Object, null);
            Feature      responseCallSettings = await client.GetFeatureAsync(request.FeatureName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Feature responseCancellationToken = await client.GetFeatureAsync(request.FeatureName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #16
0
        public void GetFeatureResourceNames()
        {
            moq::Mock <GkeHub.GkeHubClient> mockGrpcClient = new moq::Mock <GkeHub.GkeHubClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetFeatureRequest request = new GetFeatureRequest
            {
                FeatureName = FeatureName.FromProjectLocationFeature("[PROJECT]", "[LOCATION]", "[FEATURE]"),
            };
            Feature expectedResponse = new Feature
            {
                FeatureName = FeatureName.FromProjectLocationFeature("[PROJECT]", "[LOCATION]", "[FEATURE]"),
                Labels      =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                ResourceState   = new FeatureResourceState(),
                Spec            = new CommonFeatureSpec(),
                MembershipSpecs =
                {
                    {
                        "key8a0b6e3c",
                        new MembershipFeatureSpec()
                    },
                },
                State            = new CommonFeatureState(),
                MembershipStates =
                {
                    {
                        "key8a0b6e3c",
                        new MembershipFeatureState()
                    },
                },
                CreateTime = new wkt::Timestamp(),
                UpdateTime = new wkt::Timestamp(),
                DeleteTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.GetFeature(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GkeHubClient client   = new GkeHubClientImpl(mockGrpcClient.Object, null);
            Feature      response = client.GetFeature(request.FeatureName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>
        /// Gets the object a path is refering to.
        /// </summary>
        /// <param name="baseClass">The class where the path is used.</param>
        /// <param name="baseType">The type at the start of the path.</param>
        /// <param name="localScope">The local scope.</param>
        /// <param name="validPath">The path.</param>
        /// <param name="index">Index of the current identifier in the path.</param>
        /// <param name="errorList">The list of errors found.</param>
        /// <param name="finalFeature">The feature at the end of the path, if any, upon return.</param>
        /// <param name="finalDiscrete">The discrete at the end of the path, if any, upon return.</param>
        /// <param name="finalTypeName">The type name of the result.</param>
        /// <param name="finalType">The type of the result.</param>
        /// <param name="inheritBySideAttribute">Inherited from an effective body.</param>
        public static bool GetQualifiedPathFinalType(IClass baseClass, ICompiledType baseType, ISealableDictionary <string, IScopeAttributeFeature> localScope, IList <IIdentifier> validPath, int index, IErrorList errorList, out ICompiledFeature finalFeature, out IDiscrete finalDiscrete, out ITypeName finalTypeName, out ICompiledType finalType, out bool inheritBySideAttribute)
        {
            finalFeature           = null;
            finalDiscrete          = null;
            finalTypeName          = null;
            finalType              = null;
            inheritBySideAttribute = false;

            ISealableDictionary <IFeatureName, IFeatureInstance> FeatureTable = baseType.FeatureTable;

            IIdentifier ValidIdentifier = validPath[index];
            string      ValidText       = ValidIdentifier.ValidText.Item;

            if (index == 0 && localScope.ContainsKey(ValidText))
            {
                return(GetQualifiedPathFinalTypeFromLocal(baseClass, baseType, localScope, validPath, index, errorList, out finalFeature, out finalDiscrete, out finalTypeName, out finalType, out inheritBySideAttribute));
            }
            else if (FeatureName.TableContain(FeatureTable, ValidText, out IFeatureName Key, out IFeatureInstance Instance))
            {
                return(GetQualifiedPathFinalTypeAsFeature(baseClass, baseType, localScope, validPath, index, errorList, Instance, out finalFeature, out finalDiscrete, out finalTypeName, out finalType, out inheritBySideAttribute));
            }
Example #18
0
        /// <summary>
        /// Apply changes in this instance to arguments.
        /// </summary>
        /// <param name="importedClassTable">The table of imported classes</param>
        /// <param name="exportTable">The list of exports to change.</param>
        /// <param name="errorList">The list of errors found.</param>
        public virtual bool ApplyChange(ISealableDictionary <string, IImportedClass> importedClassTable, ISealableDictionary <IFeatureName, ISealableDictionary <string, IClass> > exportTable, IErrorList errorList)
        {
            if (!ExportIdentifierExists(exportTable, errorList, out IFeatureName CurrentExportName, out ISealableDictionary <string, IClass> CurrentClassTable))
            {
                return(false);
            }

            ISealableDictionary <string, ISealableDictionary <string, IClass> > ListedExportTable = new SealableDictionary <string, ISealableDictionary <string, IClass> >(); // string (export name) -> hashtable // string (class name) -> Class
            ISealableDictionary <string, IClass> ListedClassTable = new SealableDictionary <string, IClass>();                                                                // string (class name) -> Class

            bool InvalidExportChange = false;

            foreach (IIdentifier IdentifierItem in IdentifierList)
            {
                Debug.Assert(IdentifierItem.ValidText.IsAssigned);
                string ValidIdentifier = IdentifierItem.ValidText.Item;

                if (FeatureName.TableContain(exportTable, ValidIdentifier, out IFeatureName EntryName, out ISealableDictionary <string, IClass> ListedExport))
                {
                    Debug.Assert(!ListedExportTable.ContainsKey(ValidIdentifier));
                    ListedExportTable.Add(ValidIdentifier, ListedExport);
                }
Example #19
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (FeatureName.Length != 0)
            {
                hash ^= FeatureName.GetHashCode();
            }
            if (FeatureType != global::Asgt.Type.FeatureStat.Types.Type.Int)
            {
                hash ^= FeatureType.GetHashCode();
            }
            if (InformationGain != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(InformationGain);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        /// <summary>
        /// Returns true if ComAdobeGraniteFragsImplRandomFeatureProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeGraniteFragsImplRandomFeatureProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeGraniteFragsImplRandomFeatureProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     FeatureName == other.FeatureName ||
                     FeatureName != null &&
                     FeatureName.Equals(other.FeatureName)
                     ) &&
                 (
                     FeatureDescription == other.FeatureDescription ||
                     FeatureDescription != null &&
                     FeatureDescription.Equals(other.FeatureDescription)
                 ) &&
                 (
                     ActivePercentage == other.ActivePercentage ||
                     ActivePercentage != null &&
                     ActivePercentage.Equals(other.ActivePercentage)
                 ) &&
                 (
                     CookieName == other.CookieName ||
                     CookieName != null &&
                     CookieName.Equals(other.CookieName)
                 ) &&
                 (
                     CookieMaxAge == other.CookieMaxAge ||
                     CookieMaxAge != null &&
                     CookieMaxAge.Equals(other.CookieMaxAge)
                 ));
        }
Example #21
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method determines whether or not any metadata is
        /// different between the input instance and the current instance.</summary>
        ///
        /// <param name="inputFeature">The feature to compare metadata.</param>
        ///--------------------------------------------------------------------------------
        public bool IsIdenticalMetadata(Feature inputFeature)
        {
            if (FeatureName.GetString() != inputFeature.FeatureName.GetString())
            {
                return(false);
            }
            if (SolutionID.GetGuid() != inputFeature.SolutionID.GetGuid())
            {
                return(false);
            }
            if (IsAutoUpdated.GetBool() != inputFeature.IsAutoUpdated.GetBool())
            {
                return(false);
            }
            if (Description.GetString() != inputFeature.Description.GetString())
            {
                return(false);
            }

            #region protected
            #endregion protected

            return(true);
        }
Example #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        /// <returns></returns>
        public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node != null && node.HasChildNodes)
            {
                if (node.FirstChild.Attributes.Count > 0)
                {
                    Id = node.FirstChild.Attributes["gml:id"].InnerText;
                }
            }

            var periodicDateRangeNodes = node.FirstChild.SelectNodes("periodicDateRange", mgr);

            if (periodicDateRangeNodes != null && periodicDateRangeNodes.Count > 0)
            {
                var dateRanges = new List <DateRange>();
                foreach (XmlNode periodicDateRangeNode in periodicDateRangeNodes)
                {
                    var newDateRange = new DateRange();
                    newDateRange.FromXml(periodicDateRangeNode, mgr);
                    dateRanges.Add(newDateRange);
                }
                PeriodicDateRange = dateRanges.ToArray();
            }

            var fixedDateRangeNode = node.FirstChild.SelectSingleNode("fixedDateRange", mgr);

            if (fixedDateRangeNode != null && fixedDateRangeNode.HasChildNodes)
            {
                FixedDateRange = new DateRange();
                FixedDateRange.FromXml(fixedDateRangeNode, mgr);
            }

            var featureNameNodes = node.FirstChild.SelectNodes("featureName", mgr);

            if (featureNameNodes != null && featureNameNodes.Count > 0)
            {
                var featureNames = new List <FeatureName>();
                foreach (XmlNode featureNameNode in featureNameNodes)
                {
                    var newFeatureName = new FeatureName();
                    newFeatureName.FromXml(featureNameNode, mgr);
                    featureNames.Add(newFeatureName);
                }
                FeatureName = featureNames.ToArray();
            }

            var sourceIndication = node.FirstChild.SelectSingleNode("sourceIndication", mgr);

            if (sourceIndication != null && sourceIndication.HasChildNodes)
            {
                SourceIndication = new SourceIndication();
                SourceIndication.FromXml(sourceIndication, mgr);
            }

            var textContentNodes = node.FirstChild.SelectNodes("textContent", mgr);

            if (textContentNodes != null && textContentNodes.Count > 0)
            {
                var textContents = new List <TextContent>();
                foreach (XmlNode textContentNode in textContentNodes)
                {
                    if (textContentNode != null && textContentNode.HasChildNodes)
                    {
                        var content = new TextContent();
                        content.FromXml(textContentNode, mgr);
                        textContents.Add(content);
                    }
                }
                TextContent = textContents.ToArray();
            }

            var classificationNode = node.FirstChild.SelectSingleNode("classification", mgr);

            if (classificationNode != null && classificationNode.HasChildNodes)
            {
                Classification = classificationNode.FirstChild.InnerText;
            }

            var copyrightNode = node.FirstChild.SelectSingleNode("copyright");

            if (copyrightNode != null && copyrightNode.HasChildNodes)
            {
                Copyright = copyrightNode.FirstChild.InnerText;
            }

            var maximumDisplayScaleNode = node.FirstChild.SelectSingleNode("maximumDisplayScale", mgr);

            if (maximumDisplayScaleNode != null && maximumDisplayScaleNode.HasChildNodes)
            {
                MaximumDisplayScale = maximumDisplayScaleNode.FirstChild.InnerText;
            }

            var horizontalDatumReferenceNode = node.FirstChild.SelectSingleNode("horizontalDatumReference", mgr);

            if (horizontalDatumReferenceNode != null && horizontalDatumReferenceNode.HasChildNodes)
            {
                HorizontalDatumReference = horizontalDatumReferenceNode.FirstChild.InnerText;
            }

            var horizontalDatumValueNode = node.FirstChild.SelectSingleNode("horizontalDatumValue", mgr);

            if (horizontalDatumValueNode != null && horizontalDatumValueNode.HasChildNodes)
            {
                HorizontalDatumValue = horizontalDatumValueNode.FirstChild.InnerText;
            }

            var verticalDatumNode = node.FirstChild.SelectSingleNode("verticalDatum", mgr);

            if (verticalDatumNode != null && verticalDatumNode.HasChildNodes)
            {
                VerticalDatum = verticalDatumNode.FirstChild.InnerText;
            }

            var soundingDatumNode = node.FirstChild.SelectSingleNode("soundingDatum", mgr);

            if (soundingDatumNode != null && soundingDatumNode.HasChildNodes)
            {
                SoundingDatum = soundingDatumNode.FirstChild.InnerText;
            }

            var productTypeNode = node.FirstChild.SelectSingleNode("productType", mgr);

            if (productTypeNode != null && productTypeNode.HasChildNodes)
            {
                ProductType = productTypeNode.FirstChild.InnerText;
            }

            var minimumDisplayScaleNode = node.FirstChild.SelectSingleNode("minimumDisplayScale", mgr);

            if (minimumDisplayScaleNode != null && minimumDisplayScaleNode.HasChildNodes)
            {
                MinimumDisplayScale = minimumDisplayScaleNode.FirstChild.InnerText;
            }

            var issueDateNode = node.FirstChild.SelectSingleNode("issueDate", mgr);

            if (issueDateNode != null && issueDateNode.HasChildNodes)
            {
                IssueDate = issueDateNode.FirstChild.InnerText;
            }

            var purposeNode = node.FirstChild.SelectSingleNode("purpose", mgr);

            if (purposeNode != null && purposeNode.HasChildNodes)
            {
                Purpose = purposeNode.FirstChild.InnerText;
            }

            var informationNodes = node.FirstChild.SelectNodes("information", mgr);

            if (informationNodes != null && informationNodes.Count > 0)
            {
                var informations = new List <Information>();
                foreach (XmlNode informationNode in informationNodes)
                {
                    if (informationNode != null && informationNode.HasChildNodes)
                    {
                        var newInformation = new Information();
                        newInformation.FromXml(informationNode, mgr);
                        informations.Add(newInformation);
                    }
                }
                Information = informations.ToArray();
            }

            var priceNodes = node.FirstChild.SelectNodes("price", mgr);

            if (priceNodes != null && priceNodes.Count > 0)
            {
                var prices = new List <Price>();
                foreach (XmlNode priceNode in priceNodes)
                {
                    if (priceNode != null && priceNode.HasChildNodes)
                    {
                        var newPrice = new Price();
                        newPrice.FromXml(priceNode, mgr);
                        prices.Add(newPrice);
                    }
                }
                Price = prices.ToArray();
            }

            var producingAgencyNode = node.FirstChild.SelectSingleNode("producingAgency", mgr);

            if (producingAgencyNode != null && producingAgencyNode.HasChildNodes)
            {
                ProducingAgency = new ProducingAgency();
                ProducingAgency.FromXml(producingAgencyNode, mgr);
            }

            var chartNumberNode = node.FirstChild.SelectSingleNode("chartNumber", mgr);

            if (chartNumberNode != null && chartNumberNode.HasChildNodes)
            {
                ChartNumber = chartNumberNode.FirstChild.InnerText;
            }

            var distributionStatusNode = node.FirstChild.SelectSingleNode("distributionStatus", mgr);

            if (distributionStatusNode != null && distributionStatusNode.HasChildNodes)
            {
                DistributionStatus = distributionStatusNode.FirstChild.InnerText;
            }

            var compilationScaleNode = node.FirstChild.SelectSingleNode("compilationScale", mgr);

            if (compilationScaleNode != null && compilationScaleNode.HasChildNodes)
            {
                CompilationScale = compilationScaleNode.FirstChild.InnerText;
            }

            var editionNumberNode = node.FirstChild.SelectSingleNode("editionNumber", mgr);

            if (editionNumberNode != null && editionNumberNode.HasChildNodes)
            {
                EditionNumber = editionNumberNode.FirstChild.InnerText;
            }

            var specificUsageNode = node.FirstChild.SelectSingleNode("specificUsage", mgr);

            if (specificUsageNode != null && specificUsageNode.HasChildNodes)
            {
                SpecificUsage = specificUsageNode.FirstChild.InnerText;
            }

            var producerCodeNode = node.FirstChild.SelectSingleNode("producerCode", mgr);

            if (producerCodeNode != null && producerCodeNode.HasChildNodes)
            {
                ProducerCode = producerCodeNode.FirstChild.InnerText;
            }

            var producerNationNode = node.FirstChild.SelectSingleNode("producerNation", mgr);

            if (producerNationNode != null && producerNationNode.HasChildNodes)
            {
                ProducerNation = producerNationNode.FirstChild.InnerText;
            }

            var datasetNameNodes = node.FirstChild.SelectNodes("datasetName", mgr);

            if (datasetNameNodes != null && datasetNameNodes.Count > 0)
            {
                var datasets = new List <string>();
                foreach (XmlNode datasetNameNode in datasetNameNodes)
                {
                    if (datasetNameNode != null && datasetNameNode.HasChildNodes)
                    {
                        datasets.Add(datasetNameNode.FirstChild.InnerText);
                    }
                }
                DatasetName = datasets.ToArray();
            }

            var updateDateNode = node.FirstChild.SelectSingleNode("updateDate", mgr);

            if (updateDateNode != null && updateDateNode.HasChildNodes)
            {
                UpdateDate = updateDateNode.FirstChild.InnerText;
            }

            var updateNumberNode = node.FirstChild.SelectSingleNode("updateNumber", mgr);

            if (updateNumberNode != null && updateNumberNode.HasChildNodes)
            {
                UpdateNumber = updateNumberNode.FirstChild.InnerText;
            }

            var productSpecificationNode = node.FirstChild.SelectSingleNode("productSpecification", mgr);

            if (productSpecificationNode != null && productSpecificationNode.HasChildNodes)
            {
                ProductSpecification = new ReferenceSpecification();
                ProductSpecification.FromXml(productSpecificationNode, mgr);
            }

            var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr);

            if (linkNodes != null && linkNodes.Count > 0)
            {
                var links = new List <Link>();
                foreach (XmlNode linkNode in linkNodes)
                {
                    var newLink = new Link();
                    newLink.FromXml(linkNode, mgr);
                    links.Add(newLink);
                }
                Links = links.ToArray();
            }

            return(this);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        /// <returns></returns>
        public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node != null && node.HasChildNodes)
            {
                if (node.FirstChild.Attributes.Count > 0)
                {
                    Id = node.FirstChild.Attributes["gml:id"].InnerText;
                }
            }

            var featureObjectIdentifierNode = node.FirstChild.SelectSingleNode("s100:featureObjectIdentifier", mgr);

            if (featureObjectIdentifierNode != null && featureObjectIdentifierNode.HasChildNodes)
            {
                FeatureObjectIdentifier = new FeatureObjectIdentifier();
                FeatureObjectIdentifier.FromXml(featureObjectIdentifierNode, mgr);
            }

            var periodicDateRangeNodes = node.FirstChild.SelectNodes("periodicDateRange", mgr);

            if (periodicDateRangeNodes != null && periodicDateRangeNodes.Count > 0)
            {
                var dateRanges = new List <DateRange>();
                foreach (XmlNode periodicDateRangeNode in periodicDateRangeNodes)
                {
                    var newDateRange = new DateRange();
                    newDateRange.FromXml(periodicDateRangeNode, mgr);
                    dateRanges.Add(newDateRange);
                }
                PeriodicDateRange = dateRanges.ToArray();
            }

            var fixedDateRangeNode = node.FirstChild.SelectSingleNode("fixedDateRange", mgr);

            if (fixedDateRangeNode != null && fixedDateRangeNode.HasChildNodes)
            {
                FixedDateRange = new DateRange();
                FixedDateRange.FromXml(fixedDateRangeNode, mgr);
            }

            var featureNameNodes = node.FirstChild.SelectNodes("featureName", mgr);

            if (featureNameNodes != null && featureNameNodes.Count > 0)
            {
                var featureNames = new List <FeatureName>();
                foreach (XmlNode featureNameNode in featureNameNodes)
                {
                    var newFeatureName = new FeatureName();
                    newFeatureName.FromXml(featureNameNode, mgr);
                    featureNames.Add(newFeatureName);
                }
                FeatureName = featureNames.ToArray();
            }

            var sourceIndication = node.FirstChild.SelectSingleNode("sourceIndication", mgr);

            if (sourceIndication != null && sourceIndication.HasChildNodes)
            {
                SourceIndication = new SourceIndication();
                SourceIndication.FromXml(sourceIndication, mgr);
            }

            var textContentNodes = node.FirstChild.SelectNodes("textContent", mgr);

            if (textContentNodes != null && textContentNodes.Count > 0)
            {
                var textContents = new List <TextContent>();
                foreach (XmlNode textContentNode in textContentNodes)
                {
                    if (textContentNode != null && textContentNode.HasChildNodes)
                    {
                        var content = new TextContent();
                        content.FromXml(textContentNode, mgr);
                        textContents.Add(content);
                    }
                }
                TextContent = textContents.ToArray();
            }

            var categoryOfFrctAndWarningAreaNode = node.FirstChild.SelectSingleNode("categoryOfFrcstAndWarningArea", mgr);

            if (categoryOfFrctAndWarningAreaNode != null && categoryOfFrctAndWarningAreaNode.HasChildNodes)
            {
                CategoryOfFrctAndWarningArea = categoryOfFrctAndWarningAreaNode.FirstChild.InnerText;
            }

            var nationalityNode = node.FirstChild.SelectSingleNode("nationality", mgr);

            if (nationalityNode != null && nationalityNode.HasChildNodes)
            {
                Nationality = nationalityNode.FirstChild.InnerText;
            }

            var statusNode = node.FirstChild.SelectSingleNode("status", mgr);

            if (statusNode != null && statusNode.HasChildNodes)
            {
                Status = statusNode.FirstChild.InnerText;
            }

            var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr);

            if (linkNodes != null && linkNodes.Count > 0)
            {
                var links = new List <Link>();
                foreach (XmlNode linkNode in linkNodes)
                {
                    var newLink = new Link();
                    newLink.FromXml(linkNode, mgr);
                    links.Add(newLink);
                }
                Links = links.ToArray();
            }

            return(this);
        }
Example #24
0
 public void EqualsReturnFalseWhenCallsWithOtherValueObject()
 {
     FeatureName otherValue = new FeatureName(Exp.Namespace + "OtherName");
     Assert.False(basicValue == otherValue);
     Assert.False(basicValue.Equals(otherValue));
 }
Example #25
0
 public void EqualsReturnTrueWhenCallsWithSameValueObject()
 {
     FeatureName sameValue = new FeatureName(Exp.Namespace + "SomeName");
     Assert.True(basicValue == sameValue);
     Assert.True(basicValue.Equals(sameValue));
 }
Example #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        /// <returns></returns>
        public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node != null && node.HasChildNodes)
            {
                if (node.FirstChild.Attributes.Count > 0)
                {
                    Id = node.FirstChild.Attributes["gml:id"].InnerText;
                }
            }

            var periodicDateRangeNodes = node.FirstChild.SelectNodes("periodicDateRange", mgr);

            if (periodicDateRangeNodes != null && periodicDateRangeNodes.Count > 0)
            {
                var dateRanges = new List <DateRange>();
                foreach (XmlNode periodicDateRangeNode in periodicDateRangeNodes)
                {
                    var newDateRange = new DateRange();
                    newDateRange.FromXml(periodicDateRangeNode, mgr);
                    dateRanges.Add(newDateRange);
                }
                PeriodicDateRange = dateRanges.ToArray();
            }

            var fixedDateRangeNode = node.FirstChild.SelectSingleNode("fixedDateRange", mgr);

            if (fixedDateRangeNode != null && fixedDateRangeNode.HasChildNodes)
            {
                FixedDateRange = new DateRange();
                FixedDateRange.FromXml(fixedDateRangeNode, mgr);
            }

            var featureNameNodes = node.FirstChild.SelectNodes("featureName", mgr);

            if (featureNameNodes != null && featureNameNodes.Count > 0)
            {
                var featureNames = new List <FeatureName>();
                foreach (XmlNode featureNameNode in featureNameNodes)
                {
                    var newFeatureName = new FeatureName();
                    newFeatureName.FromXml(featureNameNode, mgr);
                    featureNames.Add(newFeatureName);
                }
                FeatureName = featureNames.ToArray();
            }

            var sourceIndication = node.FirstChild.SelectSingleNode("sourceIndication", mgr);

            if (sourceIndication != null && sourceIndication.HasChildNodes)
            {
                SourceIndication = new SourceIndication();
                SourceIndication.FromXml(sourceIndication, mgr);
            }

            var textContentNodes = node.FirstChild.SelectNodes("textContent", mgr);

            if (textContentNodes != null && textContentNodes.Count > 0)
            {
                var textContents = new List <TextContent>();
                foreach (XmlNode textContentNode in textContentNodes)
                {
                    if (textContentNode != null && textContentNode.HasChildNodes)
                    {
                        var content = new TextContent();
                        content.FromXml(textContentNode, mgr);
                        textContents.Add(content);
                    }
                }
                TextContent = textContents.ToArray();
            }

            var categoryOfPilotNodes = node.FirstChild.SelectNodes("categoryOfPilot", mgr);

            if (categoryOfPilotNodes != null && categoryOfPilotNodes.Count > 0)
            {
                var categories = new List <string>();
                foreach (XmlNode categoryOfPilotNode in categoryOfPilotNodes)
                {
                    var category = categoryOfPilotNode.FirstChild.InnerText;
                    categories.Add(category);
                }
                CategoryOfPilot = categories.ToArray();
            }

            var pilotQualificationNode = node.FirstChild.SelectSingleNode("pilotQualification", mgr);

            if (pilotQualificationNode != null && pilotQualificationNode.HasChildNodes)
            {
                PilotQualification = pilotQualificationNode.FirstChild.InnerText;
            }

            var pilotRequestNode = node.FirstChild.SelectSingleNode("pilotRequest", mgr);

            if (pilotRequestNode != null && pilotRequestNode.HasChildNodes)
            {
                PilotRequest = pilotRequestNode.FirstChild.InnerText;
            }

            var remotePilotNode = node.FirstChild.SelectSingleNode("remotePilot", mgr);

            if (remotePilotNode != null && remotePilotNode.HasChildNodes)
            {
                RemotePilot = remotePilotNode.FirstChild.InnerText;
            }

            var noticeTimeNode = node.FirstChild.SelectSingleNode("noticeTime", mgr);

            if (noticeTimeNode != null && noticeTimeNode.HasChildNodes)
            {
                NoticeTime = new NoticeTime();
                NoticeTime.FromXml(noticeTimeNode, mgr);
            }

            var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr);

            if (linkNodes != null && linkNodes.Count > 0)
            {
                var links = new List <Link>();
                foreach (XmlNode linkNode in linkNodes)
                {
                    var newLink = new Link();
                    newLink.FromXml(linkNode, mgr);
                    links.Add(newLink);
                }
                Links = links.ToArray();
            }

            return(this);
        }
        /// <summary>
        /// Finds the matching nodes of a <see cref="IAgentExpression"/>.
        /// </summary>
        /// <param name="node">The agent expression to check.</param>
        /// <param name="errorList">The list of errors found.</param>
        /// <param name="resolvedResult">The expression result types upon return.</param>
        /// <param name="resolvedException">Exceptions the expression can throw upon return.</param>
        /// <param name="constantSourceList">Sources of the constant expression upon return, if any.</param>
        /// <param name="expressionConstant">The constant value upon return, if any.</param>
        /// <param name="resolvedFeature">The feature found upon return.</param>
        public static bool ResolveCompilerReferences(IAgentExpression node, IErrorList errorList, out IResultType resolvedResult, out IResultException resolvedException, out ISealableList <IExpression> constantSourceList, out ILanguageConstant expressionConstant, out ICompiledFeature resolvedFeature)
        {
            resolvedResult     = null;
            resolvedException  = null;
            constantSourceList = new SealableList <IExpression>();
            expressionConstant = NeutralLanguageConstant.NotConstant;
            resolvedFeature    = null;

            IIdentifier Delegated = (IIdentifier)node.Delegated;

            Debug.Assert(Delegated.ValidText.IsAssigned);
            string ValidText = Delegated.ValidText.Item;

            IFeatureInstance FeatureInstance;

            if (node.BaseType.IsAssigned)
            {
                IObjectType   BaseType         = (IObjectType)node.BaseType.Item;
                ICompiledType ResolvedBaseType = BaseType.ResolvedType.Item;
                ISealableDictionary <IFeatureName, IFeatureInstance> FeatureTable = null;

                switch (ResolvedBaseType)
                {
                case IClassType AsClassType:
                    FeatureTable = AsClassType.FeatureTable;
                    break;

                case IFormalGenericType AsFormalGenericType:
                    foreach (IConstraint Item in AsFormalGenericType.FormalGeneric.ConstraintList)
                    {
                        if (Item.ResolvedTypeWithRename.Item is IClassType Parent)
                        {
                            FeatureTable = Parent.FeatureTable;

                            if (FeatureName.TableContain(FeatureTable, ValidText, out IFeatureName ParentKey, out IFeatureInstance ParentFeatureInstance))
                            {
                                break;
                            }
                        }
                    }
                    break;
                }

                if (FeatureTable == null)
                {
                    errorList.AddError(new ErrorClassTypeRequired(node));
                    return(false);
                }

                if (!FeatureName.TableContain(FeatureTable, ValidText, out IFeatureName Key, out FeatureInstance))
                {
                    errorList.AddError(new ErrorUnknownIdentifier(node, ValidText));
                    return(false);
                }
            }
            else
            {
                IClass EmbeddingClass = node.EmbeddingClass;
                if (!FeatureName.TableContain(EmbeddingClass.FeatureTable, ValidText, out IFeatureName Key, out FeatureInstance))
                {
                    errorList.AddError(new ErrorUnknownIdentifier(node, ValidText));
                    return(false);
                }
            }

            Debug.Assert(FeatureInstance.Feature != null);
            resolvedFeature = FeatureInstance.Feature;

            resolvedResult = new ResultType(resolvedFeature.ResolvedAgentTypeName.Item, resolvedFeature.ResolvedAgentType.Item, string.Empty);

            resolvedException  = new ResultException();
            expressionConstant = new AgentLanguageConstant(resolvedFeature);

#if COVERAGE
            Debug.Assert(!node.IsComplex);
#endif

            return(true);
        }
Example #28
0
 /// <summary>
 ///     Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>A hash code for the current <see cref="T:System.Object" />.</returns>
 public override int GetHashCode()
 {
     return((string.IsNullOrWhiteSpace(FeatureName) ? 0 : FeatureName.GetHashCode()) ^ State.GetHashCode());
 }
Example #29
0
 public PrintSchemaFeature(FeatureName name)
 {
     _name = name;
 }
Example #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        /// <returns></returns>
        public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node != null && node.HasChildNodes)
            {
                if (node.FirstChild.Attributes.Count > 0)
                {
                    Id = node.FirstChild.Attributes["gml:id"].InnerText;
                }
            }

            var fixedDateRangeNode = node.FirstChild.SelectSingleNode("fixedDateRange", mgr);

            if (fixedDateRangeNode != null && fixedDateRangeNode.HasChildNodes)
            {
                FixedDateRange = new DateRange();
                FixedDateRange.FromXml(fixedDateRangeNode, mgr);
            }

            var periodicDateRangeNodes = node.FirstChild.SelectNodes("periodicDateRange", mgr);

            if (periodicDateRangeNodes != null && periodicDateRangeNodes.Count > 0)
            {
                var dateRanges = new List <DateRange>();
                foreach (XmlNode periodicDateRangeNode in periodicDateRangeNodes)
                {
                    var newDateRange = new DateRange();
                    newDateRange.FromXml(periodicDateRangeNode, mgr);
                    dateRanges.Add(newDateRange);
                }
                PeriodicDateRange = dateRanges.ToArray();
            }

            var featureNameNodes = node.FirstChild.SelectNodes("featureName", mgr);

            if (featureNameNodes != null && featureNameNodes.Count > 0)
            {
                var featureNames = new List <FeatureName>();
                foreach (XmlNode featureNameNode in featureNameNodes)
                {
                    var newFeatureName = new FeatureName();
                    newFeatureName.FromXml(featureNameNode, mgr);
                    featureNames.Add(newFeatureName);
                }
                FeatureName = featureNames.ToArray();
            }

            var sourceIndicationNodes = node.FirstChild.SelectNodes("sourceIndication", mgr);

            if (sourceIndicationNodes != null && sourceIndicationNodes.Count > 0)
            {
                var sourceIndications = new List <SourceIndication>();
                foreach (XmlNode sourceIndicationNode in sourceIndicationNodes)
                {
                    if (sourceIndicationNode != null && sourceIndicationNode.HasChildNodes)
                    {
                        var sourceIndication = new SourceIndication();
                        sourceIndication.FromXml(sourceIndicationNode, mgr);
                        sourceIndications.Add(sourceIndication);
                    }
                }
                SourceIndication = sourceIndications.ToArray();
            }

            var categoryOfAuthorityNode = node.FirstChild.SelectSingleNode("categoryOfAuthority", mgr);

            if (categoryOfAuthorityNode != null && categoryOfAuthorityNode.HasChildNodes)
            {
                CategoryOfAuthority = categoryOfAuthorityNode.FirstChild.InnerText;
            }

            var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr);

            if (linkNodes != null && linkNodes.Count > 0)
            {
                var links = new List <Link>();
                foreach (XmlNode linkNode in linkNodes)
                {
                    var newLink = new Link();
                    newLink.FromXml(linkNode, mgr);
                    links.Add(newLink);
                }
                Links = links.ToArray();
            }

            return(this);
        }
Example #31
0
 /// <summary>
 /// Initializes a new instance of <see cref="FeatureDefinition"/>
 /// </summary>
 /// <param name="name"><see cref="FeatureName">Name</see> of the featurew</param>
 /// <param name="subFeatures">Key/Value pairs of features and their definitions for any sub-features</param>
 public FeatureDefinition(FeatureName name, IDictionary <Feature, FeatureDefinition> subFeatures)
 {
     Name        = name;
     SubFeatures = new ReadOnlyDictionary <Feature, FeatureDefinition>(subFeatures);
 }
Example #32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        /// <param name="mgr"></param>
        /// <returns></returns>
        public override IFeature FromXml(XmlNode node, XmlNamespaceManager mgr)
        {
            if (node != null && node.HasChildNodes)
            {
                if (node.FirstChild.Attributes.Count > 0)
                {
                    Id = node.FirstChild.Attributes["gml:id"].InnerText;
                }
            }

            var periodicDateRangeNodes = node.FirstChild.SelectNodes("periodicDateRange", mgr);

            if (periodicDateRangeNodes != null && periodicDateRangeNodes.Count > 0)
            {
                var dateRanges = new List <DateRange>();
                foreach (XmlNode periodicDateRangeNode in periodicDateRangeNodes)
                {
                    var newDateRange = new DateRange();
                    newDateRange.FromXml(periodicDateRangeNode, mgr);
                    dateRanges.Add(newDateRange);
                }
                PeriodicDateRange = dateRanges.ToArray();
            }

            var fixedDateRangeNode = node.FirstChild.SelectSingleNode("fixedDateRange", mgr);

            if (fixedDateRangeNode != null && fixedDateRangeNode.HasChildNodes)
            {
                FixedDateRange = new DateRange();
                FixedDateRange.FromXml(fixedDateRangeNode, mgr);
            }

            var featureNameNodes = node.FirstChild.SelectNodes("featureName", mgr);

            if (featureNameNodes != null && featureNameNodes.Count > 0)
            {
                var featureNames = new List <FeatureName>();
                foreach (XmlNode featureNameNode in featureNameNodes)
                {
                    var newFeatureName = new FeatureName();
                    newFeatureName.FromXml(featureNameNode, mgr);
                    featureNames.Add(newFeatureName);
                }
                FeatureName = featureNames.ToArray();
            }

            var sourceIndication = node.FirstChild.SelectSingleNode("sourceIndication", mgr);

            if (sourceIndication != null && sourceIndication.HasChildNodes)
            {
                SourceIndication = new SourceIndication();
                SourceIndication.FromXml(sourceIndication, mgr);
            }

            var textContentNodes = node.FirstChild.SelectNodes("textContent", mgr);

            if (textContentNodes != null && textContentNodes.Count > 0)
            {
                var textContents = new List <TextContent>();
                foreach (XmlNode textContentNode in textContentNodes)
                {
                    if (textContentNode != null && textContentNode.HasChildNodes)
                    {
                        var content = new TextContent();
                        content.FromXml(textContentNode, mgr);
                        textContents.Add(content);
                    }
                }
                TextContent = textContents.ToArray();
            }

            var restrictionNodes = node.FirstChild.SelectNodes("restriction", mgr);

            if (restrictionNodes != null && restrictionNodes.Count > 0)
            {
                var restrictions = new List <string>();
                foreach (XmlNode restrictionNode in restrictionNodes)
                {
                    if (restrictionNode != null && restrictionNode.HasChildNodes)
                    {
                        restrictions.Add(restrictionNode.FirstChild.InnerText);
                    }
                }
                Restriction = restrictions.ToArray();
            }

            var statusNodes = node.FirstChild.SelectNodes("status", mgr);

            if (statusNodes != null && statusNodes.Count > 0)
            {
                var statuses = new List <string>();
                foreach (XmlNode statusNode in statusNodes)
                {
                    if (statusNode != null && statusNode.HasChildNodes)
                    {
                        statuses.Add(statusNode.FirstChild.InnerText);
                    }
                }
                Status = statuses.ToArray();
            }

            var linkNodes = node.FirstChild.SelectNodes("*[boolean(@xlink:href)]", mgr);

            if (linkNodes != null && linkNodes.Count > 0)
            {
                var links = new List <Link>();
                foreach (XmlNode linkNode in linkNodes)
                {
                    var newLink = new Link();
                    newLink.FromXml(linkNode, mgr);
                    links.Add(newLink);
                }
                Links = links.ToArray();
            }

            return(this);
        }
Example #33
0
 public virtual bool TryProvide(FeatureName name)
 {
     return(ImplementationNameTest(name) || FeaturePatternTest(name));
 }