Beispiel #1
0
        // Given a mediation node, creates an HTML representation.
        public static void ToHTML(string directory, PlanSpaceNode root)
        {
            string file = directory + root.id + ".html";

            using (StreamWriter writer = new StreamWriter(file, false))
            {
                writer.WriteLine("<html>");
                writer.WriteLine("<body>");
                if (root.incoming != null)
                {
                    //writer.WriteLine("Threatened Link: " + root.incoming.clobberedLink.Predicate.ToString(root.incoming.clobberedLink.Head.Bindings) + "<br />");
                    writer.WriteLine("Exceptional Step: " + root.incoming.action + "<br />");
                    writer.WriteLine("Establishing Step: " + root.incoming.clobberedLink.Tail + "<br />");
                    writer.WriteLine("Clobbered Step: " + root.incoming.clobberedLink.Head + "<br />");
                }
                else
                {
                    writer.WriteLine("No threatened link.<br />");
                    writer.WriteLine("No exceptional step.<br />");
                    writer.WriteLine("No clobbered step.<br />");
                }
                StateToHTML(directory, root);
                writer.WriteLine("<a href='" + root.id + "state.html' target='_blank'>Initial State</a><br />");
                PlanToHTML(directory, root);
                writer.WriteLine("<a href='" + root.id + "plan.html' target='_blank'>Plan</a><br />");
                if (root.parent != null)
                {
                    writer.WriteLine("<br />Parent Node:<br />");
                    writer.WriteLine("<a href='" + root.parent.id + ".html'>Parent ID " + root.parent.id + "</a><br />");
                }
                if (root.children.Count > 0)
                {
                    writer.WriteLine("<br />Children Nodes:<br />");
                    foreach (PlanSpaceEdge action in root.outgoing)
                    {
                        PlanSpaceNode child = (PlanSpaceNode)root.children[action];
                        writer.WriteLine("<a href='" + child.id + ".html'>Child ID " + child.id + "</a><br />");
                    }
                }
                writer.WriteLine("</body>");
                writer.WriteLine("</html>");
            }

            foreach (PlanSpaceNode child in root.children.Values)
            {
                ToHTML(directory, child);
            }
        }
Beispiel #2
0
        // Given a mediation node, creates an HTML representation of its initial state.
        public static void StateToHTML(string directory, PlanSpaceNode root)
        {
            string file = directory + root.id + "state.html";

            using (StreamWriter writer = new StreamWriter(file, false))
            {
                writer.WriteLine("<html>");
                writer.WriteLine("<body>");
                foreach (Predicate pred in root.problem.Initial)
                {
                    writer.WriteLine(pred + "<br />");
                }
                writer.WriteLine("</body>");
                writer.WriteLine("</html>");
            }
        }
Beispiel #3
0
        // Given a mediation node, creates an HTML representation of its plan.
        public static void PlanToHTML(string directory, PlanSpaceNode root)
        {
            string file = directory + root.id + "plan.html";

            using (StreamWriter writer = new StreamWriter(file, false))
            {
                writer.WriteLine("<html>");
                writer.WriteLine("<body>");
                foreach (Operator action in root.plan.Steps)
                {
                    if (!action.Name.Equals("initial") && !action.Name.Equals("goal"))
                    {
                        writer.WriteLine(action + "<br />");
                    }
                }
                writer.WriteLine("</body>");
                writer.WriteLine("</html>");
            }
        }