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()); }
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); } }
void DownPropagate(Obstacle obstacle) { foreach (var childRefinement in obstacle.Refinements()) { DownPropagate (obstacle, childRefinement); } foreach (var resolution in obstacle.Resolutions()) { DownPropagate (obstacle, resolution.ResolvingGoal()); } }