void RenderRefinement(Obstacle o)
        {
            foreach (var refinement in o.Refinements()) {
                foreach (var child in refinement.SubObstacles ()) {
                    Render (child);
                    RenderRefinement (child);

                    foreach (var resolution in child.Resolutions ()) {
                        Render (resolution.ResolvingGoal ());
                        Render (resolution);
                    }
                }
                Render (refinement);
            }
        }
Пример #2
0
        public void ExportRefinementRecursively(Obstacle o, bool exportObstacle = false)
        {
            if (o.Refinements().Count() > 0) {
                writer.WriteLine ();
                writer.WriteLine ("# Refinement for obstacle '{0}'", o.Name);
                writer.WriteLine ();
            }

            if (exportObstacle)
                ExportObstacle (o);
            foreach (var r in o.Refinements()) {
                ExportRefinement (o, r);

                foreach (var child in r.SubObstacles()) {
                    ExportRefinementRecursively (child, exportObstacle);
                }
            }
        }
Пример #3
0
 public void ExportObstacle(Obstacle o)
 {
     var name = new StringBuilder (o.Name);
     if (name.Length > 30) {
         var midspace = o.Name.IndexOf (' ', (o.Name.Length / 2) - 1);
         name.Replace (" ", @"\n", midspace, 1);
     }
     writer.WriteLine (@"""{0}"" [shape=polygon,skew=-.1,label=""{1}"",style=filled,fillcolor=""#ffa9ad"",penwidth={2},fontname=""HelveticaNeue"",fontsize=9,margin=""-.2,0""];",
                       o.Identifier, name, o.Refinements().Count() == 0 ? 2 : 1);
 }
        static void RecursiveIntegration(Goal obstructedGoal, Obstacle obstacle)
        {
            foreach (var resolution in obstacle.Resolutions().ToArray ()) {
                Integrate (obstructedGoal, obstacle, resolution);
            }

            foreach (var subobstacle in obstacle.Refinements().SelectMany (x => x.SubObstacles()).ToArray ()) {
                RecursiveIntegration (obstructedGoal, subobstacle);
            }
        }
Пример #5
0
        public static IEncodedString GetPartialObstacleDiagram(Obstacle o)
        {
            var view = new PartialModelView ();
            view.Add (o);

            foreach (var r in o.ParentRefinements ()) {
                view.Add (r);
                view.Add (r.ParentObstacle ());
            }

            foreach (var r in o.Refinements()) {
                view.Add (r);
                foreach (var gg in r.SubObstacles ()) {
                    view.Add (gg);
                }
                foreach (var gg in r.DomainProperties ()) {
                    view.Add (gg);
                }
                foreach (var gg in r.DomainHypotheses ()) {
                    view.Add (gg);
                }
            }

            foreach (var r in o.Obstructions ()) {
                view.Add (r);
                view.Add (r.ObstructedGoal ());
            }

            foreach (var r in o.Resolutions ()) {
                view.Add (r);
                view.Add (r.ResolvingGoal ());
            }

            var stream1 = new MemoryStream();
            var ser = new DataContractJsonSerializer(typeof(PartialModelView));
            ser.WriteObject(stream1, view);
            stream1.Position = 0;
            StreamReader sr = new StreamReader(stream1);
            return new RawString (sr.ReadToEnd());
        }
Пример #6
0
        void DownPropagate(Obstacle obstacle)
        {
            foreach (var childRefinement in obstacle.Refinements()) {
                DownPropagate (obstacle, childRefinement);
            }

            foreach (var resolution in obstacle.Resolutions()) {
                DownPropagate (obstacle, resolution.ResolvingGoal());
            }
        }