getVersionForDimensions static method

Version getVersionForDimensions(
  1. int numRows,
  2. int numColumns
)

Deduces version information from Data Matrix dimensions.

@param numRows Number of rows in modules @param numColumns Number of columns in modules @return Version for a Data Matrix Code of those dimensions @throws FormatException if dimensions do correspond to a valid Data Matrix size

Implementation

static Version getVersionForDimensions(int numRows, int numColumns) {
  if ((numRows & 0x01) != 0 || (numColumns & 0x01) != 0) {
    throw FormatsException.instance;
  }

  for (Version version in _versions) {
    if (version._symbolSizeRows == numRows &&
        version._symbolSizeColumns == numColumns) {
      return version;
    }
  }

  throw FormatsException.instance;
}