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()); }
public static IEncodedString GetPartialDomPropDiagram(DomainProperty domprop) { var view = new PartialModelView (); view.Add (domprop); foreach (var r in domprop.GoalRefinements ()) { view.Add (r); view.Add (r.ParentGoal ()); foreach (var gg in r.SubGoals ()) { 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 domprop.ObstacleRefinements ()) { view.Add (r); view.Add (r.ParentObstacle ()); foreach (var gg in r.SubObstacles ()) { view.Add (gg); } } 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()); }
public static IEncodedString GetPartialGoalDiagram(Goal g) { var view = new PartialModelView (); view.Add (g); foreach (var r in g.ParentRefinements ()) { view.Add (r); view.Add (r.ParentGoal ()); } foreach (var r in g.Refinements()) { view.Add (r); foreach (var gg in r.SubGoals ()) { view.Add (gg); } foreach (var gg in r.DomainProperties ()) { view.Add (gg); } foreach (var gg in r.DomainHypotheses ()) { view.Add (gg); } } foreach (var o in g.Obstructions ()) { view.Add (o); view.Add (o.Obstacle ()); } foreach (var a in g.AgentAssignments ()) { view.Add (a); foreach (var agent in a.Agents ()) { view.Add (agent); } } foreach (var r in g.Resolutions ()) { view.Add (r); view.Add (r.Obstacle ()); } /* foreach (var r in g.Exceptions ()) { view.Add (r); view.Add (r.Obstacle ()); 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()); }
public static IEncodedString GetPartialAgentDiagram(Agent a) { var view = new PartialModelView (); view.Add (a); foreach (var g in a.AssignedGoals ()) { view.Add (g); view.Add (g.Goal ()); } 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()); }