removeDecelerationMinutes method
void
removeDecelerationMinutes()
Implementation
void removeDecelerationMinutes() {
int minutes =
(millisecondsEpoch.length / NO_OF_SAMPLES_PER_MINUTE).truncate();
List<int> minuteRanges = [];
//List<int> decelerationMinutes = new int[decelerationsList.length * 2];
//expanding the areas to minute
for (int i = 0; i < decelerationsList!.length; i++) {
int from = (decelerationsList![i].getFrom() / FACTOR).truncate();
int to = (decelerationsList![i].getTo() / FACTOR).truncate();
from = from - (from % NO_OF_SAMPLES_PER_MINUTE);
to = to - (to % NO_OF_SAMPLES_PER_MINUTE);
to = to + NO_OF_SAMPLES_PER_MINUTE;
from = ((from + 1) / NO_OF_SAMPLES_PER_MINUTE).truncate();
to = ((to - 1) / NO_OF_SAMPLES_PER_MINUTE).truncate();
while (from <= to) {
if(from<minutes) {
minuteRanges.add(from);
}
from++;
}
}
List<int> finalMinutesToRemove = [];
for (int j = 0; j < minuteRanges.length; j++) {
int i = minuteRanges[j];
if (!finalMinutesToRemove.contains(i)) {
finalMinutesToRemove.add(i);
}
}
//identifying the miutes to remove
/*List<int> min = new List<>();
min.add(decelerationMinutes[0] / NO_OF_SAMPLES_PER_MINUTE);
for (int i = 1; i < decelerationMinutes.length - 1; i++) {
if (decelerationMinutes[i - 1] != decelerationMinutes[i]) {
min.add(decelerationMinutes[i] / NO_OF_SAMPLES_PER_MINUTE);
}
}*/
//removing the minutes with decelerations
int newLength = (minutes* NO_OF_SAMPLES_PER_MINUTE)-
(finalMinutesToRemove.length * NO_OF_SAMPLES_PER_MINUTE);
cleanMillisecondsEpoch = List.filled(newLength, null, growable: false);
cleanMillisecondsEpochBpm = List.filled(newLength, null, growable: false);
cleanBaselineEpoch = List.filled(newLength, null, growable: false);
cleanBaselineEpochBpm = List.filled(newLength, null, growable: false);
int c = 0;
for (int interval = 0; interval < minutes; interval++) {
if (finalMinutesToRemove.contains(interval)) continue;
int start = interval * NO_OF_SAMPLES_PER_MINUTE;
int limit = start + NO_OF_SAMPLES_PER_MINUTE; //((1 + interval) * NO_OF_SAMPLES_PER_MINUTE) - 1;
for (int i = start; i < limit; i++) {
cleanMillisecondsEpoch![c] = millisecondsEpoch[i];
cleanMillisecondsEpochBpm[c] = millisecondsEpochBpm[i];
cleanBaselineEpoch[c] = baselineEpoch[i];
cleanBaselineEpochBpm[c++] = baselineEpochBpm[i];
}
}
}