public string[] ToArgs() { List <string> args = new List <string>(); if (LowerLimit != 0 || UpperLimit != 0) { args.Add("LIMIT"); args.Add(LowerLimit.ToString()); args.Add(UpperLimit.ToString()); } if (Lexographically) { args.Add("ALPHA"); } if (!string.IsNullOrEmpty(By)) { args.Add("BY"); args.Add(By); } if (!string.IsNullOrEmpty(Get)) { args.Add("GET"); args.Add(Get); } return(args.ToArray()); }
void ShowParameterLimits() { if (ShowAlarmLimits) { ShowParameterAlarmLimits(); } ShowLimits = !ShowLimits; if (ShowLimits) { txtUpperLimit.Visibility = Visibility.Visible; txtLowerLimit.Visibility = Visibility.Visible; } else { bool result1 = double.TryParse(txtUpperLimit.Text, out double ul); bool result2 = double.TryParse(txtLowerLimit.Text, out double ll); if (result1 && result2) { UpperLimit = ul; LowerLimit = ll; } else { txtUpperLimit.Text = UpperLimit.ToString(); txtLowerLimit.Text = LowerLimit.ToString(); } txtUpperLimit.Visibility = Visibility.Collapsed; txtLowerLimit.Visibility = Visibility.Collapsed; } }
/// <summary> /// Chart 설정 또는 변량에 대해 XML 속성으로 생성합니다. /// </summary> /// <param name="writer">xml writer</param> public override void GenerateXmlAttributes(XmlWriter writer) { base.GenerateXmlAttributes(writer); if (SetAdaptiveMin.HasValue) { writer.WriteAttributeString("SetAdaptiveMin", SetAdaptiveMin.GetHashCode().ToString()); } if (UpperLimit.HasValue) { writer.WriteAttributeString("UpperLimit", UpperLimit.ToString()); } if (LowerLimit.HasValue) { writer.WriteAttributeString("LowerLimit", LowerLimit.ToString()); } if (UpperLimitDisplay.IsNotWhiteSpace()) { writer.WriteAttributeString("UpperLimitDisplay", UpperLimitDisplay); } if (LowerLimitDisplay.IsNotWhiteSpace()) { writer.WriteAttributeString("LowerLimitDisplay", LowerLimitDisplay); } }
public override int GetHashCode() { int hashCode = -1304306776; hashCode = hashCode * -1521134295 + _value.GetHashCode(); hashCode = hashCode * -1521134295 + LowerLimit.GetHashCode(); hashCode = hashCode * -1521134295 + UpperLimit.GetHashCode(); return(hashCode); }
/// <summary> </summary> public override int GetHashCode() { int hashCode = base.GetHashCode() ^ ObdGuid.GetHashCode() ^ LowerLimit.GetHashCode() ^ UpperLimit.GetHashCode() ^ StringAlgorithm.GetHashCode(); if (DateRange != null) { hashCode ^= DateRange.GetHashCode(); } if (!String.IsNullOrEmpty(StringInput)) { hashCode ^= StringInput.GetHashCode(); } return(hashCode); }
private void Update(EvaluationContext context) { var list = Input.GetValue(context); if (list == null || list.Count == 0) { return; } var lowerLimit = Math.Max(0, LowerLimit.GetValue(context)); var upperLimit = Math.Min(list.Count, UpperLimit.GetValue(context)); var sum = 0f; for (var index = lowerLimit; index < upperLimit; index++) { sum += list[index]; } Selected.Value = sum; }
private void Update(EvaluationContext context) { var fft = FftInput.GetValue(context); if (fft == null || fft.Count == 0) { return; } _bpmRangeMin = LowestBpm.GetValue(context); if (_bpmRangeMin < 50) { _bpmRangeMin = 50; } else if (_bpmRangeMin > 200) { _bpmRangeMin = 200; } _bpmRangeMax = HighestBpm.GetValue(context); if (_bpmRangeMax < _bpmRangeMin) { _bpmRangeMax = _bpmRangeMin + 1; } else if (_bpmRangeMax > 200) { _bpmRangeMax = 200; } if (_bpmEnergies.Count != _bpmRangeMax - _bpmRangeMin) { _bpmEnergies = new List <float>(new float[_bpmRangeMax - _bpmRangeMin]); } var bufferDuration = (int)BufferDurationSec.GetValue(context) * 60; if (bufferDuration < 60) { bufferDuration = 60; } else if (bufferDuration > 60 * 60) { bufferDuration = 60 * 60; } _bufferLength = bufferDuration; _lockInFactor = LockItFactor.GetValue(context); UpdateBuffer(fft, LowerLimit.GetValue(context), UpperLimit.GetValue(context)); SmoothBuffer(ref _smoothedBuffer, _buffer); var bestBpm = 0f; var bestMeasurement = float.PositiveInfinity; for (var bpm = _bpmRangeMin; bpm < _bpmRangeMax; bpm++) { var m = MeasureEnergyDifference(bpm) / ComputeFocusFactor(bpm, _currentBpm, 4, _lockInFactor); if (m < bestMeasurement) { bestMeasurement = m; bestBpm = bpm; } _bpmEnergies[bpm - _bpmRangeMin] = m; } foreach (var offset in _searchOffsets) { var bpm = _currentBpm + offset; if (bpm < 70 || bpm > 160) { continue; } var m = MeasureEnergyDifference(bpm) / ComputeFocusFactor(bpm, _currentBpm, 2, 0.01f); if (!(m < bestMeasurement)) { continue; } bestMeasurement = m; bestBpm = bpm; } DetectedBpm.Value = bestBpm; _currentBpm = bestBpm; Measurements.Value = _bpmEnergies; }
public string Action(string action, string parameter) { action = action.ToLower(); parameter = parameter.ToLower(); if (action == "status") { return(Digest); } else if (action == "debug") { _debugging = Convert.ToBoolean(parameter); return(JsonConvert.SerializeObject(_debugging)); } else if (action == "move") { switch (parameter) { case "up": Move(Direction.Up); break; case "down": Move(Direction.Down); break; case "all-up": Move(Direction.AllUp); break; case "all-down": Move(Direction.AllDown); break; default: uint target = 0; if (UInt32.TryParse(parameter, out target)) { Move(target); } else { return(string.Format("Bad parameter \"{0}\" to Action(\"move\")", parameter)); } break; } return("ok"); } else if (action == "halt" || action == "stop") { Halt(reason: parameter); return("ok"); } else if (action == "limit") { switch (parameter) { case "lower": return(LowerLimit.ToString()); case "upper": return(UpperLimit.ToString()); } return("ok"); } else { throw new ASCOM.ActionNotImplementedException("Action " + action + " is not implemented by this driver"); } }