cleanMillisecondsEpoch method

List<int?> cleanMillisecondsEpoch(
  1. List<int?> millisecondsEpoch
)

Implementation

List<int?> cleanMillisecondsEpoch(List<int?> millisecondsEpoch) {
  List<int> dec = [];
  int count = 0;
  List<int?> cleanMilli;
  if (nDecelerationList!.isNotEmpty) {
    for (int i = 1; i < nDecelerationList!.length; i++) {
      for (int j = nDecelerationList![i].getFrom();
          j <= nDecelerationList![i].getTo();
          j++) {
        dec.add(j);
      }
    }
  }
  for (int i = 0; i < millisecondsEpoch.length; i++) {
    if (millisecondsEpoch[i] == 0) {
      dec.add(i);
    }
    /*if (millisecondsEpoch[i] == 0 || millisecondsEpoch[i] > (SIXTY_THOUSAND_MS /210) || millisecondsEpoch[i] < (SIXTY_THOUSAND_MS /60) || Math.abs(millisecondsEpoch[i-1] - millisecondsEpoch[i]) > (SIXTY_THOUSAND_MS /35)) {
              dec.add(i);
          }*/
  }

  cleanMilli = List.filled(millisecondsEpoch.length - dec.length, null, growable: false);
  int j = 0;
  for (int i = 0; i < cleanMilli.length; i++) {
    if (!dec.contains(i)) {
      cleanMilli[j] = millisecondsEpoch[i];
      j++;
    }
  }
  return cleanMilli;
}