本文整理汇总了C#中Goal.Refinements方法的典型用法代码示例。如果您正苦于以下问题:C# Goal.Refinements方法的具体用法?C# Goal.Refinements怎么用?C# Goal.Refinements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Goal
的用法示例。
在下文中一共展示了Goal.Refinements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSimple
public void TestSimple()
{
var model = new GoalModel ();
var ag1 = new Agent ();
var ag2 = new Agent ();
var ag3 = new Agent ();
var ag4 = new Agent ();
var rootG = new Goal() { Name = "G" };
model.Goals().Add (rootG);
var G1 = new Goal() { Name = "G1" };
var G2 = new Goal() { Name = "G2" };
var G3 = new Goal() { Name = "G3" };
var G4 = new Goal() { Name = "G4" };
model.Goals().Add (G1);
model.Goals().Add (G2);
model.Goals().Add (G3);
model.Goals().Add (G4);
G1.AgentAssignments.Add (new AgentAssignment (ag1));
G2.AgentAssignments.Add (new AgentAssignment (ag2));
G3.AgentAssignments.Add (new AgentAssignment (ag3));
G4.AgentAssignments.Add (new AgentAssignment (ag4));
var alt1 = new AlternativeSystem () { Name = "Alt1" };
var alt2 = new AlternativeSystem () { Name = "Alt2" };
model.Systems.Add (alt1);
model.Systems.Add (alt2);
rootG.Refinements().Add (new GoalRefinement (G1, G2, G3) { SystemReference = alt1 });
rootG.Refinements().Add (new GoalRefinement (G3, G4) { SystemReference = alt2 });
var h = new AlternativeHelpers(); h.ComputeInAlternatives (model);
Console.WriteLine ("G1: " + string.Join(", ", G1.InSystems.Select (x => x.Name)));
Console.WriteLine ("G2: " + string.Join(", ", G2.InSystems.Select (x => x.Name)));
Console.WriteLine ("G3: " + string.Join(", ", G3.InSystems.Select (x => x.Name)));
Console.WriteLine ("G4: " + string.Join(", ", G4.InSystems.Select (x => x.Name)));
G1.InSystems.ShallOnlyContain (new AlternativeSystem[] { alt1 });
G2.InSystems.ShallOnlyContain (new AlternativeSystem[] { alt1 });
G3.InSystems.ShallOnlyContain (new AlternativeSystem[] { alt1, alt2 });
G4.InSystems.ShallOnlyContain (new AlternativeSystem[] { alt2 });
}