createDecoder static method

AbstractExpandedDecoder createDecoder(
  1. BitArray information
)

Implementation

static AbstractExpandedDecoder createDecoder(BitArray information) {
  if (information.get(1)) {
    return AI01AndOtherAIs(information);
  }
  if (!information.get(2)) {
    return AnyAIDecoder(information);
  }

  final fourBitEncodationMethod =
      GeneralAppIdDecoder.extractNumericFromBitArray(information, 1, 4);

  switch (fourBitEncodationMethod) {
    case 4:
      return AI013103Decoder(information);
    case 5:
      return AI01320xDecoder(information);
  }

  final fiveBitEncodationMethod =
      GeneralAppIdDecoder.extractNumericFromBitArray(information, 1, 5);
  switch (fiveBitEncodationMethod) {
    case 12:
      return AI01392xDecoder(information);
    case 13:
      return AI01393xDecoder(information);
  }

  final sevenBitEncodationMethod =
      GeneralAppIdDecoder.extractNumericFromBitArray(information, 1, 7);
  switch (sevenBitEncodationMethod) {
    case 56:
      return AI013x0x1xDecoder(information, '310', '11');
    case 57:
      return AI013x0x1xDecoder(information, '320', '11');
    case 58:
      return AI013x0x1xDecoder(information, '310', '13');
    case 59:
      return AI013x0x1xDecoder(information, '320', '13');
    case 60:
      return AI013x0x1xDecoder(information, '310', '15');
    case 61:
      return AI013x0x1xDecoder(information, '320', '15');
    case 62:
      return AI013x0x1xDecoder(information, '310', '17');
    case 63:
      return AI013x0x1xDecoder(information, '320', '17');
  }

  throw StateError('unknown decoder: $information');
}