예제 #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);
        }