setThresholdsOfAttenuationInDb method

void setThresholdsOfAttenuationInDb(
  1. List<int> thresholdOfAttenuationInDb,
  2. List<double> weightsOfAttenuationBucket
)

Implementation

void setThresholdsOfAttenuationInDb(List<int> thresholdOfAttenuationInDb,
    List<double> weightsOfAttenuationBucket) {
  for (int i = 0; i < thresholdOfAttenuationInDb.length; i++) {
    if (!(thresholdOfAttenuationInDb[i] >= 0 &&
        thresholdOfAttenuationInDb[i] <= 255)) {
      throw ArgumentError("thresholdOfAttenuationInDb must be in [0,255]");
    }
    if (i != 0) {
      if (!(thresholdOfAttenuationInDb[i - 1] <=
          thresholdOfAttenuationInDb[i])) {
        throw ArgumentError(
            "thresholdOfAttenuationInDb[${i - 1}] must be smaller than thresholdOfAttenuationInDb[$i]");
      }
    }
  }
  this.thresholdOfAttenuationInDb =
      List<int>.from(thresholdOfAttenuationInDb);
  this.weightsOfAttenuationBucket =
      List<double>.from(weightsOfAttenuationBucket);
}