• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Constraint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Constraint的典型用法代码示例。如果您正苦于以下问题:C# Constraint类的具体用法?C# Constraint怎么用?C# Constraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Constraint类属于命名空间,在下文中一共展示了Constraint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CSP

		public CSP(ArrayList variables, Constraint constraints, Domain domains) 
		{
			this.variables = variables;
			//this.assignment = new Assignment(variables);
			this.domains = domains;
			this.constraints = constraints;
		}
开发者ID:langeds,项目名称:aima,代码行数:7,代码来源:CSP.cs


示例2: Visit

 protected virtual void Visit(Constraint constraint)
 {
     switch (constraint.Type)
     {
         case ConstraintType.Empty:
             this.VisitEmpty(constraint as EmptyConstraint);
             break;
         case ConstraintType.Property:
             this.VisitProperty(constraint as PropertyConstraint);
             break;
         case ConstraintType.TwoPropertiesComparison:
             this.VisitTwoPropertiesComparison(constraint as TwoPropertiesConstraint);
             break;
         case ConstraintType.Sql:
             this.VisitSqlWhereConstraint(constraint as SqlWhereConstraint);
             break;
         case ConstraintType.AndOr:
             this.VisitAndOrConstraint(constraint as AndOrConstraint);
             break;
         case ConstraintType.Group:
             this.VisitGroup(constraint as ConstraintGroup);
             break;
         default:
             break;
     }
 }
开发者ID:569550384,项目名称:Rafy,代码行数:26,代码来源:ConstraintVisitor.cs


示例3: ConstraintToCatKind

 public CatKind ConstraintToCatKind(Constraint c)
 {
     if (c is ScalarVar)
     {
         return new CatTypeVar(c.ToString());
     }
     else if (c is VectorVar)
     {
         return new CatStackVar(c.ToString());
     }
     else if (c is Vector)
     {
         return CatTypeVectorFromVec(c as Vector);
     }
     else if (c is Relation)
     {
         return CatFxnTypeFromRelation(c as Relation);
     }
     else if (c is RecursiveRelation)
     {
         return new CatRecursiveType();
     }
     else if (c is Constant)
     {
         // TODO: deal with CatCustomKinds
         return new CatSimpleTypeKind(c.ToString());
     }
     else
     {
         throw new Exception("unhandled constraint " + c.ToString());
     }
 }
开发者ID:catb0t,项目名称:cat-language,代码行数:32,代码来源:CatTypeReconstructor.cs


示例4: GeneratedFromXMLPosture

        /// <summary>
        /// Constructs a Posture Recognizer from a XML-File
        /// </summary>
        /// <param name="name">name of the given Posture (same as the XML-Source-File)</param>
        /// <param name="XMLPath">full path of the XML-Source-File</param>
        public GeneratedFromXMLPosture(String name, String xmlPath)
            : base(name)
        {
            try
            {
                //Load the XML-Document in a new XmlDocument-Object
                XmlDocument constraintsXML = new XmlDocument();
                constraintsXML.Load(xmlPath);

                //put Angle-Nodes from the XML to a XMLNodeList-Object
                XmlNodeList xmlConstraintsList;
                XmlNode root = constraintsXML.DocumentElement;
                xmlConstraintsList = root.SelectNodes("//posture/constraints/angle");

                //xmlConstraintsList -> constraints
                foreach (XmlNode newConstraint in xmlConstraintsList)
                {
                    Constraint newOne = new Constraint();

                    newOne.JointA = newConstraint.ChildNodes[0].InnerText;
                    newOne.JointB = newConstraint.ChildNodes[1].InnerText;
                    newOne.JointC = newConstraint.ChildNodes[2].InnerText;
                    newOne.min = Convert.ToInt16(newConstraint.ChildNodes[3].InnerText);
                    newOne.max = Convert.ToInt16(newConstraint.ChildNodes[4].InnerText);

                    constraints.Add(newOne);
                }

            }
            catch (Exception e)
            {
                Console.WriteLine("Sorry, could not read " + xmlPath + ". StackTrace following." + e.StackTrace);
            }
        }
开发者ID:pi11e,项目名称:KinectHTML5,代码行数:39,代码来源:generatedFromXMLPosture.cs


示例5: No_PrimaryKey

 public void No_PrimaryKey()
 {
     var c = new Constraint("ix_testing", ContraintType.Index, "testing");
     var test = new Table("test");
     test.Constraints.Add(c);
     Assert.Null(test.PrimaryKey);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:7,代码来源:TableTests.cs


示例6: Column

 public Column(string name, DataType type, Constraint constraint, bool primaryKey)
 {
     Name = name;
     Type = type;
     Constraint = constraint;
     PrimaryKey = primaryKey;
 }
开发者ID:robertcoltheart,项目名称:Deploy,代码行数:7,代码来源:Column.cs


示例7: Set_PrimaryKey

 public void Set_PrimaryKey()
 {
     var c = new Constraint("ix_testing", ContraintType.PrimaryKey, "testing");
     var test = new Table("test");
     test.Constraints.Add(c);
     Assert.Equal(c, test.PrimaryKey);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:7,代码来源:TableTests.cs


示例8: Create

        internal void Create(int numConstraints)
        {
            Vector = new Constraint[numConstraints];

            // Initialize this to out of range.
            firstActiveConstraintIndex = numConstraints;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:ConstraintVector.cs


示例9: GetSet_Unique

 public void GetSet_Unique()
 {
     var test = new Constraint("test", ContraintType.Constraint, new List<string>());
     var c = test.Unique;
     test.Unique = !c;
     Assert.Equal(!c, test.Unique);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:7,代码来源:ConstraintTests.cs


示例10: CombineConstraint

        public Constraint CombineConstraint(Constraint other, System.Linq.Expressions.ExpressionType op)
        {
            BooleanCombinationConstraint combinedConstraint = new BooleanCombinationConstraint(op);

            combinedConstraint.AddConstraint(this);
            combinedConstraint.AddConstraint(other);

            return combinedConstraint;
        }
开发者ID:roniyud,项目名称:LINQWrapper,代码行数:9,代码来源:AtomicConstraint.cs


示例11: AttributeConstraint

        /// <summary>
        /// Constructs an AttributeConstraint for a specified attriute
        /// Type and base constraint.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="baseConstraint"></param>
        public AttributeConstraint(Type type, Constraint baseConstraint)
            : base(baseConstraint)
        {
            this.expectedType = type;

            if (!typeof(Attribute).IsAssignableFrom(expectedType))
                throw new ArgumentException(string.Format(
                    "Type {0} is not an attribute", expectedType), "type");
        }
开发者ID:haiduc32,项目名称:TestThat,代码行数:15,代码来源:AttributeConstraint.cs


示例12: IsValid

 public static void IsValid(
     Constraint obj,
     MethodReturnEventArgs<bool> e,
     object constrainedObjectParam,
     object constrainedValueParam)
 {
     // the base constraint accepts all values
     e.Result = true;
 }
开发者ID:daszat,项目名称:zetbox,代码行数:9,代码来源:ConstraintActions.cs


示例13: ShowPopup

		public void ShowPopup(View popupView, Constraint xConstraint, Constraint yConstraint, Constraint widthConstraint = null, Constraint heightConstraint = null)
		{
			DismissPopup();
			_popup = popupView;

			_content.InputTransparent = true;
			Children.Add(_popup, xConstraint, yConstraint, widthConstraint, heightConstraint);

			UpdateChildrenLayout();
		}
开发者ID:jsnmgpnty,项目名称:Blogness2.0,代码行数:10,代码来源:PopupLayout.cs


示例14: Intersects

        public override VersionRangePart Intersects(Constraint constraint)
        {
            #region Sanity checks
            if (constraint == null) throw new ArgumentNullException("constraint");
            #endregion

            // If the exact version lies within the constraint, the exact version remains
            if (constraint.NotBefore != null && _version < constraint.NotBefore) return null;
            if (constraint.Before != null && _version >= constraint.Before) return null;
            return this;
        }
开发者ID:modulexcite,项目名称:0install-win,代码行数:11,代码来源:VersionRangePart.cs


示例15: FromPoint

 public static SubSpace FromPoint(params double[] coordinates)
 {
     //foreach coordinate, one constraint x[i]=coordinate[y], and the term??
     Constraint[] constraints=new Constraint[coordinates.Length];
     for (int i = 0; i < coordinates.Length; i++)
     {
         double[] constraintCoeffs=new double[coordinates.Length];
         constraintCoeffs[i] = coordinates[i];
         constraints[i] = new DefaultConstraint(constraintCoeffs);
     }
     return new SubSpace(constraints);
 }
开发者ID:pabloinigoblasco,项目名称:nd-voronoi-sharp,代码行数:12,代码来源:SubSpace.cs


示例16: CanIgnoreTable

        public void CanIgnoreTable()
        {
            var db = new Database();
            var table = new Table("dbo", "IgnoredTableWithConstraints");
            var constraint = new Constraint("TestConstraint", "", "");
            table.Constraints.Add(constraint);
            db.DataTables.Add(table);

            db.Ignore(new[] { "IgnoredTableWithConstraints" });

            db.Tables.Any().Should().BeFalse();
        }
开发者ID:rheinspree,项目名称:schemazen,代码行数:12,代码来源:DatabaseTests.cs


示例17: SwapConstraint

        private void SwapConstraint(Constraint constraint)
        {
            // Swap out the constraint at the current active/inactive border index (which has been updated
            // according to the direction we're moving it).
            Constraint swapConstraint = Vector[firstActiveConstraintIndex];
            swapConstraint.SetVectorIndex(constraint.VectorIndex);
            Vector[constraint.VectorIndex] = swapConstraint;

            // Toggle the state of the constraint being updated.
            Vector[firstActiveConstraintIndex] = constraint;
            constraint.SetActiveState(!constraint.IsActive, firstActiveConstraintIndex);
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:12,代码来源:ConstraintVector.cs


示例18: Set

        internal DfDvNode Set(DfDvNode parent, Constraint constraintToEval, Variable variableToEval, Variable variableDoneEval)
        {
            this.Parent = parent;
            this.ConstraintToEval = constraintToEval;
            this.VariableToEval = variableToEval;
            this.VariableDoneEval = variableDoneEval;
            this.Depth = 0;
            this.ChildrenHaveBeenPushed = false;

            constraintToEval.Lagrangian = 0.0;
            return this;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:12,代码来源:DfDvNode.cs


示例19: DeactivateConstraint

        internal void DeactivateConstraint(Constraint constraint)
        {
            Debug.Assert(constraint.IsActive, "Constraint is not active");

            // Swap it from the active region to the end of the inactive region of the Vector.
            Debug.Assert(firstActiveConstraintIndex < Vector.Length, "All constraints are already inactive");
            Debug.Assert(Vector[firstActiveConstraintIndex].IsActive, "Constraint in active region is not active");

            SwapConstraint(constraint);
            ++firstActiveConstraintIndex;

            //Debug_AssertConsistency();
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:13,代码来源:ConstraintVector.cs


示例20: ActivateConstraint

        internal void ActivateConstraint(Constraint constraint)
        {
            Debug.Assert(!constraint.IsActive, "Constraint is already active");

            // Swap it from the inactive region to the start of the active region of the Vector.
            Debug.Assert(firstActiveConstraintIndex > 0, "All constraints are already active");
            --firstActiveConstraintIndex;
            Debug.Assert(!Vector[firstActiveConstraintIndex].IsActive, "Constraint in inactive region is active");

            SwapConstraint(constraint);

            //Debug_AssertConsistency();
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:13,代码来源:ConstraintVector.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConstraintType类代码示例发布时间:2022-05-24
下一篇:
C# Constants类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap