/// <summary> /// Asynchronously reads the <see cref="SpecHierarchy"/> which is specific to the <see cref="Specification"/> class. /// </summary> /// <param name="reader"> /// an instance of <see cref="XmlReader"/> /// </param> /// <param name="token"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> protected override async Task ReadHierarchyAsync(XmlReader reader, CancellationToken token) { while (await reader.ReadAsync()) { if (token.IsCancellationRequested) { token.ThrowIfCancellationRequested(); } if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY") { if (token.IsCancellationRequested) { token.ThrowIfCancellationRequested(); } using (var subtree = reader.ReadSubtree()) { await subtree.MoveToContentAsync(); var specHierarchy = new SpecHierarchy(this, this.ReqIFContent, this.loggerFactory); await specHierarchy.ReadXmlAsync(subtree, token); } } } }
/// <summary> /// Reads the <see cref="SpecType"/> which is specific to the <see cref="Specification"/> class. /// </summary> /// <param name="reader"> /// an instance of <see cref="XmlReader"/> /// </param> /// <param name="token"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> private async Task DeserializeSpecHierarchyAsync(XmlReader reader, CancellationToken token) { while (await reader.ReadAsync()) { if (token.IsCancellationRequested) { token.ThrowIfCancellationRequested(); } if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY") { if (bool.TryParse(reader.GetAttribute("IS-TABLE-INTERNAL"), out var isTableInternal)) { this.IsTableInternal = isTableInternal; } if (token.IsCancellationRequested) { token.ThrowIfCancellationRequested(); } using (var subtree = reader.ReadSubtree()) { await subtree.MoveToContentAsync(); var specHierarchy = new SpecHierarchy(this, this.Root, this.ReqIfContent, this.loggerFactory); await specHierarchy.ReadXmlAsync(subtree, token); } } } }
/// <summary> /// Initializes a new instance of the <see cref="SpecHierarchy"/> class. /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="root"> /// The root. /// </param> /// <param name="reqIfContent"> /// The requirement core information content. /// </param> /// <param name="loggerFactory"> /// The (injected) <see cref="ILoggerFactory"/> used to setup logging /// </param> internal SpecHierarchy(SpecHierarchy container, Specification root, ReqIFContent reqIfContent, ILoggerFactory loggerFactory) : base(loggerFactory) { this.logger = this.loggerFactory == null ? NullLogger <SpecHierarchy> .Instance : this.loggerFactory.CreateLogger <SpecHierarchy>(); this.Initialize(container, root, reqIfContent); this.Container.Children.Add(this); }
/// <summary> /// Reads the <see cref="SpecHierarchy"/> which is specific to the <see cref="Specification"/> class. /// </summary> /// <param name="reader"> /// an instance of <see cref="XmlReader"/> /// </param> protected override void ReadHierarchy(XmlReader reader) { while (reader.Read()) { if (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY") { using (var subtree = reader.ReadSubtree()) { subtree.MoveToContent(); var specHierarchy = new SpecHierarchy(this, this.ReqIFContent, this.loggerFactory); specHierarchy.ReadXml(subtree); } } } }
/// <summary> /// Reads the <see cref="SpecType"/> which is specific to the <see cref="Specification"/> class. /// </summary> /// <param name="reader"> /// an instance of <see cref="XmlReader"/> /// </param> private void DeserializeSpecHierarchy(XmlReader reader) { while (reader.Read()) { if (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "SPEC-HIERARCHY") { if (bool.TryParse(reader.GetAttribute("IS-TABLE-INTERNAL"), out var isTableInternal)) { this.IsTableInternal = isTableInternal; } using (var subtree = reader.ReadSubtree()) { subtree.MoveToContent(); var specHierarchy = new SpecHierarchy(this, this.Root, this.ReqIfContent, this.loggerFactory); specHierarchy.ReadXml(subtree); } } } }
/// <summary> /// Initializes a new instance of the <see cref="SpecHierarchy"/> class. /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="root"> /// The root. /// </param> /// <param name="reqIfContent"> /// The requirement core information content. /// </param> internal SpecHierarchy(SpecHierarchy container, Specification root, ReqIFContent reqIfContent) { this.Initialize(container, root, reqIfContent); this.Container.Children.Add(this); }
/// <summary> /// The initialize. /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="root"> /// The root. /// </param> /// <param name="reqIfContent"> /// The requirement core information content. /// </param> private void Initialize(SpecHierarchy container, Specification root, ReqIFContent reqIfContent) { this.Container = container; this.Root = root; this.ReqIfContent = reqIfContent; }