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); }
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()); }
public static int NumberOfNodesStartingWithSubstring(ICommonTree tree, string substring) => NumberOfNodesStartingWithSubstring(tree.Root, substring);
public static int NumberOfNodesContainingSubstring(ICommonTree tree, string substring) => NumberOfNodesContainingSubstring(tree.Root, substring);
public static int SizeOfTree(ICommonTree tree) => SizeOfTree(tree.Root);
public static bool IsEqual(ICommonTree tree1, ICommonTree tree2) => IsEqual(tree1.Root, tree2.Root);
public TreePatternMatches(ICommonTree pattern, IEnumerable <string> locations) { Pattern = pattern; MatchLocations.UnionWith(locations); }