Complement static method

List<int> Complement(
  1. LexoNumeralSystem sys,
  2. List<int> mag,
  3. int digits
)

Implementation

static List<int> Complement(
    LexoNumeralSystem sys, List<int> mag, int digits) {
  if (digits <= 0) {
    throw AssertionError('Expected at least 1 digit');
  }
  final nmag = List<int>.filled(digits, sys.getBase() - 1);
  for (var i = 0; i < mag.length; ++i) {
    nmag[i] = sys.getBase() - 1 - mag[i];
  }
  return nmag;
}