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

C# IConstraint类代码示例

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

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



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

示例1: And

 public virtual IConstraint And(IConstraint andWith)
 {
     lock (StreamLock())
     {
         return Join(andWith, true);
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:7,代码来源:QCon.cs


示例2: GetRandomValueCore

        protected override object GetRandomValueCore(Type type, IConstraint[] constraints)
        {
            var valueScaled = _random.NextDouble();

            if (type == typeof(float))
                return this.ApplyConstraints(
                    constraints, 0.0f, 1.0f,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(double))
                return this.ApplyConstraints(
                    constraints, 0.0d, 1.0d,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(decimal))
                return this.ApplyConstraints(
                    constraints, 0.0m, 1.0m,
                    (minValue, maxValue) => minValue + (decimal)valueScaled * (maxValue - minValue)
                );

            throw new InvalidOperationException(
                string.Format("{0} does not support generation of {1}", this.GetType(), type
            ));
        }
开发者ID:svn2github,项目名称:azonlibrary,代码行数:26,代码来源:FractionalValueGenerator.cs


示例3: VisitGroup

        protected override void VisitGroup(ConstraintGroup node)
        {
            IConstraint where = null;

            for (int i = 0, c = node.Items.Count; i < c; i++)
            {
                this.Visit(node.Items[i]);

                if (i == 0)
                {
                    where = _whereResult;
                }
                else
                {
                    string op = node.Operators[i - 1];
                    if (op == Constraint.AndOperator)
                    {
                        where = f.And(where, _whereResult);
                    }
                    else if (op == Constraint.OrOperator)
                    {
                        where = f.Or(where, _whereResult);
                    }
                }
            }

            _whereResult = where;
        }
开发者ID:569550384,项目名称:Rafy,代码行数:28,代码来源:ConstraintConverter.cs


示例4: FormatDescription

 /// <summary>
 /// Formats a prefix constraint's description.
 /// </summary>
 internal static string FormatDescription(string descriptionPrefix, IConstraint baseConstraint)
 {
     return string.Format(
         baseConstraint is EqualConstraint ? "{0} equal to {1}" : "{0} {1}",
         descriptionPrefix,
         baseConstraint.Description);
 }
开发者ID:nunit,项目名称:nunit,代码行数:10,代码来源:PrefixConstraint.cs


示例5: Visit

			public virtual void Visit(OrExpression expression)
			{
				expression.Left().Accept(this);
				IConstraint left = _constraint;
				expression.Right().Accept(this);
				left.Or(_constraint);
				_constraint = left;
			}
开发者ID:erdincay,项目名称:db4o,代码行数:8,代码来源:SODAQueryBuilder.cs


示例6: BinaryConstraint

        /// <summary>
        /// Construct a BinaryConstraint from two other constraints
        /// </summary>
        /// <param name="left">The first constraint</param>
        /// <param name="right">The second constraint</param>
        protected BinaryConstraint(IConstraint left, IConstraint right)
            : base(left, right)
        {
            Guard.ArgumentNotNull(left, "left");
            this.Left = left;

            Guard.ArgumentNotNull(right, "right");
            this.Right = right;
        }
开发者ID:alfeg,项目名称:nunit,代码行数:14,代码来源:BinaryConstraint.cs


示例7: BuildMessage

        /// <summary>
        /// Writes the difference between the constraint and the actual value into a message.
        /// </summary>
        /// <param name="constraint">The constraint.</param>
        public string BuildMessage(IConstraint constraint)
        {
            this.Message = string.Format("Expected: '{0}' But was : '{1}'"
                , constraint.Description
                , this.GetString(constraint.Actual));

            this.BuildHeader(this.Message, constraint);
            return this.Message;
        }
开发者ID:seniorOtaka,项目名称:ndoctor,代码行数:13,代码来源:TextMessageWriter.cs


示例8: GetRandomValueCore

        protected override object GetRandomValueCore(Type type, IConstraint[] constraints)
        {
            var randomNumber = _random.Next(Int32.MinValue, Int32.MaxValue);
            var valueScaled = (decimal)((long)randomNumber - Int32.MinValue) / ((long)Int32.MaxValue - Int32.MinValue);

            if (type == typeof(sbyte))
                return this.ApplyConstraints(
                    constraints, sbyte.MinValue, sbyte.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(short))
                return this.ApplyConstraints(
                    constraints, short.MinValue, short.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(int))
                return this.ApplyConstraints(
                    constraints, int.MinValue, int.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * ((long)maxValue - minValue)
                );

            if (type == typeof(long))
                return this.ApplyConstraints(
                    constraints, long.MinValue, long.MaxValue,
                    (minValue, maxValue) => this.ConstrictToRange(valueScaled, minValue, maxValue)
                );

            if (type == typeof(byte))
                return this.ApplyConstraints(
                    constraints, byte.MinValue, byte.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(ushort))
                return this.ApplyConstraints(
                    constraints, ushort.MinValue, ushort.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(uint))
                return this.ApplyConstraints(
                    constraints, uint.MinValue, uint.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            if (type == typeof(ulong))
                return this.ApplyConstraints(
                    constraints, ulong.MinValue, ulong.MaxValue,
                    (minValue, maxValue) => minValue + valueScaled * (maxValue - minValue)
                );

            throw new InvalidOperationException(
                string.Format("{0} does not support generation of {1}", this.GetType(), type
            ));
        }
开发者ID:svn2github,项目名称:azonlibrary,代码行数:57,代码来源:NumericValueGenerator.cs


示例9: InstanceRegistration

        public InstanceRegistration(IConstraint constraint, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope scope1)
            : base(actionDescriptor, controllerDescriptor, scope1)
        {
            if (constraint == null)
            {
                throw new ArgumentNullException("constraint", "Constraint instance can not be null.");
            }

            Constraint = constraint;
            ConstraintType = Constraint.GetType();
        }
开发者ID:Grinderofl,项目名称:FluentMvc,代码行数:11,代码来源:InstanceRegistration.cs


示例10: GetRandomValue

        public object GetRandomValue(Type type, IConstraint[] constraints)
        {
            Require.NotNull(type, "type");
            Require.That<InvalidOperationException>(
                this.IsTypeSupported(type),
                "{0} does not support generation of {1}.",
                this.GetType(), type
            );

            return this.GetRandomValueCore(type, constraints);
        }
开发者ID:svn2github,项目名称:azonlibrary,代码行数:11,代码来源:ValueGenerator.cs


示例11: Constraints

		public virtual IConstraints Constraints()
		{
			lock (_cluster)
			{
				IConstraint[] constraints = new IConstraint[_queries.Length];
				for (int i = 0; i < constraints.Length; i++)
				{
					constraints[i] = _queries[i].Constraints();
				}
				return new ClusterConstraints(_cluster, constraints);
			}
		}
开发者ID:Galigator,项目名称:db4o,代码行数:12,代码来源:ClusterQuery.cs


示例12: Constrain

 public virtual IConstraint Constrain(object constraint)
 {
     lock (_cluster)
     {
         var constraints = new IConstraint[_queries.Length];
         for (var i = 0; i < constraints.Length; i++)
         {
             constraints[i] = _queries[i].Constrain(constraint);
         }
         return new ClusterConstraint(_cluster, constraints);
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:12,代码来源:ClusterQuery.cs


示例13: Pendulum

        private Pendulum(Particle point_a_, Particle point_b_, Vector3f equilibrium_position_, Render callback_, params IConstraint[] constraints_)
        {
            point_a = point_a_;
            point_b = point_b_;
            callback = callback_;
            equilibrium_position = equilibrium_position_;

            constraints = new IConstraint[constraints_.Length];
            for(int i = 0; i < constraints_.Length; ++i)
            {
                constraints[i] = constraints_[i];
            }
        }
开发者ID:jonwa,项目名称:Pendulum-waves,代码行数:13,代码来源:Pendulum.cs


示例14: Join

		internal override IConstraint Join(IConstraint a_with, bool a_and)
		{
			lock (StreamLock())
			{
				if (!(a_with is QCon))
				{
					return null;
				}
				// resolving multiple constraints happens in QCon for
				// a_with, so we simply turn things around
				return ((QCon)a_with).Join1(this, a_and);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:13,代码来源:QConstraints.cs


示例15: argsAsConstraints

		private IConstraint[] argsAsConstraints(object[] args)
		{
			if (null == args)
			{
				return new IConstraint[0];
			}

			IConstraint[] result = new IConstraint[args.Length];
			for (int i = 0; i < result.Length; ++i)
			{
				result[i] = argAsConstraint(args[i]);
			}
			return result;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:MockCall.cs


示例16: Join

		private IConstraint Join(IConstraint with, bool isAnd)
		{
			lock (_cluster)
			{
				Db4objects.Db4o.Internal.Cluster.ClusterConstraint other = Compatible(with);
				IConstraint[] newConstraints = new IConstraint[_constraints.Length];
				for (int i = 0; i < _constraints.Length; i++)
				{
					newConstraints[i] = isAnd ? _constraints[i].And(other._constraints[i]) : _constraints
						[i].Or(other._constraints[i]);
				}
				return new Db4objects.Db4o.Internal.Cluster.ClusterConstraint(_cluster, newConstraints
					);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:15,代码来源:ClusterConstraint.cs


示例17: Compatible

		private Db4objects.Db4o.Internal.Cluster.ClusterConstraint Compatible(IConstraint
			 with)
		{
			if (!(with is Db4objects.Db4o.Internal.Cluster.ClusterConstraint))
			{
				throw new ArgumentException();
			}
			Db4objects.Db4o.Internal.Cluster.ClusterConstraint other = (Db4objects.Db4o.Internal.Cluster.ClusterConstraint
				)with;
			if (other._constraints.Length != _constraints.Length)
			{
				throw new ArgumentException();
			}
			return other;
		}
开发者ID:erdincay,项目名称:db4o,代码行数:15,代码来源:ClusterConstraint.cs


示例18: GetIndexOfConstraintDimension

		private static int GetIndexOfConstraintDimension(IConstraint constraint, ReadOnlyCollection<DimensionWithValues> dimensionValues,
			QualifiedDimension dimension)
		{
			int ret = 0;
			foreach (DimensionWithValues dv in dimensionValues)
			{
				if (IsSubset(dimension, dv.Dimension))
				{
					return ret;
				}
				ret++;
			}
			throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
				"Dimension {0} from constraint {1} was not found in the matrix (all dimensions: {2}).",
				dimension.FullyQualifiedName, constraint.GetType().Name, string.Join(",", dimensionValues.Select(dv => dv.Dimension.FullyQualifiedName))));
		}
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:PartialVectorConstraintChecker.cs


示例19: ToArray

		public virtual IConstraint[] ToArray()
		{
			lock (_cluster)
			{
				Collection4 all = new Collection4();
				for (int i = 0; i < _constraints.Length; i++)
				{
					ClusterConstraint c = (ClusterConstraint)_constraints[i];
					for (int j = 0; j < c._constraints.Length; j++)
					{
						all.Add(c._constraints[j]);
					}
				}
				IConstraint[] res = new IConstraint[all.Size()];
				all.ToArray(res);
				return res;
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:18,代码来源:ClusterConstraints.cs


示例20: GetRandomValueCore

        protected override object GetRandomValueCore(Type type, IConstraint[] constraints)
        {
            if (type == typeof(char))
                return (char)_random.Next(Char.MinValue, Char.MaxValue);

            if (type == typeof(bool))
                return _random.NextDouble() > 0.5;

            if (type == typeof(string))
            #if !SILVERLIGHT
                return Path.GetRandomFileName();
            #else
                return Guid.NewGuid().ToString();
            #endif

            if (type == typeof(Guid))
                return Guid.NewGuid();

            throw new InvalidOperationException(
                string.Format("{0} does not support generation of {1}", this.GetType(), type
            ));
        }
开发者ID:svn2github,项目名称:azonlibrary,代码行数:22,代码来源:PrimitiveValueGenerator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IConstructionCallMessage类代码示例发布时间:2022-05-24
下一篇:
C# IConsole类代码示例发布时间: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