예제 #1
0
        private void processInsertEdgeCommand(Command command)
        {
            var parameters         = command.GetParameters();
            var commandClientID    = command.__getClientID();
            var verticesDictionary = graph_.__getVerticesDictionary();

            var fromVertex = verticesDictionary.Find(FullID.FromString(parameters[0]));
            var endVertex  = verticesDictionary.Find(FullID.FromString(parameters[1]));

            if (fromVertex == null || endVertex == null)
            {
                return;
            }

            if (fromVertex.IsConnectedTo(endVertex))
            {
                return;
            }

            var edgeFullID = new FullID(commandClientID, int.Parse(parameters[2]));

            Edge edge = fromVertex.__connectTo(endVertex, edgeFullID);

            if (graph_.IsLoading() && commandClientID == graph_.__getClientID())
            {
                graph_.__setLastCreatedEdgeID(edgeFullID.GetIDinCreator());
            }

            graph_.__raiseEdgeAddedEvent(edge);
        }
예제 #2
0
        public Edge ConnectTo(Vertex endVertex)
        {
            int edgeClientID    = graph_.__getClientID();
            int edgeIDinCreator = graph_.__getLastCreatedEdgeID() + 1;

            graph_.__setLastCreatedEdgeID(edgeIDinCreator);

            var edge = __connectTo(endVertex, new FullID(edgeClientID, edgeIDinCreator));

            graph_.__getCommandSender().__sendInsertEdgeCommand(edge);

            return(edge);
        }