// #endregion //------------------------------------------------------------------------- #region Public // public void SetPidValues(PidParamsEventArgs e) { if (e == null) { Dispatcher.BeginInvoke(new Action(() => { string str = DigitToString(0, 3); txtPvalue.Text = str; txtIvalue.Text = str; txtDvalue.Text = str; txtOutvalue.Text = str; txtPvValue.Text = str; txtSpvalue.Text = str; PidResetDelegate = null; }), System.Windows.Threading.DispatcherPriority.Send); } else { Dispatcher.BeginInvoke(new Action(() => { txtPvalue.Text = DigitToString(e.PValue, 3); txtIvalue.Text = DigitToString(e.IValue, 3); txtDvalue.Text = DigitToString(e.DValue, 3); txtOutvalue.Text = DigitToString(e.OutValue, 3); txtPvValue.Text = DigitToString(e.Pv, 3); txtSpvalue.Text = DigitToString(e.Sp, 3); PidResetDelegate = e.PidResetDelegate; }), System.Windows.Threading.DispatcherPriority.Send); } }
private IMongoQuery HandleEndsWith(SimpleReference reference, SimpleFunction function) { if (!(function.Args[0] is string)) { throw new InvalidOperationException("StartsWith can only be used with a string."); } return(Query.Matches((string)FormatObject(reference), new BsonRegularExpression(".*" + (string)function.Args[0] + "$"))); }
public void SimpleFunction_Test_1() { MyObject mo = new MyObject("Simple", 98); SimpleFunction<int> sf = new SimpleFunction<int>(() => mo.Value); sf.MonitorEvents(); sf.Value.Should().Be(98); sf.ShouldNotRaisePropertyChangeFor(o=>o.Value); sf.Dispose(); }
public void T05_SimpleFunction() { var device = TC.CentralDevice; var func = new SimpleFunction { Operand = 1 }; device.Execute(func); Assert.AreEqual(2, func.Answer); }
public void VerifyThatTheFunctionReturnsTen() { // ----------- SETUP ------------------------- var instance = new SimpleFunction(15); // ----------- EXECUTE ------------------------ int result = instance.GetExpectedNumber(); // ----------- VALIDATE ------------------------ Assert.Equal <int>(15, result); }
private IMongoQuery HandleLike(SimpleReference reference, SimpleFunction function) { if (function.Args[0] is Regex) { return(Query.Matches((string)FormatObject(reference), new BsonRegularExpression((Regex)function.Args[0]))); } else if (function.Args[0] is string) { return(Query.Matches((string)FormatObject(reference), new BsonRegularExpression((string)FormatObject(function.Args[0])))); } throw new InvalidOperationException("Like can only be used with a string or Regex."); }
public static double NewtonSolver(SimpleFunction func, double init_x, double eps, double dx) { double x = init_x; for (int i = 0; i < 10; i++) { double v0 = func(x); if (Math.Abs(v0) < eps) { return(x); } double dfdx = (func(x + dx) - v0) / dx; x = x - func(x) / dfdx; } return(double.NaN); }
public DistributedRandom(string function_str) { function_ = new SimpleFunction(function_str); random_ = new RNGCrypto(); }
private QueryComplete HandleEndsWith(SimpleReference reference, SimpleFunction function) { if (!(function.Args[0] is string)) throw new InvalidOperationException("StartsWith can only be used with a string."); return Query.Matches((string)FormatObject(reference), new BsonRegularExpression(".*" + (string)function.Args[0] + "$")); }
private QueryComplete HandleLike(SimpleReference reference, SimpleFunction function) { if (function.Args[0] is Regex) return Query.Matches((string)FormatObject(reference), new BsonRegularExpression((Regex)function.Args[0])); else if (function.Args[0] is string) return Query.Matches((string)FormatObject(reference), new BsonRegularExpression((string)FormatObject(function.Args[0]))); throw new InvalidOperationException("Like can only be used with a string or Regex."); }
public void SimpleFunction_Test_3() { MyObject mo = new MyObject("Simple", 98); MyObject mi = new MyObject("Simple2", 100); mo.Friend = mi; SimpleFunction<int> sf = new SimpleFunction<int>(() => mo.Friend.Value); sf.MonitorEvents(); sf.Value.Should().Be(100); sf.ShouldNotRaisePropertyChangeFor(o => o.Value); mo.Name = "Complexe"; sf.ShouldNotRaisePropertyChangeFor(o => o.Value); sf.Value.Should().Be(100); mo.Value = 120; sf.Value.Should().Be(100); sf.ShouldNotRaisePropertyChangeFor(o => o.Value); mi.Value = 130; sf.Value.Should().Be(130); sf.ShouldRaisePropertyChangeFor(o => o.Value); MyObject nf = new MyObject("nff", -255); mo.Friend = nf; sf.Value.Should().Be(-255); sf.ShouldRaisePropertyChangeFor(o => o.Value); sf.Dispose(); }
internal protected string FormatFunction(SimpleFunction function) { return string.Format("{0}({1})", function.Name, function.Args.Aggregate((x, y) => FormatObject(x) + "," + FormatObject(y))); }
internal protected string FormatFunction(SimpleFunction function) { return(string.Format("{0}({1})", function.Name, function.Args.Aggregate((x, y) => FormatObject(x) + "," + FormatObject(y)))); }
public int Accept(SimpleFunction func) { func.Answer = func.Operand + 1; return(ErrorCode); }