IVertexToVertex() защищенный статический Метод

protected static IVertexToVertex ( IVertex oVertex, String sClassName, String sMethodOrPropertyName ) : Vertex
oVertex IVertex
sClassName String
sMethodOrPropertyName String
Результат Vertex
Пример #1
0
        EdgeToVertices
        (
            IEdge oEdge,
            String sClassName,
            String sMethodOrPropertyName,
            out Vertex oVertex1,
            out Vertex oVertex2
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(sClassName));
            Debug.Assert(!String.IsNullOrEmpty(sMethodOrPropertyName));

            // Cast to an Edge.

            Edge oEdge2 = IEdgeToEdge(oEdge, sClassName, sMethodOrPropertyName);

            // Cast the IVertex interfaces to Vertex, checking the types in the
            // process.

            oVertex1 = Vertex.IVertexToVertex(
                oEdge2.m_oVertex1, sClassName, sMethodOrPropertyName);

            oVertex2 = Vertex.IVertexToVertex(
                oEdge2.m_oVertex2, sClassName, sMethodOrPropertyName);
        }
Пример #2
0
        Clear()
        {
            AssertValid();

            const String MethodName = "Clear";

            // Do not just clear m_oLinkedList.  This would remove the vertices
            // from the collection, but each vertex, which can continue to exist
            // after being removed from the graph, would still have a group of
            // incident edges that are no longer valid.

            foreach (IVertex oVertex in this)
            {
                // Tell the Vertex that it no longer has any incident edges or a
                // parent.

                Vertex oVertex2 = Vertex.IVertexToVertex(
                    oVertex, this.ClassName, MethodName);

                oVertex2.FirstIncidentEdgeNode = null;

                oVertex2.SetParentGraph(null);
            }

            // Remove all vertices.

            m_oLinkedList.Clear();

            // Remove all incident edges from all vertices.

            m_oParentGraph.Edges.Clear();

            AssertValid();
        }
Пример #3
0
        Add
        (
            IVertex vertex
        )
        {
            AssertValid();

            ArgumentChecker oArgumentChecker = this.ArgumentChecker;
            const String    MethodName       = "Add";
            const String    ArgumentName     = "vertex";

            oArgumentChecker.CheckArgumentNotNull(
                MethodName, ArgumentName, vertex);

            // Check whether the vertex already belongs to a graph.

            if (vertex.ParentGraph != null)
            {
                oArgumentChecker.ThrowArgumentException(MethodName, ArgumentName,

                                                        "The vertex already belongs to a graph.  A vertex can't be"
                                                        + " added twice."
                                                        );
            }

            // The vertex is valid.  Add it to the collection.

            m_oLinkedList.AddLast(vertex);

            // Set the vertex's parent graph.

            Vertex oVertex = Vertex.IVertexToVertex(
                vertex, this.ClassName, MethodName);

            oVertex.SetParentGraph(m_oParentGraph);

            // Fire a VertexAdded event if necessary.

            VertexEventHandler oVertexAdded = this.VertexAdded;

            if (oVertexAdded != null)
            {
                oVertexAdded(this, new VertexEventArgs(vertex));
            }

            AssertValid();
        }
Пример #4
0
        Remove
        (
            LinkedListNode <IVertex> oLinkedListNode
        )
        {
            AssertValid();
            Debug.Assert(oLinkedListNode != null);

            const String MethodName = "Remove";

            // Cast to a Vertex.

            Vertex oVertex = Vertex.IVertexToVertex(
                oLinkedListNode.Value, this.ClassName, MethodName);

            // Remove the vertex's incident edges.

            oVertex.RemoveIncidentEdges();

            // Now remove the node from the list.

            m_oLinkedList.Remove(oLinkedListNode);

            // The vertex no longer has a parent graph.

            oVertex.SetParentGraph(null);

            // Fire a VertexRemoved event if necessary.

            VertexEventHandler oVertexRemoved = this.VertexRemoved;

            if (oVertexRemoved != null)
            {
                oVertexRemoved(this, new VertexEventArgs(oVertex));
            }

            AssertValid();
        }