本文整理汇总了C#中Variables类的典型用法代码示例。如果您正苦于以下问题:C# Variables类的具体用法?C# Variables怎么用?C# Variables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Variables类属于命名空间,在下文中一共展示了Variables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineProgress
public QpProgressReport DetermineProgress(Variables iterate, Residuals residuals, double mu, int count)
{
var code = QpTerminationCode.InProgress;
double residualsNorm = residuals.InfinityNorm();
double phi = ComputeMeritFunction(residuals, residualsNorm);
this.UpdateMeritFunctionHistory(phi, count);
bool isMuSatisfied = (mu < Tolerance);
bool isRnormSatisfied = (residualsNorm < Tolerance * this.dataInfinityNorm);
if (isMuSatisfied && isRnormSatisfied)
{
code = QpTerminationCode.Success;
}
else if (count >= MaxIterations)
{
code = QpTerminationCode.MaxIterationsExceeded;
}
else if (count > 20 && phi >= 1e-8 && phi >= 1e4 * this.phiMinimumHistory[count - 1])
{
code = QpTerminationCode.Infeasible;
}
else if (count >= 30 && this.phiMinimumHistory[count] >= .5 * this.phiMinimumHistory[count - 30])
{
code = QpTerminationCode.Unknown;
}
return includeDetailedReport || code != QpTerminationCode.InProgress ?
new QpProgressReport(code, count, phi, iterate.Clone()) :
new QpProgressReport(code, count, phi, null);
}
示例2: NewtonSystem
public NewtonSystem(QpProblem data, Variables initialPoint)
{
this.Q = data.Q;
this.A = data.A;
this.initialCholeskyFactor = this.Factorize(initialPoint);
}
示例3: QpProgressReport
public QpProgressReport(QpTerminationCode status, int iterations, double meritFunction, Variables currentIterate)
{
this.solveStatus = status;
this.iterations = iterations;
this.currentIterate = currentIterate == null ? null : currentIterate.Clone();
this.meritFunction = meritFunction;
}
示例4: Write
public void Write(FieldsParser information, string formName)
{
Variables variables = new Variables();
SqlTransaction sqlTransaction = SqlConn.BeginTransaction();
try
{
MasterConnection.SP.Execute(SqlConn, sqlTransaction, information.Master, variables);
foreach (FieldsGroupConnection detailConnection in DetailConnections)
{
foreach (FieldsParser.Fields fields in information.Details)
{
if (fields.NodeName == detailConnection.Name)
{
detailConnection.SP.Execute(SqlConn, sqlTransaction, fields, variables);
}
}
}
sqlTransaction.Commit();
}
catch
{
sqlTransaction.Rollback();
throw;
}
}
示例5: Constructor_DetectsAdjacentCyclicalReference
public void Constructor_DetectsAdjacentCyclicalReference()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
var copy = new Dictionary<string, string>
{
{ "variable1", "1_$(variable2)" },
{ "variable2", "2_$(variable3)" },
{ "variable3", "3_$(variable2)" },
};
// Act.
List<string> warnings;
var variables = new Variables(hc, copy, new List<MaskHint>(), out warnings);
// Assert.
Assert.Equal(3, warnings.Count);
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable1"))));
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable2"))));
Assert.True(warnings.Any(x => string.Equals(x, StringUtil.Loc("Variable0ContainsCyclicalReference", "variable3"))));
Assert.Equal("1_$(variable2)", variables.Get("variable1"));
Assert.Equal("2_$(variable3)", variables.Get("variable2"));
Assert.Equal("3_$(variable2)", variables.Get("variable3"));
}
}
示例6: Change
/// <summary>
/// Constructor
/// </summary>
/// <param name="variable"></param>
/// <param name="previousValue"></param>
/// <param name="newValue"></param>
public Change(Variables.IVariable variable, Values.IValue previousValue, Values.IValue newValue)
{
Variable = variable;
PreviousValue = previousValue;
NewValue = newValue;
Applied = false;
}
示例7: ButtonGenerate_Click
private void ButtonGenerate_Click(object sender, EventArgs e)
{
List<Variables> vList = new List<Variables>();
for (int i = 0; i < DGVProperties.Rows.Count - 1; i++)
{
Variables v = new Variables();
v.Name = DGVProperties.Rows[i].Cells[0].Value.ToString();
v.SQLType = DGVProperties.Rows[i].Cells[1].Value.ToString();
if (v.SQLType != null && v.SQLType != "")
v.CSharpType = SelectCSharpType(v.SQLType.ToLower());
if (DGVProperties.Rows[i].Cells[2].Value != null && DGVProperties.Rows[i].Cells[2].Value.ToString() != "")
v.VariableSize = Convert.ToInt32(DGVProperties.Rows[i].Cells[2].Value.ToString());
else
v.VariableSize = 0;
v.AllowNulls = Convert.ToBoolean(DGVProperties.Rows[i].Cells[3].Value);
vList.Add(v);
}
if (textBoxPath.Text.Length != 0 && textBoxPath.Text[textBoxPath.Text.Length - 1] != '\\')
textBoxPath.Text += "\\";
CreateClass.WriteProperties(vList, _className, textBoxPath.Text);
CreateClass.WriteData(vList, _className, textBoxPath.Text);
CreateClass.WriteBusiness(vList, _className, textBoxPath.Text);
CreateClass.WriteList(vList, _className, textBoxPath.Text);
}
示例8: Constructor_AppliesMaskHints
public void Constructor_AppliesMaskHints()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
var copy = new Dictionary<string, string>
{
{ "MySecretName", "My secret value" },
{ "MyPublicVariable", "My public value" },
};
var maskHints = new List<MaskHint>
{
new MaskHint() { Type = MaskType.Variable, Value = "MySecretName" },
};
List<string> warnings;
var variables = new Variables(hc, copy, maskHints, out warnings);
// Act.
KeyValuePair<string, string>[] publicVariables = variables.Public.ToArray();
// Assert.
Assert.Equal(0, warnings.Count);
Assert.Equal(1, publicVariables.Length);
Assert.Equal("MyPublicVariable", publicVariables[0].Key);
Assert.Equal("My public value", publicVariables[0].Value);
Assert.Equal("My secret value", variables.Get("MySecretName"));
}
}
示例9: ProcessFileContents
protected virtual void ProcessFileContents(File file, Variables.Root variables)
{
string[] contents = file.Contents.Split('\n');
int lineCount = 0, charCount = 0, maxCharsPerLine = 0;
foreach(string line in contents){
if (!line.Trim().Equals("{")){
++lineCount;
}
if (line.Length > 0){
int realLength = ParseUtils.CountCharacters(line);
charCount += realLength;
maxCharsPerLine = Math.Max(maxCharsPerLine, realLength);
}
}
variables.Increment(Key+"LinesTotal", lineCount);
variables.Increment(Key+"CharsTotal", charCount);
variables.Maximum(Key+"LinesMax", lineCount);
variables.Maximum(Key+"CharsMax", charCount);
variables.Maximum(Key+"CharsPerLineMax", maxCharsPerLine);
State state = variables.GetStateObject<State>(stateOwner);
FileIntValue fileLines = new FileIntValue(file, lineCount);
state.MaxLines.Add(fileLines);
state.MinLines.Add(fileLines);
FileIntValue fileChars = new FileIntValue(file, charCount);
state.MaxChars.Add(fileChars);
state.MinChars.Add(fileChars);
}
示例10: FinalizeProject
public override void FinalizeProject(Variables.Root variables)
{
base.FinalizeProject(variables);
variables.Average(Key+"LinesAvg", Key+"LinesTotal", Key+"CodeFiles");
variables.Average(Key+"CharsAvg", Key+"CharsTotal", Key+"CodeFiles");
variables.Average(Key+"CharsPerLineAvg", Key+"CharsTotal", Key+"LinesTotal");
State state = variables.GetStateObject<State>(stateOwner);
foreach(FileIntValue fi in state.MaxLines){
variables.AddToArray(Key+"LinesTop", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MinLines.Reverse()){
variables.AddToArray(Key+"LinesBottom", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MaxChars){
variables.AddToArray(Key+"CharsTop", GetFileObject(fi, variables));
}
foreach(FileIntValue fi in state.MinChars.Reverse()){
variables.AddToArray(Key+"CharsBottom", GetFileObject(fi, variables));
}
}
示例11: DynamicFunction
public DynamicFunction(string name, ParseNode node, Variables args, int minParameters = 0, int maxParameters = 0)
{
Node = node;
Arguments = args;
MinParameters = minParameters;
MaxParameters = maxParameters;
}
示例12: Edit
/// <summary>
/// The edit.
/// </summary>
/// <param name="parentWindow">
/// The parent window.
/// </param>
/// <param name="variables">
/// The variables.
/// </param>
/// <param name="connections">
/// The connections.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public bool Edit(IWin32Window parentWindow, Variables variables, Connections connections)
{
string jsonString = string.Empty;
var value = this.metaData.CustomPropertyCollection["Settings"].Value;
if (value != null)
{
jsonString = value.ToString();
}
List<InputColumnInfo> inputColumnInfos = new List<InputColumnInfo>();
foreach (IDTSInputColumn100 col in this.metaData.InputCollection[0].InputColumnCollection)
{
inputColumnInfos.Add(
new InputColumnInfo() { ColumnName = col.Name, DataType = col.DataType, LineageId = col.LineageID });
}
FillablePdfDestinationUIForm editor = new FillablePdfDestinationUIForm(
jsonString,
inputColumnInfos.ToArray());
editor.ShowDialog(parentWindow);
if (editor.DialogResult == DialogResult.OK || editor.DialogResult == DialogResult.Yes)
{
this.metaData.CustomPropertyCollection["Settings"].Value = editor.OutputConfigJsonString;
return true;
}
return false;
}
示例13: Factorize
public ISolver<double> Factorize(Variables currentIterate, int iteration)
{
if (iteration == 0)
{
return this.initialCholeskyFactor;
}
return this.Factorize(currentIterate);
}
示例14: Process
public override void Process(File file, Variables.Root variables)
{
base.Process(file, variables);
variables.Increment("fileTypeCode");
variables.Increment(Key+"CodeFiles");
ProcessFileContents(file, variables);
}
示例15: Script
static Script()
{
if (Vars == null)
Vars = new Variables();
if (Environment.OSVersion.Platform == PlatformID.Unix)
Environment.SetEnvironmentVariable("MONO_VISUAL_STYLES", "gtkplus");
Application.EnableVisualStyles();
}