Esempio n. 1
0
            public void Remove(CyclicNode <EdgeModel> node)
            {
                var iterFromNodes = new HashSet <HashedWeakReference <SomeGraphNode <EdgeModel> > >(node.FromNodes);

                foreach (HashedWeakReference <SomeGraphNode <EdgeModel> > fromNodeReference in iterFromNodes)
                {
                    if (fromNodeReference.Reference.TryGetTarget(out SomeGraphNode <EdgeModel> fromNode))
                    {
                        fromNode.RemoveEdgesTo(node);
                    }
                }

                var iterEdges = new List <SomeGraphNode <EdgeModel> .Edge>(node.Edges);

                foreach (SomeGraphNode <EdgeModel> .Edge edge in iterEdges)
                {
                    node.RemoveEdge(edge);
                }

                if (node == RootNode)
                {
                    RootNode = null;
                }
                nodes.Remove(node);
            }
Esempio n. 2
0
            public void AddEdge(CyclicNode <EdgeModel> fromNode, EdgeModel model, CyclicNode <EdgeModel> toNode)
            {
                if (null == fromNode || null == toNode)
                {
                    return;
                }

                fromNode.AddEdgeInternal(model, new WeakReferenceType <SomeGraphNode <EdgeModel> >(toNode));

                nodes.Add(fromNode);
                nodes.Add(toNode);
            }