From 53f53d659ec019eeee2957d8542ce54b8ceb9070 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 23 Nov 2020 21:55:03 +0100 Subject: [PATCH] Make CircularArray class self-contained and an independant module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/assets/configs-aws | 2 +- src/utils/CircularArray.ts | 6 +++--- src/utils/Constants.ts | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/assets/configs-aws b/src/assets/configs-aws index b042164e..c08cc2be 160000 --- a/src/assets/configs-aws +++ b/src/assets/configs-aws @@ -1 +1 @@ -Subproject commit b042164ef7144070be0fe1af2ce310bc512803aa +Subproject commit c08cc2beb3cbed8907a2f1c84ea7bc698131714c diff --git a/src/utils/CircularArray.ts b/src/utils/CircularArray.ts index 12aa2b18..319b6924 100644 --- a/src/utils/CircularArray.ts +++ b/src/utils/CircularArray.ts @@ -1,11 +1,11 @@ -import Constants from './Constants'; export default class CircularArray extends Array { public size: number; + private readonly MAXIMUM_CIRCULAR_ARRAY_SIZE = 2000; - constructor(size: number = Constants.MAXIMUM_MEASUREMENTS_NUMBER) { + constructor(size?: number) { super(); - this.size = size; + this.size = size && size <= this.MAXIMUM_CIRCULAR_ARRAY_SIZE ? size : this.MAXIMUM_CIRCULAR_ARRAY_SIZE; } push(...items: T[]): number { diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 56652b37..eab54ea5 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -50,7 +50,5 @@ export default class Constants { static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms static readonly CHARGING_STATION_ATG_WAIT_TIME = 2000; // Ms - static readonly MAXIMUM_MEASUREMENTS_NUMBER = 2000; - static readonly TRANSACTION_DEFAULT_IDTAG = '00000000'; } -- 2.34.1