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


C# Plan.addConstraint方法代码示例

本文整理汇总了C#中Plan.addConstraint方法的典型用法代码示例。如果您正苦于以下问题:C# Plan.addConstraint方法的具体用法?C# Plan.addConstraint怎么用?C# Plan.addConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plan的用法示例。


在下文中一共展示了Plan.addConstraint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: makePlan

    // Extract a plan for resatisfaction starting from the given source
    // constraints, usually a set of input constraints. This method
    // assumes that stay optimization is desired; the plan will contain
    // only constraints whose output variables are not stay. Constraints
    // that do no computation, such as stay and edit constraints, are
    // not included in the plan.
    // Details: The outputs of a constraint are marked when it is added
    // to the plan under construction. A constraint may be appended to
    // the plan when all its input variables are known. A variable is
    // known if either a) the variable is marked (indicating that has
    // been computed by a constraint appearing earlier in the plan), b)
    // the variable is 'stay' (i.e. it is a constant at plan execution
    // time), or c) the variable is not determined by any
    // constraint. The last provision is for past states of history
    // variables, which are not stay but which are also not computed by
    // any constraint.
    // Assume: sources are all satisfied.
    //
    public Plan makePlan(ArrayList sources)
    {
        int mark = newMark();
        Plan plan = new Plan();
        ArrayList todo = sources;
        while (!(todo.Count == 0))
        {
#if USE_STACK
            Constraint c = (Constraint)todo[todo.Count - 1];
            todo.RemoveAt(todo.Count - 1);
#else
            Constraint c= (Constraint)todo[todo.Count-1];
            todo.RemoveAt(0);
#endif
            if (c.output().mark != mark && c.inputsKnown(mark))
            {
                // not in plan already and eligible for inclusion
                plan.addConstraint(c);
                c.output().mark = mark;
                addConstraintsConsumingTo(c.output(), todo);
            }
        }
        return plan;
    }
开发者ID:Smith-yue,项目名称:coreclr,代码行数:42,代码来源:DeltaBlue.cs


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