public TextTree ConvertToCMOrderedTreeMinerTree(ICommonTree tree)
        {
            ICommonTreeNode root = tree.Root;
            Int32           size = (Int32)TreeUtil.SizeOfTree(root);

            textTree = new TextTree(tree.SourceTag, size);

            lastIndex = -1;
            VisitChild(root);

            return(textTree);
        }
Exemple #2
0
        public static string StringRepresentation(this ICommonTree tree, bool includeSourceTag = true)
        {
            if (tree == null)
            {
                throw new ArgumentNullException(nameof(tree));
            }

            var sb = new StringBuilder();

            if (includeSourceTag)
            {
                sb.AppendLine($"Tree: {tree.SourceTag}");
            }
            StringRepresentationRec(sb, tree.Root);
            sb.Length -= 1;
            return(sb.ToString());
        }
Exemple #3
0
 public static int NumberOfNodesStartingWithSubstring(ICommonTree tree, string substring) => NumberOfNodesStartingWithSubstring(tree.Root, substring);
Exemple #4
0
 public static int NumberOfNodesContainingSubstring(ICommonTree tree, string substring) => NumberOfNodesContainingSubstring(tree.Root, substring);
Exemple #5
0
 public static int SizeOfTree(ICommonTree tree) => SizeOfTree(tree.Root);
Exemple #6
0
 public static bool IsEqual(ICommonTree tree1, ICommonTree tree2) => IsEqual(tree1.Root, tree2.Root);
Exemple #7
0
 public TreePatternMatches(ICommonTree pattern, IEnumerable <string> locations)
 {
     Pattern = pattern;
     MatchLocations.UnionWith(locations);
 }