diff --git a/SemanticData/Tests/USNodeSetValidationUnitTestProject/UANodeContextUnitTest.cs b/SemanticData/Tests/USNodeSetValidationUnitTestProject/UANodeContextUnitTest.cs index 1d2244fc..64962d95 100644 --- a/SemanticData/Tests/USNodeSetValidationUnitTestProject/UANodeContextUnitTest.cs +++ b/SemanticData/Tests/USNodeSetValidationUnitTestProject/UANodeContextUnitTest.cs @@ -417,16 +417,11 @@ public IUANodeBase GetBaseTypeNode(NodeClassEnum nodeClass) return null; } - /// - /// Gets the children nodes for the . - /// - /// The root node of the requested children. - /// Return an instance of capturing all children of the selected node. - public IEnumerable GetChildren(IUANodeContext rootNode) + public IEnumerable GetChildren(IUANodeBase node) { - return m_References.Values.Where(x => x.SourceNode == rootNode). - Where(x => (x.ReferenceKind == ReferenceKindEnum.HasProperty || x.ReferenceKind == ReferenceKindEnum.HasComponent)). - Select(x => x.TargetNode); + return m_References.Values.Where(x => Object.ReferenceEquals(x.SourceNode, node)). + Where(x => (x.ReferenceKind == ReferenceKindEnum.HasProperty || x.ReferenceKind == ReferenceKindEnum.HasComponent)). + Select(x => x.TargetNode); } public ushort GetIndexOrAppend(string identifier) @@ -450,7 +445,7 @@ public IUANodeContext GetOrCreateNodeContext(NodeId nodeId, Func GetReferences2Me(IUANodeContext node) + public IEnumerable GetReferences2Me(IUANodeBase node) { throw new NotImplementedException(); } diff --git a/SemanticData/UANodeSetValidation/AddressSpaceContext.cs b/SemanticData/UANodeSetValidation/AddressSpaceContext.cs index 23a39e5b..336175d7 100644 --- a/SemanticData/UANodeSetValidation/AddressSpaceContext.cs +++ b/SemanticData/UANodeSetValidation/AddressSpaceContext.cs @@ -187,37 +187,35 @@ public string GetNamespace(ushort namespaceIndex) } /// - /// Gets my references from the main collection. + /// Gets my references. /// - /// The index. - /// An instance of the containing references pointed out by index. - IEnumerable IAddressSpaceBuildContext.GetMyReferences(IUANodeBase index) + /// The source node + /// Returns containing references attached to the . + IEnumerable IAddressSpaceBuildContext.GetMyReferences(IUANodeBase node) { - //TODO Import simple NodeSet2 file is incomplete #510 - return m_References.Values.Where(x => (x.SourceNode == index)); + return m_References.Values.Where(x => (Object.ReferenceEquals(x.SourceNode, node))); } /// /// Gets the references2 me. /// - /// The index. + /// The index. /// IEnumerable<UAReferenceContext>. - IEnumerable IAddressSpaceBuildContext.GetReferences2Me(IUANodeContext index) + IEnumerable IAddressSpaceBuildContext.GetReferences2Me(IUANodeBase node) { - //TODO Import simple NodeSet2 file is incomplete #510 - consider consolidation with GetMyReferences - return m_References.Values.Where(x => x.TargetNode == index && x.ParentNode != index); + return m_References.Values.Where(x => Object.ReferenceEquals(x.TargetNode, node) && !Object.ReferenceEquals(x.ParentNode, node)); } /// - /// Gets the children nodes for the . + /// Gets the children nodes ( or ) for the . /// - /// The root node of the requested children. - /// Return an instance of capturing all children of the selected node. - public IEnumerable GetChildren(IUANodeContext rootNode) + /// The root node of the requested children. + /// Return an instance of capturing all children of the selected node. + public IEnumerable GetChildren(IUANodeBase node) { - return m_References.Values.Where(x => x.SourceNode == rootNode). - Where(x => (x.ReferenceKind == ReferenceKindEnum.HasProperty || x.ReferenceKind == ReferenceKindEnum.HasComponent)). - Select(x => x.TargetNode); + return m_References.Values.Where(x => Object.ReferenceEquals(x.SourceNode, node)). + Where(x => (x.ReferenceKind == ReferenceKindEnum.HasProperty || x.ReferenceKind == ReferenceKindEnum.HasComponent)). + Select(x => x.TargetNode); } public Parameter ExportArgument(DataSerialization.Argument argument) diff --git a/SemanticData/UANodeSetValidation/IAddressSpaceBuildContext.cs b/SemanticData/UANodeSetValidation/IAddressSpaceBuildContext.cs index d572af0d..29afed4b 100644 --- a/SemanticData/UANodeSetValidation/IAddressSpaceBuildContext.cs +++ b/SemanticData/UANodeSetValidation/IAddressSpaceBuildContext.cs @@ -1,6 +1,6 @@ //___________________________________________________________________________________ // -// Copyright (C) 2019, Mariusz Postol LODZ POLAND. +// Copyright (C) 2021, Mariusz Postol LODZ POLAND. // // To be in touch join the community at GITTER: https://gitter.im/mpostol/OPC-UA-OOI //___________________________________________________________________________________ @@ -15,11 +15,10 @@ namespace UAOOI.SemanticData.UANodeSetValidation { /// - /// Interface IAddressSpaceBuildContext Address Space Context used during build operation + /// Interface IAddressSpaceBuildContext representing the Address Space Context used during build operation /// internal interface IAddressSpaceBuildContext { - /// /// Exports the browse name if it is not default value, otherwise null. /// @@ -27,46 +26,55 @@ internal interface IAddressSpaceBuildContext /// The default value. /// XmlQualifiedName. XmlQualifiedName ExportBrowseName(NodeId id, NodeId defaultValue); + /// /// Exports the argument for a method. /// /// The argument - it defines a Method input or output argument specification. It is for example used in the input and output argument Properties for Methods. /// Type of the data. Parameter ExportArgument(DataSerialization.Argument argument, XmlQualifiedName dataType); + /// /// Gets the or create node context. /// /// The node identifier. - /// Delegated capturing functionality to create ua model context. + /// Delegated capturing functionality to create UA model context. /// Returns an instance of . IUANodeContext GetOrCreateNodeContext(NodeId nodeId, Func createUAModelContext); + /// /// Gets the namespace value as the . /// /// Index of the namespace. /// The namespace of the index pointed out by the string GetNamespace(ushort namespaceIndex); + /// /// Gets my references. /// - /// The index. - /// IEnumerable<UAReferenceContext>. - IEnumerable GetMyReferences(IUANodeBase index); + /// The source node + /// Returns containing references attached to the . + IEnumerable GetMyReferences(IUANodeBase node); + /// /// Gets the references to me. /// - /// The node. - /// All references targeting the selected by the node - IEnumerable GetReferences2Me(IUANodeContext node); + /// The node in concern. + /// All references targeting the node + IEnumerable GetReferences2Me(IUANodeBase node); + /// - /// Gets the children nodes for the . + /// Gets the children nodes ( or ) for the . /// - /// The root node of the requested children. - /// Return an instance of capturing all children of the selected node. - IEnumerable GetChildren(IUANodeContext rootNode); + /// The root node of the requested children. + /// Return an instance of capturing all children of the selected node. + IEnumerable GetChildren(IUANodeBase node); - Parameter ExportArgument(DataSerialization.Argument argument); + /// + /// Exports the argument. + /// + /// The argument. + /// An instance encapsulating . + Parameter ExportArgument(Argument argument); } - - -} +} \ No newline at end of file