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

C# IVariable类代码示例

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

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



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

示例1: InsertInListChange

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 /// <param name="statement"></param>
 /// <param name="variable"></param>
 /// <param name="explanation"></param>
 public InsertInListChange(InterpretationContext context, InsertStatement statement, IVariable variable, ExplanationPart explanation)
     : base(variable, null, null)
 {
     Context = context;
     Statement = statement;
     Explanation = explanation;
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:14,代码来源:InsertInListChange.cs


示例2: CalculateDomain

        private static Domain CalculateDomain(IVariable[] arguments)
        {
            if (arguments.All(a => a.IsBinary()))
            {
                return Domain.BinaryInteger;
            }

            if (IsDividingByConstant(arguments))
            {
                if (arguments.All(a => a.IsInteger()))
                {

                    if (arguments.All(a => a.IsPositiveOrZero() || a.IsBinary()))
                    {
                        return Domain.PositiveOrZeroInteger;
                    }
                    return Domain.AnyInteger;
                }
                else
                {
                    if (arguments.All(a => a.IsPositiveOrZero() || a.IsBinary()))
                    {
                        return Domain.PositiveOrZeroReal;
                    }
                    return Domain.AnyReal;
                }
            }

            if (arguments.All(a => a.IsPositiveOrZero() || a.IsBinary()))
            {
                return Domain.PositiveOrZeroInteger;
            }
            return Domain.AnyInteger;
        }
开发者ID:afish,项目名称:MilpManager,代码行数:34,代码来源:DivisionCalculator.cs


示例3: Set

        public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable, IVariable rightVariable)
        {
            IVariable any = milpManager.CreateAnonymous(Domain.AnyInteger);
            leftVariable.Set(ConstraintType.Equal,any.Operation(OperationType.Multiplication, rightVariable));

            return leftVariable;
        }
开发者ID:afish,项目名称:MilpManager,代码行数:7,代码来源:MultipleOfCalculator.cs


示例4: VariableStartEntry

 /// <summary>
 /// Default ctor
 /// </summary>
 public VariableStartEntry(int offset, Register register, IVariable variable, TypeReference type) : base(offset)
 {
     this.register = register;
     Variable = variable;
     name = variable.OriginalName;
     this.type = type;
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:10,代码来源:DebugInfoBuilder.VariableStartEntry.cs


示例5: GetStatus

		public VariableState GetStatus (IVariable variable)
		{
			VariableState state;
			if (!states.TryGetValue (variable, out state))
				return VariableState.None;
			return state;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:VariableUsageAnalyzation.cs


示例6: Set

 public IVariable Set(IMilpManager milpManager, ConstraintType type, IVariable leftVariable,
     IVariable rightVariable)
 {
     switch (type)
     {
         case ConstraintType.Equal:
             milpManager.SetEqual(leftVariable, rightVariable);
             leftVariable.ConstantValue = rightVariable.ConstantValue ?? leftVariable.ConstantValue;
             rightVariable.ConstantValue = leftVariable.ConstantValue ?? rightVariable.ConstantValue;
             break;
         case ConstraintType.LessOrEqual:
             milpManager.SetLessOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.GreaterOrEqual:
             milpManager.SetGreaterOrEqual(leftVariable, rightVariable);
             break;
         case ConstraintType.LessThan:
             milpManager.Operation(OperationType.IsLessThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.GreaterThan:
             milpManager.Operation(OperationType.IsGreaterThan, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         case ConstraintType.NotEqual:
             milpManager.Operation(OperationType.IsNotEqual, leftVariable, rightVariable)
                 .Set(ConstraintType.Equal, milpManager.FromConstant(1));
             break;
         default:
             throw new InvalidOperationException("Cannot set constraint");
     }
     return leftVariable;
 }
开发者ID:afish,项目名称:MilpManager,代码行数:33,代码来源:CanonicalConstraintCalculator.cs


示例7: Change

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="variable"></param>
 /// <param name="previousValue"></param>
 /// <param name="newValue"></param>
 public Change(IVariable variable, IValue previousValue, IValue newValue)
 {
     Variable = variable;
     PreviousValue = previousValue;
     NewValue = newValue;
     Applied = false;
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:Change.cs


示例8: AddVariable

		private void AddVariable(IVariable v, bool isUsedByReference = false) {
			string n = _namer.GetVariableName(v.Name, _usedNames);
			_usedNames.Add(n);
			_result.Add(v, new VariableData(n, _currentMethod, isUsedByReference));
			if (_isInsideLoop)
				_variablesDeclaredInsideLoop.Add(v);
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:7,代码来源:VariableGatherer.cs


示例9: VariableAggregationFilter

 public VariableAggregationFilter(IVariable variable, [GreaterThan(0)]int stepSize, int minIndex, int maxIndex)
 {
     this.minIndex = minIndex;
     this.maxIndex = maxIndex;
     this.stepSize = stepSize;
     this.variable = variable;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:7,代码来源:VariableAggregationFilter.cs


示例10: CalculateForVariable

        private static IEnumerable<IVariable> CalculateForVariable(IMilpManager milpManager, IVariable[] arguments, uint decompositionBase)
        {
            List<Tuple<IVariable, int>> variables =
                Enumerable.Range(0, GetDigitsCount(milpManager, decompositionBase))
                    .Select(i =>
                    {
                        var baseRaised = (int)Math.Pow(decompositionBase, i);
                        var variable = milpManager.CreateAnonymous(decompositionBase == 2 ? Domain.BinaryInteger : Domain.PositiveOrZeroInteger);
                        if (decompositionBase > 2)
                        {
                            variable = variable.Set(ConstraintType.LessOrEqual,milpManager.FromConstant((int) decompositionBase - 1));
                        }
                        return Tuple.Create(variable, baseRaised);
                    })
                    .ToList();

            milpManager.Operation(OperationType.Addition,
                variables.Select(v => v.Item1.Operation(OperationType.Multiplication, milpManager.FromConstant(v.Item2)))
                    .ToArray()).Set(ConstraintType.Equal, arguments[0]);

            return variables.Select((v, index) => {
                var result = v.Item1;
                result.Expression = $"decomposition(digit: {index}, base: {decompositionBase}, {arguments[0].FullExpression()})";
                return result;
            });
        }
开发者ID:afish,项目名称:MilpManager,代码行数:26,代码来源:DecompositionCalculator.cs


示例11: ExpressionException

 public ExpressionException(string message, int column, int length, IVariable variable)
     : base(message)
 {
     m_column = column;
     m_length = length;
     m_variable = variable;
 }
开发者ID:bvssvni,项目名称:expressionlibsharp,代码行数:7,代码来源:ExpressionException.cs


示例12: LocalResolveResult

		public LocalResolveResult(IVariable variable, IType type, object constantValue = null)
			: base(type)
		{
			if (variable == null)
				throw new ArgumentNullException("variable");
			this.variable = variable;
			this.constantValue = constantValue;
		}
开发者ID:JustasB,项目名称:cudafy,代码行数:8,代码来源:LocalResolveResult.cs


示例13: DivideVariableByConstant

 public override IVariable DivideVariableByConstant(IVariable variable, IVariable constant, Domain domain)
 {
     var newVariable = InternalDivideVariableByConstant(variable, constant, domain);
     newVariable.Domain = domain;
     newVariable.MilpManager = this;
     Variables[newVariable.Name] = newVariable;
     return newVariable;
 }
开发者ID:afish,项目名称:MilpManager,代码行数:8,代码来源:BaseMilpSolver.cs


示例14: CreateVariableItem

 private ListViewItem CreateVariableItem(IVariable variable, IFrame frame)
 {
     var item = new ListViewItem(new string[4]);
     item.Tag = variable;
     item.UseItemStyleForSubItems = false;
     UpdateVariableItem(item, frame);
     return item;
 }
开发者ID:die-Deutsche-Orthopaedie,项目名称:LiteDevelop,代码行数:8,代码来源:VariablesControl.cs


示例15: AddParameter

        private IParameter AddParameter(IVariable variable)
        {
            var parameter = Owner.CreateParameter("value", variable.Type);

            Parameters.Add(parameter);

            return parameter;
        }
开发者ID:CaptiveAire,项目名称:VPL,代码行数:8,代码来源:VariableSetter.cs


示例16: Set

        public IVariable Set(IMilpManager milpManager, CompositeConstraintType type, ICompositeConstraintParameters parameters,
            IVariable leftVariable, params IVariable[] rightVariable)
        {
            leftVariable.Operation(OperationType.DifferentValuesCount, rightVariable)
                .Set(ConstraintType.Equal, milpManager.FromConstant(rightVariable.Length + 1));

            return leftVariable;
        }
开发者ID:afish,项目名称:MilpManager,代码行数:8,代码来源:AllDifferentCalculator.cs


示例17: UnpackTypeIfByRefParameter

		static IType UnpackTypeIfByRefParameter(IType type, IVariable v)
		{
			if (type.Kind == TypeKind.ByReference) {
				IParameter p = v as IParameter;
				if (p != null && (p.IsRef || p.IsOut))
					return ((ByReferenceType)type).ElementType;
			}
			return type;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:9,代码来源:LocalResolveResult.cs


示例18: AreEqualSearchTargets

        public static bool AreEqualSearchTargets(IVariable t1, IVariable t2)
        {
            if (t1 != null && t2 != null)
            {
                return t1.Name == t2.Name && t1.Type == t2.Type;
            }

            return false;
        }
开发者ID:sgmunn,项目名称:MonkeyWrench,代码行数:9,代码来源:CodeDomHelpers.cs


示例19: CreateVariables

        public IVariable[] CreateVariables()
        {
            var variables = new IVariable[Variables.Count];

            for (int i = 0; i < variables.Length; i++)
                variables[i] = Variables[i].CreateVariable();

            return variables;
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:9,代码来源:BehaviourTreeNode.cs


示例20: DefineVariable

        public void DefineVariable(string variable, IVariable value)
        {
            if(this.HasVariable(variable, false))
            {
                throw new VariableAlreadyDefinedException("Variable \"" + variable + "\" has already been defined");
            }

            this.variables[variable] = value;
        }
开发者ID:redxdev,项目名称:DScript,代码行数:9,代码来源:ScopedExecutionContext.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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