protected override void DoWhenAllDataIsReady() { LoggedData.Add(Provider.Data); //Timestamps.Add(Timestamps.LastOrDefault() + Provider.Interval); Timestamps.Add(Provider.RunTime); Intervals.Add(Provider.Interval); }
protected override void DoWhenAllDataIsReady() { //if (Res.DebuggingSignalFlag) // Log.Debug(_tag, $"DoWhenAll: {LoggedData.Count} data pts."); if (AllowDataUpdates) //base.DoWhenAllDataIsReady(); { LoggedData.Add(Provider.Data); //Timestamps.Add(Timestamps.LastOrDefault() + Provider.Interval); Timestamps.Add(Provider.RunTime + AccumulatedRuntime); Intervals.Add(Provider.Interval); } //if (SessionCTS != null && SessionCTS.IsCancellationRequested) //{ // if (DeactivationCounter == 0) // { // SessionCTS = null; // DeactivationCounter = 10; // AdditionalPointsSignal.Set(); // } // else DeactivationCounter--; //} if (InitialInterval == TimeSpan.Zero) { InitialInterval = Provider.Interval; } }
public void PerfectFill() { var a = new Intervals<float>(); a.Add(0, 5); Assert.That(a.Contains(-float.Epsilon), Is.False); Assert.That(a.Contains(0)); Assert.That(a.Contains(4.999f)); Assert.That(a.Contains(5), Is.False); a.Add(6, 10); Assert.That(a.Contains(6)); Assert.That(a.Contains(9.999f)); Assert.That(a.Contains(10), Is.False); Assert.That(a.Count(), Is.EqualTo(2)); a.Add(5, 6); Assert.That(a.Count(), Is.EqualTo(1)); }
public PhiAccrualModel NextInterval(long interval) { if (Intervals.Count == SampleSize) { return(new PhiAccrualModel(SampleSize, Intervals.Skip(1).ToImmutableList().Add(interval))); } return(new PhiAccrualModel(SampleSize, Intervals.Add(interval))); }
// Loads Interval choices based on the selected Protocol. public void loadIntervals() { int intervalLength = SelectedProtocol.Interval__Months_; int endInterval = SelectedProtocol.End_Interval; for (int i = 0; i <= endInterval; i++) { Intervals.Add(new Interval(i, intervalLength)); } }
protected override void DoWhenAllDataIsReady() { _smoothedData.Add(new Datapoint <T1, T2>() { Value1 = (providers[0] as IProvider <T1>).Data, Value2 = (providers[1] as IProvider <T2>).Data }); //Timestamps.Add(Timestamps.LastOrDefault() + providers[0].Interval); Timestamps.Add(providers[0].RunTime); Intervals.Add(providers[0].Interval); }
protected override void DoWhenAllDataIsReady() { LoggedData.Add(new Datapoint <T1, T2>() { Value1 = (providers[0] as IProvider <T1>).Data, Value2 = (providers[1] as IProvider <T2>).Data }); //if (LoggedData.All(d => d.Magnitude() < 1e-10) && LoggedData.Count > 5) throw new Exception("Caught another zero list of data... WHY???"); //Timestamps.Add(Timestamps.LastOrDefault() + providers[0].Interval); Timestamps.Add(providers[0].RunTime); Intervals.Add(providers[0].Interval); }
public void Enable(SocketTextChannel channel, int interval) { if (Intervals.ContainsKey(channel)) { Intervals[channel] = interval; } else { Intervals.Add(channel, interval); } }
public void Record(string label) { _end = DateTime.Now.TimeOfDay; TCrono crono; crono.label = label; crono.crono = _end - _start; crono.from_start = _end - _initial; Intervals.Add(crono); _start = DateTime.Now.TimeOfDay; }
public void AddingWithoutOverlap() { var a = new Intervals<int>(); a.Add(0, 5); Assert.That(a.Contains(-1), Is.False); Assert.That(a.Contains(0)); Assert.That(a.Contains(1)); Assert.That(a.Contains(2)); Assert.That(a.Contains(3)); Assert.That(a.Contains(4)); Assert.That(a.Contains(5), Is.False); a.Add(6, 10); Assert.That(a.Contains(6)); Assert.That(a.Contains(7)); Assert.That(a.Contains(8)); Assert.That(a.Contains(9)); Assert.That(a.Contains(10), Is.False); a.Add(-2, -1); Assert.That(a.Contains(-3), Is.False); Assert.That(a.Contains(2)); Assert.That(a.Contains(-1), Is.False); }
public WorkoutViewModel(Workout workout) { _intervals = new ObservableCollection <IntervalViewModel>(); Workout = workout; for (int i = 0; i < workout.Intervals.Count; i++) { Intervals.Add(new IntervalViewModel(workout.Intervals[i], i)); } _intervals.CollectionChanged += OnIntervalsChanged; }
private void Initialize() { effectiveActivateIntervalImagesCommand = new DelegateCommand(obj => { //activating the command that are set externally ActivateIntervalImagesCommand.Execute(obj); ///now performing additional actions MessageBox.Show("Геологи!!! Разметка фотографии начинается с верхнего фрагмента керна!", "Направление разметки фото", MessageBoxButton.OK, MessageBoxImage.Exclamation); PhotoCalibratedBoreIntervalVM vm = obj as PhotoCalibratedBoreIntervalVM; if (vm.ImagesCount == 0) { vm.AddNewImageCommand.Execute(null); } }, obj => { //checking extrernally set conditions bool externalCanExecute = ActivateIntervalImagesCommand.CanExecute(obj); //checking local conditions PhotoCalibratedBoreIntervalVM vm = obj as PhotoCalibratedBoreIntervalVM; return(externalCanExecute && !double.IsNaN(vm.UpperDepth) && !double.IsNaN(vm.LowerDepth) && (vm.LowerDepth > vm.UpperDepth)); } ); intervals.CollectionChanged += Intervals_CollectionChanged; Intervals.Add(new PhotoCalibratedBoreIntervalVM(imageStorage)); AddNewCommand = new DelegateCommand(() => { Intervals.Add(new PhotoCalibratedBoreIntervalVM(imageStorage)); }); RemoveIntervalCommand = new DelegateCommand((arg) => { BoreIntervalVM biVM = arg as BoreIntervalVM; if (!(double.IsNaN(biVM.UpperDepth) || double.IsNaN(biVM.LowerDepth))) { var result = MessageBox.Show(string.Format("Вы уверены, что хотите идалить интервал отбора {0} - {1}? Ассоциированные с ним фотографии керна будут удалены из проекта.", biVM.UpperDepth, biVM.LowerDepth), "Удаление интервала отбора", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (result == MessageBoxResult.OK) { //System.Diagnostics.Debug.WriteLine("delete "+arg.ToString()+" request"); Intervals.Remove(biVM); } } else { Intervals.Remove(biVM); } }); }
public NamedIntervalEditorViewModel(string name, int[] intervals, bool readOnly) : this(false, readOnly) { if (null == intervals) { throw new ArgumentNullException("intervals"); } _name = name; for (int i = 0; i < intervals.Length; i++) { Intervals.Add(CreateNamedIntervalValue(intervals[i])); } }
public override void Loaded() { base.Loaded(); //settings init = true; EnableCloudBackup = _settingsStore.CloudEnabled; init = false; DailyGoal = _unitHelper.GetAmount(_settingsStore.DailyGoal).ToString(); QuietHoursEnabled = _settingsStore.QuietHoursEnabled; QuietHoursStart = _settingsStore.QuietHoursStart; QuietHoursEnd = _settingsStore.QuietHoursEnd; // Intervals Intervals.Add(new IntervalItem() { Name = _resourceRepository.GetString("remind15Min"), Value = 1 }); Intervals.Add(new IntervalItem() { Name = _resourceRepository.GetString("remind30Min"), Value = 2 }); Intervals.Add(new IntervalItem() { Name = _resourceRepository.GetString("remind45Min"), Value = 3 }); Intervals.Add(new IntervalItem() { Name = _resourceRepository.GetString("remind60Min"), Value = 4 }); Intervals.Add(new IntervalItem() { Name = _resourceRepository.GetString("remind120Min"), Value = 8 }); SelectedInterval = Intervals.FirstOrDefault(i => i.Value == _settingsStore.NotificationInterval); // Unit Systems UnitSystems.Add(new UnitSystemItem() { Id = 0, Name = _resourceRepository.GetString("unitMetric") }); UnitSystems.Add(new UnitSystemItem() { Id = 1, Name = _resourceRepository.GetString("unitUSImperial") }); SelectedUnitSystem = UnitSystems.FirstOrDefault(i => i.Id == _settingsStore.UnitSystem); DailyWaterGoalHeader = String.Format(_resourceRepository.GetString("txtDailyWaterGoal"), _unitHelper.AmountText); }
/// <summary> /// Adds new pluralized form of Localized string with its interval. /// </summary> /// <param name="pluralizationInterval">Interval when use this form of localized string.</param> /// <param name="localizedString">Assigned pluralized form.</param> /// <exception cref="PluralizedStringIntervalOverlapException">Thrown if Pluralized string already contains any /// sub-interval of paramater pluralizationInterval</exception> public void Add(PluralizationInterval pluralizationInterval, LocalizedString localizedString) { if (CheckOverlaping(pluralizationInterval)) { var overlapErrorMsg = "Intervals are overlaping in the Pluralized string."; if (m_logger != null && m_logger.IsErrorEnabled()) { m_logger.LogError(overlapErrorMsg); } throw new PluralizedStringIntervalOverlapException(overlapErrorMsg); } Intervals.Add(new IntervalWithTranslation { Interval = pluralizationInterval, LocalizedString = localizedString }); }
public void addInterval(MicroPosture initialMicroPosture, MicroPosture finalMicroPosture) { if (initialMicroPosture.PostureType != this.PostureType || finalMicroPosture.PostureType != this.PostureType) { //throw new Exception("You are adding an interval with diferent postureType to this IntervalPosture object"); Console.WriteLine("ERROR!! : You are adding an interval with diferent postureType to this IntervalPosture object"); return; } if (initialMicroPosture.SceneLocationTime >= finalMicroPosture.SceneLocationTime) { //throw new Exception("initialMicroPosture must be lower than finalMicroPosture"); Console.WriteLine("ERROR!! : initialMicroPosture must be lower than finalMicroPosture"); return; } bool exists = this.Intervals.Exists( interval => //tuple.Item1.sceneLocationTime >= initialMicroPosture.sceneLocationTime || interval.EndTime >= initialMicroPosture.SceneLocationTime ); if (exists) { //throw new Exception("The initialMicroPosture must be greater than an existent finalMicroPosture interval"); Console.WriteLine("ERROR!! : The initialMicroPosture must be greater than an existent finalMicroPosture interval"); } int threshold = Convert.ToInt32(Properties.Resources.MinPostureIntervalDuration); if (finalMicroPosture.SceneLocationTime.Subtract(initialMicroPosture.SceneLocationTime).TotalMilliseconds >= threshold) { Intervals.Add(new Interval(initialMicroPosture, finalMicroPosture)); } else { Console.WriteLine("### !! Interval SKIPPED!!: {0} - {1}", initialMicroPosture.SceneLocationTime, finalMicroPosture.SceneLocationTime); } }
public void AddInterval(Interval it) { Intervals.Add(it); }
/// <summary> /// This makes the following tree. /// <para><code> /// 25/29 /// / \ /// 0/5 42/49 /// / \ /// -100/-50 10/12 /// </code></para> /// </summary> /// <returns></returns> private static Intervals<double> MakeTree() { var a = new Intervals<double>(); a.Add(0, 5); a.Add(-100, -50); a.Add(25, 29); a.Add(10, 12); a.Add(42, 49); Assert.That(a.Count(), Is.EqualTo(5)); return a; }
public void Add(Interval interval) { Intervals.Add(interval); Synced = false; }
public Parameter(string name, string startValue, double end, string endValue) : this(name, startValue) { Intervals.Add(new Interval(end, endValue)); }
public Parameter(string name, long startValue, double end, long endValue) : this(name, startValue) { Intervals.Add(new Interval(end, endValue.ToString(CultureInfo.InvariantCulture))); }