getMinSymbolSize method

int getMinSymbolSize(
  1. int minimum
)

Returns the capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal number of codewords.

Implementation

int getMinSymbolSize(int minimum) {
  switch (input.shapeHint) {
    case SymbolShapeHint.forceSquare:
      for (int capacity in squareCodewordCapacities) {
        if (capacity >= minimum) {
          return capacity;
        }
      }
      break;
    case SymbolShapeHint.forceRectangle:
      for (int capacity in rectangularCodewordCapacities) {
        if (capacity >= minimum) {
          return capacity;
        }
      }
      break;
    case SymbolShapeHint.forceNone:
      break;
  }
  for (int capacity in allCodewordCapacities) {
    if (capacity >= minimum) {
      return capacity;
    }
  }
  return allCodewordCapacities[allCodewordCapacities.length - 1];
}