From b7df16ffd7a87b9bf5a482c81c90e7aee1eb073d Mon Sep 17 00:00:00 2001 From: John Colvin Date: Wed, 20 Nov 2024 07:10:21 +0000 Subject: [PATCH] refactor: Rename snake_case fns PascalCase --- .../spark/AW2/ViewModel/VolSurfaceTimeDecayEditorVM.cs | 2 +- .../spark_core/Collections/Extensions/ListExtensions.cs | 6 +++--- .../spark_core/Collections/ObservableSortedCollection.cs | 2 +- src/client/spark_core/utils/ArrayUtils.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/spark/AW2/ViewModel/VolSurfaceTimeDecayEditorVM.cs b/src/client/spark/AW2/ViewModel/VolSurfaceTimeDecayEditorVM.cs index cadab74f0..9079f10d8 100644 --- a/src/client/spark/AW2/ViewModel/VolSurfaceTimeDecayEditorVM.cs +++ b/src/client/spark/AW2/ViewModel/VolSurfaceTimeDecayEditorVM.cs @@ -29,7 +29,7 @@ _model.get_active_time_decay_points().empty_if_null() .Select(tup => new TimeDecayItem(tup.Item1, tup.Item2, this))); add_item = new DelegateCommand(() => { - time_decay_items.insert_sorted_if_distinct( + time_decay_items.InsertSortedDistinct( new TimeDecayItem(_new_actual_time.result ?? throw new InvalidOperationException($"'{nameof(new_actual_time)}' does not have a value"), double.NaN, this), Comparer.Default.wrap(tdi => tdi.actual_time.TimeOfDay)); }, diff --git a/src/client/spark_core/Collections/Extensions/ListExtensions.cs b/src/client/spark_core/Collections/Extensions/ListExtensions.cs index 904d084d1..47589521b 100644 --- a/src/client/spark_core/Collections/Extensions/ListExtensions.cs +++ b/src/client/spark_core/Collections/Extensions/ListExtensions.cs @@ -68,11 +68,11 @@ namespace bts.collections { list.Insert(i < 0 ? ~i : i, value); } - public static bool insert_sorted_if_distinct(this IList list, T item) + public static bool InsertSortedDistinct(this IList list, T item) where T : IComparable => - insert_sorted_if_distinct(list, item, Comparer.Default); + InsertSortedDistinct(list, item, Comparer.Default); - public static bool insert_sorted_if_distinct(this IList list, T item, IComparer comparer) { + public static bool InsertSortedDistinct(this IList list, T item, IComparer comparer) { int i = CollectionHelper.binary_search(list, item, comparer); if (i < 0) { list.Insert(~i, item); diff --git a/src/client/spark_core/Collections/ObservableSortedCollection.cs b/src/client/spark_core/Collections/ObservableSortedCollection.cs index 7195e5f2f..753e43c98 100644 --- a/src/client/spark_core/Collections/ObservableSortedCollection.cs +++ b/src/client/spark_core/Collections/ObservableSortedCollection.cs @@ -101,7 +101,7 @@ namespace Spark.Core.Collections { CollectionHelper.binary_search(_values, item, 0, _size, _comparer, _eq_comparer); void _insert_and_notify(int index, T item) { - ArrayHelper.insert(ref _values, index, item, ref _size); + ArrayHelper.Insert(ref _values, index, item, ref _size); CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Count))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(CollectionHelper.indexer_name)); diff --git a/src/client/spark_core/utils/ArrayUtils.cs b/src/client/spark_core/utils/ArrayUtils.cs index 7a0e8e518..0e3d9e366 100644 --- a/src/client/spark_core/utils/ArrayUtils.cs +++ b/src/client/spark_core/utils/ArrayUtils.cs @@ -92,7 +92,7 @@ namespace bts.utils { return result; } - public static void insert(ref T[] array, int index, T value, ref int size) { + public static void Insert(ref T[] array, int index, T value, ref int size) { // validate size/index if (size < 0) throw ExceptionBuilder.ArgumentOutOfRange.lt_zero(nameof(size));