当前位置: 首页>>代码示例>>C#>>正文


C# Goal.Refinements方法代码示例

本文整理汇总了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 });
        }
开发者ID:ancailliau,项目名称:KAOSTools,代码行数:46,代码来源:TestAlternativePropagation.cs


注:本文中的Goal.Refinements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。