private IList<IBooParseTreeNode> FlattenUp(IBooParseTreeNode node) { IList<IBooParseTreeNode> flattened = new IntellisenseNodeList(); IBooParseTreeNode parent = node; while ((parent = parent.Parent) != null) { foreach (IBooParseTreeNode sibling in parent.Children) { flattened.Add(sibling); } flattened.Add(parent); } return flattened; }
private IList<IBooParseTreeNode> FlattenDown(IList<IBooParseTreeNode> nodes) { BooParseTreeNodeList flattened = new IntellisenseNodeList(); foreach (IBooParseTreeNode node in nodes) { flattened.Add(node); flattened.AddRange(FlattenDown(node.Children)); } return flattened; }