This class is used to represent a node object.
Inheritance: StreamObject
コード例 #1
0
            /// <summary>
            /// This method is used to build  a list of DataElement from an node object.
            /// </summary>
            /// <param name="node">Specify the node object.</param>
            /// <returns>Return the list of data elements build from the specified node object.</returns>
            public List <DataElement> Build(NodeObject node)
            {
                List <DataElement> dataElements = new List <DataElement>();

                this.TravelNodeObject(node, ref dataElements);
                return(dataElements);
            }
コード例 #2
0
            /// <summary>
            /// This method is used to create ObjectGroupObjectDeclare instance from a node object.
            /// </summary>
            /// <param name="node">Specify the node object.</param>
            /// <returns>Return the ObjectGroupObjectDeclare instance.</returns>
            private ObjectGroupObjectDeclare CreateObjectDeclare(NodeObject node)
            {
                ObjectGroupObjectDeclare objectGroupObjectDeclare = new ObjectGroupObjectDeclare();

                objectGroupObjectDeclare.ObjectExtendedGUID    = node.ExGuid;
                objectGroupObjectDeclare.ObjectPartitionID     = new Compact64bitInt(1u);
                objectGroupObjectDeclare.CellReferencesCount   = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectReferencesCount = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectDataSize        = new Compact64bitInt((ulong)node.GetContent().Count);

                return(objectGroupObjectDeclare);
            }
コード例 #3
0
            /// <summary>
            /// This method is used to travel the node tree and build the ObjectGroupDataElementData and the extra data element list.
            /// </summary>
            /// <param name="node">Specify the object node.</param>
            /// <param name="dataElements">Specify the list of data elements.</param>
            private void TravelNodeObject(NodeObject node, ref List <DataElement> dataElements)
            {
                if (node is IntermediateNodeObject)
                {
                    ObjectGroupDataElementData data = new ObjectGroupDataElementData();
                    data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(node));
                    data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(node as IntermediateNodeObject));

                    dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));

                    foreach (LeafNodeObject child in (node as IntermediateNodeObject).IntermediateNodeObjectList)
                    {
                        this.TravelNodeObject(child, ref dataElements);
                    }
                }
                else if (node is LeafNodeObject)
                {
                    LeafNodeObject intermediateNode = node as LeafNodeObject;

                    ObjectGroupDataElementData data = new ObjectGroupDataElementData();
                    data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(node));
                    data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(intermediateNode));

                    if (intermediateNode.DataNodeObjectData != null)
                    {
                        data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(intermediateNode.DataNodeObjectData));
                        data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(intermediateNode.DataNodeObjectData));
                        dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));
                        return;
                    }

                    if (intermediateNode.DataNodeObjectData == null && intermediateNode.IntermediateNodeObjectList != null)
                    {
                        dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));

                        foreach (LeafNodeObject child in intermediateNode.IntermediateNodeObjectList)
                        {
                            this.TravelNodeObject(child, ref dataElements);
                        }

                        return;
                    }

                    throw new System.InvalidOperationException("The DataNodeObjectData and IntermediateNodeObjectList properties in LeafNodeObjectData type cannot be null in the same time.");
                }
            }
コード例 #4
0
            /// <summary>
            /// This method is used to create ObjectGroupObjectDeclare instance from a node object.
            /// </summary>
            /// <param name="node">Specify the node object.</param>
            /// <returns>Return the ObjectGroupObjectDeclare instance.</returns>
            private ObjectGroupObjectDeclare CreateObjectDeclare(NodeObject node)
            {
                ObjectGroupObjectDeclare objectGroupObjectDeclare = new ObjectGroupObjectDeclare();

                objectGroupObjectDeclare.ObjectExtendedGUID = node.ExGuid;
                objectGroupObjectDeclare.ObjectPartitionID = new Compact64bitInt(1u);
                objectGroupObjectDeclare.CellReferencesCount = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectReferencesCount = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectDataSize = new Compact64bitInt((ulong)node.GetContent().Count);

                return objectGroupObjectDeclare;
            }
コード例 #5
0
            /// <summary>
            /// This method is used to travel the node tree and build the ObjectGroupDataElementData and the extra data element list.
            /// </summary>
            /// <param name="node">Specify the object node.</param>
            /// <param name="dataElements">Specify the list of data elements.</param>
            private void TravelNodeObject(NodeObject node, ref List<DataElement> dataElements)
            {
                if (node is RootNodeObject)
                {
                    ObjectGroupDataElementData data = new ObjectGroupDataElementData();
                    data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(node));
                    data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(node as RootNodeObject));

                    dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));

                    foreach (IntermediateNodeObject child in (node as RootNodeObject).IntermediateNodeObjectList)
                    {
                        this.TravelNodeObject(child, ref dataElements);
                    }
                }
                else if (node is IntermediateNodeObject)
                {
                    IntermediateNodeObject intermediateNode = node as IntermediateNodeObject;

                    ObjectGroupDataElementData data = new ObjectGroupDataElementData();
                    data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(node));
                    data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(intermediateNode));

                    if (intermediateNode.DataNodeObjectData != null)
                    {
                        data.ObjectGroupDeclarations.ObjectDeclarationList.Add(this.CreateObjectDeclare(intermediateNode.DataNodeObjectData));
                        data.ObjectGroupData.ObjectGroupObjectDataList.Add(this.CreateObjectData(intermediateNode.DataNodeObjectData));
                        dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));
                        return;
                    }

                    if (intermediateNode.DataNodeObjectData == null && intermediateNode.IntermediateNodeObjectList != null)
                    {
                        dataElements.Add(new DataElement(DataElementType.ObjectGroupDataElementData, data));

                        foreach (IntermediateNodeObject child in intermediateNode.IntermediateNodeObjectList)
                        {
                            this.TravelNodeObject(child, ref dataElements);
                        }

                        return;
                    }
                   
                    throw new System.InvalidOperationException("The DataNodeObjectData and IntermediateNodeObjectList properties in IntermediateNodeObject type cannot be null in the same time.");
                }
            }
コード例 #6
0
 /// <summary>
 /// This method is used to build  a list of DataElement from an node object.
 /// </summary>
 /// <param name="node">Specify the node object.</param>
 /// <returns>Return the list of data elements build from the specified node object.</returns>
 public List<DataElement> Build(NodeObject node)
 {
     List<DataElement> dataElements = new List<DataElement>();
     this.TravelNodeObject(node, ref dataElements);
     return dataElements;
 }