예제 #1
0
        public static List <string> AppendNodeAndChildren(IEnumerable <IGraphNode> nodes, NodeMetadata metadata)
        {
            var result = new List <string>();

            foreach (var node in nodes)
            {
                DotGraph.ProcessTree(node, result, AppendFunctionalPipe, delegate { }, metadata);
            }

            return(result);
        }
예제 #2
0
        public static List <string> AppendRankings(IEnumerable <IGraphNode> nodes, NodeMetadata metadata)
        {
            var result = new List <string>();

            foreach (var node in nodes)
            {
                DotGraph.ProcessTree(node, result, delegate { }, ProcessChildRanking, metadata);
            }

            return(result);
        }
        public static StringBuilder AppendFormatting(IEnumerable <IGraphNode> nodes, NodeMetadata metadata)
        {
            void ProcessNode(IGraphNode node_, NodeMetadata metadata_, StringBuilder result_)
            {
                var genericTypeDefinition = node_.GetType().GetGenericTypeDefinition();

                if (!PipeAppendersByType.ContainsKey(genericTypeDefinition))
                {
                    throw new NotImplementedException(
                              $@"No DotGraph formatting for {node_.GetType().ToReadableString()}");
                }

                PipeAppendersByType[genericTypeDefinition](node_, metadata_, result_);
            }

            var result = new StringBuilder();

            foreach (var node in nodes)
            {
                DotGraph.ProcessTree(node, result, ProcessNode, delegate { }, metadata);
            }

            return(result);
        }