public virtual ISolutionTreeNode FindTreeNode(ITreeNodePath path) { if (path == null) { return(null); } if (path.IsEqual(Path)) { return(this); } foreach (ISolutionTreeNode Child in Children) { if (path.IsEqual(Child.Path)) { return(Child); } ISolutionFolder AsFolder; if ((AsFolder = Child as ISolutionFolder) != null) { ISolutionTreeNode TreeNode = AsFolder.FindTreeNode(path); if (TreeNode != null) { return(TreeNode); } } } return(null); }
string NodeToString(ISolutionTreeNode node) { var stringBuilder = new System.Text.StringBuilder(); nodePrinter(stringBuilder, node); return(stringBuilder.ToString()); }
string NodeToString (ISolutionTreeNode node) { var stringBuilder = new System.Text.StringBuilder (); nodePrinter (stringBuilder, node); return stringBuilder.ToString (); }
private void ChangeName(string Name) { ISolutionTreeNode Node = Root.FindTreeNode(Path); Assert.CheckCondition(Node != null); Node.ChangeName(Name); }
public static void PrintDcgNode (System.Text.StringBuilder stringBuilder, ISolutionTreeNode node) { Goal goal = node.HeadGoal; string predicate = goal.Definition.Predicate.Name; if (predicate != "concat") { stringBuilder.Append (predicate); stringBuilder.Append ("("); stringBuilder.Append (string.Join(", ", goal.Arguments.Where(a => !(a.ConcreteValue is List)).Select (new ArgumentPrinter().Print))); stringBuilder.Append (")"); } }
public static void PrintDcgNode(System.Text.StringBuilder stringBuilder, ISolutionTreeNode node) { Goal goal = node.HeadGoal; string predicate = goal.Definition.Predicate.Name; if (predicate != "concat") { stringBuilder.Append(predicate); stringBuilder.Append("("); stringBuilder.Append(string.Join(", ", goal.Arguments.Where(a => !(a.ConcreteValue is List)).Select(new ArgumentPrinter().Print))); stringBuilder.Append(")"); } }
private void ChangeParent(ISolutionFolder oldParent, ISolutionFolder newParent) { ISolutionTreeNode Node = Root.FindTreeNode(Path); Assert.CheckCondition(Node != null); ISolutionTreeNodeCollection OldChildrenCollection = (ISolutionTreeNodeCollection)oldParent.Children; OldChildrenCollection.Remove(Node); ISolutionTreeNodeCollection NewChildrenCollection = (ISolutionTreeNodeCollection)newParent.Children; NewChildrenCollection.Add(Node); NewChildrenCollection.Sort(); }
// ReSharper disable ParameterTypeCanBeEnumerable.Local private void SolutionTreeToString (ISolutionTreeNode solution, int level) // ReSharper restore ParameterTypeCanBeEnumerable.Local { foreach (var node in solution) { string s = NodeToString (node); if (!string.IsNullOrWhiteSpace (s)) { sb.Append (new string (' ', level * 4)); sb.AppendLine (s); } SolutionTreeToString (node, level + 1); } }
// ReSharper disable ParameterTypeCanBeEnumerable.Local private void SolutionTreeToString(ISolutionTreeNode solution, int level) // ReSharper restore ParameterTypeCanBeEnumerable.Local { foreach (var node in solution) { string s = NodeToString(node); if (!string.IsNullOrWhiteSpace(s)) { sb.Append(new string (' ', level * 4)); sb.AppendLine(s); } SolutionTreeToString(node, level + 1); } }
public static void Print (System.Text.StringBuilder sb, ISolutionTreeNode frame) { Print (frame.HeadGoal, sb); }
public static void Print(System.Text.StringBuilder sb, ISolutionTreeNode frame) { Print(frame.HeadGoal, sb); }
public static string SolutionTreeToString (ISolutionTreeNode solution) { return new SolutionTreePrinter ().Print (solution); }
static void PrintNode(System.Text.StringBuilder stringBuilder, ISolutionTreeNode node) { Print(stringBuilder, node); }
public string Print (ISolutionTreeNode solution) { SolutionTreeToString (solution, 0); return sb.ToString (); }
static void PrintNode (System.Text.StringBuilder stringBuilder, ISolutionTreeNode node) { Print (stringBuilder, node); }
private static string Print(ISolutionTreeNode solution) { return(new SolutionTreePrinter(SolutionTreePrinter.PrintDcgNode).Print(solution)); }
public Enter(ISolutionTreeNode node) { this.node = node; }
public Leave (ISolutionTreeNode node) { this.node = node; }
public Solution (ISolutionTreeNode tree) { this.tree = tree; }
public Enter (ISolutionTreeNode node) { this.node = node; }
public static string SolutionTreeToString(ISolutionTreeNode solution) { return(new SolutionTreePrinter().Print(solution)); }
public Solution(ISolutionTreeNode tree) { this.tree = tree; }
public string Print(ISolutionTreeNode solution) { SolutionTreeToString(solution, 0); return(sb.ToString()); }
public Leave(ISolutionTreeNode node) { this.node = node; }
private static string Print (ISolutionTreeNode solution) { return new SolutionTreePrinter (SolutionTreePrinter.PrintDcgNode).Print (solution); }