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


C# IVariable类代码示例

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


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


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