From c2ba7382b1bf764832f5726ee78cf0749c8b7f42 Mon Sep 17 00:00:00 2001 From: Alexandre Hiroyuki Date: Tue, 21 May 2024 19:12:21 -0300 Subject: [PATCH] refactor(DataTomeMvAvg): :art: mean and count aliases now belongs to DataTomeMvAvg instead of DataTomeAnalysis Mean and count aliases now belongs to DataTomeMvAvg instead of DataTomeAnalysis. Comments were fixed to reflect the changes. keywords.txt was updated. --- README.md | 2 +- keywords.txt | 15 +++++++++++++++ library.json | 4 +++- src/DataTomeAnalysis.h | 18 ------------------ src/DataTomeMvAvg.h | 16 ++++++++++++++++ 5 files changed, 35 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 85c7c1a..0232815 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Top Language](https://img.shields.io/github/languages/top/AlexandreHiroyuki/DataTome)](https://github.com/AlexandreHiroyuki/DataTome)

- +

## Description diff --git a/keywords.txt b/keywords.txt index e7bd8b1..bfcab9b 100644 --- a/keywords.txt +++ b/keywords.txt @@ -17,6 +17,7 @@ DataTomeAnalysis KEYWORD1 push KEYWORD2 get KEYWORD2 get_by_brute KEYWORD2 +mean KEYWORD2 front KEYWORD2 back KEYWORD2 @@ -24,21 +25,35 @@ back KEYWORD2 atIndex KEYWORD2 size KEYWORD2 point_count KEYWORD2 +count KEYWORD2 +grow KEYWORD2 resize KEYWORD2 clear KEYWORD2 partial_create KEYWORD2 partial_get KEYWORD2 +partial_mean KEYWORD2 partial_size KEYWORD2 partial_point_count KEYWORD2 +partial_count KEYWORD2 ####################################### # Methods and Functions (KEYWORD2) # DataTomeAnalysis ####################################### +min KEYWORD2 +max KEYWORD2 +median KEYWORD2 +lowest_mode KEYWORD2 +highest_mode KEYWORD2 std KEYWORD2 var KEYWORD2 +partial_min KEYWORD2 +partial_max KEYWORD2 +partial_median KEYWORD2 +partial_lowest_mode KEYWORD2 +partial_highest_mode KEYWORD2 partial_var KEYWORD2 partial_std KEYWORD2 \ No newline at end of file diff --git a/library.json b/library.json index 2106769..cfea009 100644 --- a/library.json +++ b/library.json @@ -43,7 +43,9 @@ ], "export": { "exclude": [ - ".github" + ".github", + ".gitignore", + ".vscode" ] }, "srcDir": "src" diff --git a/src/DataTomeAnalysis.h b/src/DataTomeAnalysis.h index f780d2d..e9d7ec6 100644 --- a/src/DataTomeAnalysis.h +++ b/src/DataTomeAnalysis.h @@ -18,13 +18,6 @@ class DataTomeAnalysis : public DataTomeMvAvg { public: DataTomeAnalysis(size_t size) : DataTomeMvAvg(size) {} - /** Aliases **/ - - TypeOfArray mean() { return this->get(); } - size_t count() { return this->point_count(); } - - /** Proper Methods **/ - TypeOfArray min() { TypeOfArray min = (*this)[0]; for (size_t i = 1; i < this->point_count(); i++) { @@ -150,17 +143,6 @@ class DataTomeAnalysis : public DataTomeMvAvg { /** Partial Methods **/ - /** Aliases **/ - - TypeOfArray partial_mean(size_t partial_id) { - return this->partial_get(partial_id); - } - size_t partial_count(size_t partial_id) { - return this->partial_size(partial_id); - } - - /** Proper Methods **/ - TypeOfArray partial_min(size_t partial_id) { TypeOfArray min = (*this)[0]; for (size_t i = 1; i < this->partial_point_count(partial_id); i++) { diff --git a/src/DataTomeMvAvg.h b/src/DataTomeMvAvg.h index 5aa4916..60588d7 100644 --- a/src/DataTomeMvAvg.h +++ b/src/DataTomeMvAvg.h @@ -75,6 +75,10 @@ class DataTomeMvAvg { // @alias get_by_brute return get_by_brute(n_points); } + TypeOfArray mean() { + // @alias get + return get(); + } TypeOfArray get_by_brute(size_t n_points) { if (n_points > _average_counter) n_points = _average_counter; @@ -127,6 +131,10 @@ class DataTomeMvAvg { size_t size_of_memory() { return _array_size * sizeof(TypeOfArray); } size_t point_count() { return _average_counter; } + size_t count() { + // @alias point_count + return point_count(); + } /** Modify array **/ @@ -197,6 +205,10 @@ class DataTomeMvAvg { return _partial_sums[id] / ((_average_counter == 0) ? 1 : _average_counter); } + TypeOfArray partial_mean(size_t id) { + // @alias partial_get + return partial_get(id); + } size_t partial_size_of_array(size_t id) { if (id > _partial_sums_counter) return 0; @@ -214,6 +226,10 @@ class DataTomeMvAvg { else return _average_counter; } + size_t partial_count(size_t id) { + // @alias partial_point_count + return partial_point_count(id); + } size_t partials_memory() { return sizeof(_partial_sums_counter) + sizeof(_partial_sums) +