private static void CompareTressAndCreateEdges(SyntakTreeDecorator fromTree, SyntakTreeDecorator tooTree, List <Edge> transitionEdges) { if (fromTree == null || fromTree.childs == null) { return; } var thisLevelsEdges = new List <Edge>(); var tooList = new List <SyntakTreeDecorator>(); var notFound = new List <SyntakTreeDecorator>(); foreach (var from in fromTree.childs) { if (tooTree == null || tooTree.childs == null) { notFound.Add(from); continue; // probally deleted } var to = TreeComparison.FindBelongingThing(from, tooTree.childs); if (to != null) { if (tooList.Contains(to.treeNode)) { // used twice ... potential Bug DebugHelper.BreakIntoDebug(); } tooList.Add(to.treeNode); if (!to.wasModified) { transitionEdges.Add(new Edge(from.equivilantGraphNode, to.treeNode.equivilantGraphNode, Edge.EdgeType.NoCodeChange)); continue; } else { switch (to.howModified) { case ModificationKind.nameChanged: transitionEdges.Add(new Edge(from.equivilantGraphNode, to.treeNode.equivilantGraphNode, Edge.EdgeType.CodeChangedRename)); break; default: transitionEdges.Add(new Edge(from.equivilantGraphNode, to.treeNode.equivilantGraphNode, Edge.EdgeType.CodeChanged)); break; } } CompareTressAndCreateEdges(from, to.treeNode, transitionEdges); } else { // probally deleted notFound.Add(from); } } // track which kinds where found ... rest was probably created // todo: I should realy unit-test this. }