本文整理汇总了C#中InputValue类的典型用法代码示例。如果您正苦于以下问题:C# InputValue类的具体用法?C# InputValue怎么用?C# InputValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputValue类属于命名空间,在下文中一共展示了InputValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckPath
//---------------------------------------------------------------------
/// <summary>
/// Checks if the path of the parameter file for a climate change is
/// valid.
/// </summary>
public static void CheckPath(InputValue<string> path)
{
CheckForInitialization();
if (path.Actual.Trim(null).Length == 0)
throw new InputValueException(path.String,
"{0} is not a valid path.",
path.String);
}
示例2: CheckBiomassParm
public static double CheckBiomassParm(InputValue<double> newValue,
double minValue,
double maxValue)
{
if (newValue != null)
{
if (newValue.Actual < minValue || newValue.Actual > maxValue)
throw new InputValueException(newValue.String,
"{0} is not between {1:0.0} and {2:0.0}",
newValue.String, minValue, maxValue);
}
return newValue.Actual;
}
示例3: CheckInputValue
//---------------------------------------------------------------------
private void CheckInputValue(StringReader reader,
InputValue<byte> expectedValue,
int expectedIndex)
{
int index;
InputValue<byte> result = byteReadMethod(reader, out index);
Assert.AreEqual(expectedValue.Actual, result.Actual);
Assert.AreEqual(expectedValue.String, result.String);
Assert.AreEqual(expectedIndex, reader.Index);
}
示例4: SetMortCurveShapeParm
//---------------------------------------------------------------------
public void SetMortCurveShapeParm(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
mortCurveShapeParm[species] = newValue.CheckInRange(5.0, 25.0, "mortCurveShapeParm");
}
示例5: ValidateTargetSizes
//---------------------------------------------------------------------
public static void ValidateTargetSizes(
InputValue<double> minTargetSize,
InputValue<double> maxTargetSize) {
if (minTargetSize.Actual < 0)
throw new InputValueException(
minTargetSize.String,
"Min target harvest size cannot be negative");
if (maxTargetSize.Actual <= 0)
throw new InputValueException(maxTargetSize.String,
"Max target harvest size must be positive");
if (minTargetSize.Actual > maxTargetSize.Actual)
throw new InputValueException(minTargetSize.String + " " +
maxTargetSize.String,
"Max target harvest size cannot be greater than min.");
}
示例6: SetMortCurveShapeParm
//---------------------------------------------------------------------
public void SetMortCurveShapeParm(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
mortCurveShapeParm[species] = Util.CheckBiomassParm(newValue, 5.0, 25.0);
}
示例7: SetWoodyDecayRate
//---------------------------------------------------------------------
public void SetWoodyDecayRate(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
woodyDecayRate[species] = Util.CheckBiomassParm(newValue, 0.0, 1.0);
}
示例8: SetLeafLignin
//---------------------------------------------------------------------
public void SetLeafLignin(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
leafLignin[species] = Util.CheckBiomassParm(newValue, 0.0, 0.4);
}
示例9: SetLightExtinctionCoeff
//---------------------------------------------------------------------
public void SetLightExtinctionCoeff(ISpecies species, InputValue<double> newValue)
{
Debug.Assert(species != null);
lightExtinctionCoeff[species] = Util.CheckBiomassParm(newValue, 0.0, 1.0);
}
示例10: NameEmpty
public void NameEmpty()
{
InputValue<string> name = new InputValue<string>("", "");
parameters.Name = name;
}
示例11: SetAET
//---------------------------------------------------------------------
public void SetAET(IEcoregion ecoregion,
InputValue<int> newValue)
{
Debug.Assert(ecoregion != null);
aet[ecoregion] = Util.CheckBiomassParm(newValue, 0, 10000); //FIXME: FIND GOOD MAXIMUM
}
示例12: FinishInputLineOperation
/// <summary>
/// Finishes an input operation which reads a line of text.
/// </summary>
/// <param name="inputText">
/// The input text.
/// </param>
/// <param name="terminator">
/// The terminator.
/// </param>
protected virtual void FinishInputLineOperation(string inputText, InputValue terminator)
{
var zsciiText = this.UnicodeToZscii(inputText);
var textStartAddress = this.InputOperation.TextBuffer + this.TextBufferHeaderLength;
this.WriteZsciiToMemory(textStartAddress, zsciiText);
this.TerminateTextBuffer(textStartAddress, (byte)zsciiText.Count());
this.LexicalAnalysis(zsciiText, this.InputOperation.ParseBuffer, this.DictionaryTableAddress, true);
this.FinishInputOperation(inputText, terminator);
}
示例13: FinishInputOperation
/// <summary>
/// Finishes an input operation.
/// </summary>
/// <param name="inputText">
/// The input text.
/// </param>
/// <param name="terminator">
/// The terminator.
/// </param>
protected virtual void FinishInputOperation(string inputText, InputValue terminator)
{
if (this.InputLogOpen)
{
ImmutableQueue<InputValue> inputValues = null;
foreach (var character in inputText)
{
inputValues = inputValues.Add(new InputValue(character));
}
inputValues = inputValues.Add(terminator);
this.WriteToInputLog(inputValues);
}
this.InputOperation = null;
this.State = MachineState.Running;
}
示例14: ProcessInputValue
/// <summary>
/// Processes an input value.
/// </summary>
/// <param name="inputValue">
/// The input value.
/// </param>
/// <returns>
/// A value indicating whether the input operation terminated.
/// </returns>
protected virtual bool ProcessInputValue(InputValue inputValue)
{
var value = inputValue.Value;
if (value is char)
{
return this.ProcessCharacter((char)value);
}
if (value is InputKey)
{
return this.ProcessInputKey((InputKey)value);
}
return false;
}
示例15: FilterInput
public InputValue[] FilterInput(System.Collections.Specialized.NameValueCollection querystring, UIFS.FormDataStruct FormData)
{
int cnt = 0;
InputValue[] IVs = new InputValue[FormData.ControlList.Length];
UIFS.FormControl Control;
foreach (UIFS.FormDataStruct.ControlListDetail CtrlDetail in FormData.ControlList)
{
Control = FormData.Get_Control(CtrlDetail.id);
IVs[cnt] = new InputValue();
IVs[cnt].Controlid = CtrlDetail.id; // set control id
// now set the correct values based on control type
switch (CtrlDetail.type)
{
case ControlType.Textbox:
case ControlType.DateTime:
case ControlType.List:
IVs[cnt].value = querystring["c_" + Control.id.ToString()];
break;
case ControlType.Percentage:
case ControlType.Number:
IVs[cnt].value = querystring["c_" + Control.id.ToString()];
if (IVs[cnt].value == "") {
IVs[cnt].value = "0"; // DEFAULT to 0 if nothing returned
}
break;
// This checkbox control may also have an attached text input field
case ControlType.Checkbox:
UIFS.FormControl.Checkbox CB = (UIFS.FormControl.Checkbox)Control; //FormData.Get_Control(CtrlDetail.id);;
if (CB.hasinput)
{
IVs[cnt].value = SQLBOOL(querystring["c_" + Control.id.ToString()]);
IVs[cnt].input = querystring["c_" + Control.id.ToString()+"_I"];
}
else { IVs[cnt].value = SQLBOOL(querystring["c_" + Control.id.ToString()]);}
break;
// Ranges have a *Start and *End set of values
case ControlType.Range:
UIFS.FormControl.Range R = (UIFS.FormControl.Range)Control;
IVs[cnt].Start = querystring["c_" + Control.id.ToString() + "_S"];
IVs[cnt].End = querystring["c_" + Control.id.ToString() + "_E"];
switch (R.type) {
// numbers
case FormControl.Range.Rangetype.Currency:
case FormControl.Range.Rangetype.MinMax:
// DEFAULT to 0 if nothing returned
if (IVs[cnt].Start == ""){IVs[cnt].Start = "0"; }
if (IVs[cnt].End == ""){IVs[cnt].End = "0"; }
break;
case FormControl.Range.Rangetype.DateRange:
case FormControl.Range.Rangetype.DateTimeRange:
case FormControl.Range.Rangetype.TimeRange:
// DEFAULTs are typically set by Calendar widget..control creation..
break;
}
break;
}
cnt += 1; // increase our array counter
}
return IVs;
}