If converters are set on a table, this function tests if these can convert a cell value. The first
converter, which claims that it can convert, will be used to do the conversion.
768766
private Object tryConvert(
            final MfClientHttpRequestFactory clientHttpRequestFactory,
            final Object rowValue) throws URISyntaxException, IOException {
        if (this.converters.isEmpty()) {
            return rowValue;
        }

        String value = String.valueOf(rowValue);
        for (TableColumnConverter<?> converter: this.converters) {
            if (converter.canConvert(value)) {
                return converter.resolve(clientHttpRequestFactory, value);
            }
        }

        return rowValue;
    }
172516
def are_worth_chaining(first_converter: Converter, second_converter: Converter) -> bool:
        
        if isinstance(first_converter, ConversionChain):
            if isinstance(second_converter, ConversionChain):
                # BOTH are chains
                for sec_conv in second_converter._converters_list:
                    for fir_conv in first_converter._converters_list:
                        if not Converter.are_worth_chaining(fir_conv, sec_conv):
                            return False
            else:
                for fir_conv in first_converter._converters_list:
                    if not Converter.are_worth_chaining(fir_conv, second_converter):
                        return False
        else:
            if isinstance(second_converter, ConversionChain):
                for sec_conv in second_converter._converters_list:
                    if not Converter.are_worth_chaining(first_converter, sec_conv):
                        return False
            else:
                # Neither is a chain
                if not Converter.are_worth_chaining(first_converter, second_converter):
                    return False

        # finally return True if nothing proved otherwise
        return True
655707
public static <A, B, C, D> Converter<Example<A, B>, Example<C, D>> converter(
      Converter<A, C> inputConverter, Converter<B, D> outputConverter) {
    return new ExampleConverter<A, B, C, D>(inputConverter, outputConverter);
  }
962211
function (cell) {
      var value,
          fnCellValue = instance.custom.cellValue,
          element = this,
          item = instance.matrix.getItem(cell);

      // check if custom cellValue fn exists
      if (instance.utils.isFunction(fnCellValue)) {

        var cellCoords = instance.utils.cellCoords(cell),
            cellId = instance.utils.translateCellCoords({row: element.row, col: element.col});

        // get value
        value = item ? item.value : fnCellValue(cellCoords.row, cellCoords.col);

        if (instance.utils.isNull(value)) {
          value = 0;
        }

        if (cellId) {
          //update dependencies
          instance.matrix.updateItem(cellId, {deps: [cell]});
        }

      } else {

        // get value
        value = item ? item.value : document.getElementById(cell).value;

        //update dependencies
        instance.matrix.updateElementItem(element, {deps: [cell]});
      }

      // check references error
      if (item && item.deps) {
        if (item.deps.indexOf(cellId) !== -1) {
          throw Error('REF');
        }
      }

      // check if any error occurs
      if (item && item.error) {
        throw Error(item.error);
      }

      // return value if is set
      if (instance.utils.isSet(value)) {
        var result = instance.helper.number(value);

        return !isNaN(result) ? result : value;
      }

      // cell is not available
      throw Error('NOT_AVAILABLE');
    }
1334873
function(callback, scope, args) {
        var mArgs = [null];
        if (!scope) {
          scope = this;
        }
        if (args) {
            if (!_isArr(args)) {
              args = [args];
            }
            mArgs = mArgs.concat(args);
        }
        var ord;
        while (ord !== -1 && this.hasMoreCells()){
            ord = this.nextCell();
            mArgs[0] = this.readCell();
            if (callback.apply(scope, mArgs)===false) {
              return false;
            }
        }
        this._idx = 0;
        return true;
    }
1243554
function convertA1toR1C1 (ref) {
  if (!A1.test(ref)) {
    throw new Error(`${ref} is not a valid A1 cell reference`)
  }

  var refParts = ref
    .replace(A1, '$1,$2')
    .split(',')

  var columnStr = refParts[0]
  var row = refParts[1]
  var column = 0

  for (var i = 0; i < columnStr.length; i++) {
    column = 26 * column + columnStr.charCodeAt(i) - 64
  }

  return `R${row}C${column}`
}
754761
function(ev, rowIndex) {
		
		// Get a particular CellEditor
		var elCell = ev.target, oColumn;
		elCell = this.datatable.getTdEl(elCell);
		if(elCell) {
			oColumn = this.datatable.getColumn(elCell);
			if(oColumn && oColumn.editor) {
				var oCellEditor = this.datatable._oCellEditor;
				// Clean up active CellEditor
				if(oCellEditor) {
					// Return if field isn't validated
					if( !oCellEditor._inputExField.validate() ) {
						return;
					}
				}
			}
		}

		// Only if the cell is inputEx valid
		this.datatable.onEventShowCellEditor(ev);
		
   }
4101
def flag_on?(column_value, bitset, flag)
      val = column_value || 0
      (val & bitset.const_get(flag)) != 0
    end
404319
public boolean isConverterInPath(ScreenComponent sField)
    {
        Convert converter = sField.getConverter();
        while (converter != null)
        {
            if (converter == this)
                return true;
            if (converter instanceof LinkedConverter)
            {
                MultipleFieldConverter convMultiple = null;
                boolean bOldEnable = false;
                if (converter instanceof MultipleFieldConverter)
                    convMultiple = (MultipleFieldConverter)converter;
                if (convMultiple != null)
                    bOldEnable = convMultiple.setEnableTranslation(false);
                converter = ((LinkedConverter)converter).getNextConverter();
                if (convMultiple != null)
                    convMultiple.setEnableTranslation(bOldEnable);
            }
            else
                converter = null;
        }
        return false;   // Not found
    }
367907
function (formatter) {
    this.formatter = formatter;

    /**
     * Convert 
     *
     * @param filePath input ods file path
     */
    this.convert = function (filePath) {
        log('Message resource converter');
        log('Execute convert: ' + filePath);

        var excelApp = new ActiveXObject('Excel.Application');
        excelApp.Visible = true;
        log('Start');
        var book = excelApp.Workbooks.Open(filePath);
        var sheet = book.Worksheets(1);
        this.extractResources(sheet);
        log("End");
        book.Close(false);
        excelApp.Quit();
        excelApp = null;
    };

    this.data = [];
    this.fillData = function (sheet, lastCol, lastRow) {
      WScript.StdOut.Write('                        \r');
      this.data.push(undefined);
      for (var r = 1; r <= lastRow; r++) {
        var row = [];
        row.push(undefined);
        for (var c = 1; c <= lastCol; c++) {
          row.push(sheet.Cells(r, c).Value);
        }
        this.data.push(row);
        WScript.StdOut.Write('\rLoading... ' + r + ' / ' + lastRow);
      }
      WScript.StdOut.WriteLine();
    };
    this.value = function (row, col) {
        if (row >= this.data.length) throw Error('Array index out of range error(row): ' + row + ' in ' + this.data.length);
        if (col >= this.data[row].length) throw Error('Array index out of range error(col): ' + col + ' in ' + this.data[row].length);
        return this.data[row][col];
    };
    this.getLocaleColIndex = function(locale) {
        for (var col = 1; col < 100; col++) {
            if (this.value(3, col).toLowerCase() === locale.toLowerCase()) {
                return col;
            }
        }
        throw new Error('ref locale "' + locale + '" not found');
    };
    this.getRealValue = function (row, col) {
        var v = this.value(row, col);
        if (v === '^') {
            return this.getRealValue(row, col - 1);
        } else if (v === undefined) {
            return '';
        } else if (v.length > 1 && v.charAt(0) === '^') {
            var m = v.match(/^\^([a-z]+[\-_][a-zA-Z]+)$/);
            if (m) {
                var refLocaleCol = this.getLocaleColIndex(m[1]);
                return this.getRealValue(row, refLocaleCol);
            }
        }
        return v;
    };
    this.extractResources = function (sheet) {
        var locales = [];
        var lastLocaleCol = 1;
        var startLocaleCol = 4;
        for (var col = startLocaleCol, cellValue; cellValue = sheet.Cells(3, col).Value; col++) {
            lastLocaleCol = col;
        }
        var lastKeyRow = this.getLastKeyRow(sheet, 5);
        this.fillData(sheet, lastLocaleCol, lastKeyRow);
        console.log('Writing files...');
        var locales = [];
        for (var col = startLocaleCol; col <= lastLocaleCol; col++) {
            var localeKey = this.value(3, col);
            var lines = [];
            for (var row = 4; row <= lastKeyRow; row++) {
                var key = this.value(row, 3);
                var v = this.getRealValue(row, col);
                if (key) {
                    if (key.substr(0, 1) === '#') {
                        lines.push(formatter.formatComment(key));
                    } else {
                        if (row === lastKeyRow) {
                            lines.push(formatter.formatLastLine(key, v));
                        } else {
                            lines.push(formatter.formatLine(key, v));
                        }
                    }
                } else {
                    lines.push(''); // empty line
                }
            }
            locales.push(localeKey);
            this.writeSingleResourceFile(localeKey, formatter.normalizeLines(lines));
        }
        console.log('Wrote ' + locales.length + ' files in messages/ directory.');
    };
    this.writeSingleResourceFile = function (localeKey, lines) {
        var folderName = formatter.folderName;
        if (!fso.FolderExists(folderName)) {
            fso.CreateFolder(folderName);
        }
        // const
        var adTypeBinary = 1; // Binary
        var adTypeText = 2; // Text
        var adWriteChar = 0; // no EOL
        var adSaveCreateOverWrite = 2; // create or over write

        var filename = formatter.getFilePath(folderName, localeKey);
        var sw = new ActiveXObject('ADODB.Stream');
        sw.Type = adTypeText;
        sw.charset = 'utf-8';
        sw.Open();
        var headerText = formatter.formatHeader(localeKey);
        sw.WriteText(headerText, adWriteChar);
        for (var i = 0; i < lines.length; i++) {
            sw.WriteText(lines[i], adWriteChar);
        }
        var footerText = formatter.formatFooter(localeKey);
        sw.WriteText(footerText, adWriteChar);
        // Change to binary mode
        sw.Position = 0;
        sw.Type = adTypeBinary;
        // UTF-8 BOM
        if (outputBOM) {
            // Keep UTF-8 BOM
            sw.Position = 0;
        } else {
            // Skip UTF-8 BOM
            sw.Position = 3;
        }
        var binBlock = sw.Read();
        sw.Close();

        // Write binBlock as binary
        var os = new ActiveXObject('ADODB.Stream');
        os.Type = adTypeBinary;
        os.Open();
        os.Write(binBlock);
        os.SaveToFile(filename, adSaveCreateOverWrite);
        if (formatter.requireDefaultFile && formatter.isDefaultLocale(localeKey)) {
            var filenameOriginal = formatter.getDefaultFilePath(folderName);
            os.SaveToFile(filenameOriginal, adSaveCreateOverWrite);
        }
        os.Close();
    };

    // True if there are 
    this.getLastKeyRow = function (sheet, startRow) {
        var isBlank10rows = function (row) {
            for (var i = 0; i < 10; i++) {
                if (sheet.Cells(row + i, 3).Value) {
                    return false;
                }
            }
            return true;
        };
        for (var j = startRow; j < 5000; j++) { 
            if (isBlank10rows(j)) {
                return j - 1;
            }
        }
        return startRow;
    };
    return this;
}
1108987
function convertR1C1toA1 (ref) {
  if (!R1C1.test(ref)) {
    throw new Error(`${ref} is not a valid R1C1 cell reference`)
  }

  var refParts = ref
    .replace(R1C1, '$1,$2')
    .split(',')

  var row = refParts[0]
  var column = refParts[1]
  var columnStr = ''

  for (; column; column = Math.floor((column - 1) / 26)) {
    columnStr = String.fromCharCode(((column - 1) % 26) + 65) + columnStr
  }

  return columnStr + row
}
918382
function convertRenderer (cell) {
  const {renderer} = cell
  if (renderer === undefined) {
    return
  }
  const basicRenderers = [
    'boolean',
    'string',
    'number'
  ]
  if (basicRenderers.indexOf(renderer) >= 0) {
    return {name: renderer}
  }
  return customRenderer(renderer, cell.properties)
}
927829
private static Object convert(Class<?> clazz, String value) {
      /* TODO create a new Converter class and move this method there for reuse */

        if (Integer.class.equals(clazz) || int.class.equals(clazz)) {
            return Integer.valueOf(value);
        } else if (Double.class.equals(clazz) || double.class.equals(clazz)) {
            return Double.valueOf(value);
        } else if (Long.class.equals(clazz) || long.class.equals(clazz)) {
            return Long.valueOf(value);
        } else if (Boolean.class.equals(clazz) || boolean.class.equals(clazz)) {
            return Boolean.valueOf(value);
        }

        return value;
    }
963349
def convert_ref2d(cell, _class)
    # Convert the cell reference
    row, col = cell_to_packed_rowcol(cell)

    # The ptg value depends on the class of the ptg.
    if    (_class == 0)
      ptgref = [@ptg['ptgRef']].pack("C")
    elsif (_class == 1)
      ptgref = [@ptg['ptgRefV']].pack("C")
    elsif (_class == 2)
      ptgref = [@ptg['ptgRefA']].pack("C")
    else
      exit "Unknown function class in formula\n"
    end

    ptgref + row + col
  end
1127949
function Converter(srcAlphabet, dstAlphabet) {
    if (!srcAlphabet || !dstAlphabet || !srcAlphabet.length || !dstAlphabet.length) {
        throw new Error('Bad alphabet');
    }
    this.srcAlphabet = srcAlphabet;
    this.dstAlphabet = dstAlphabet;
}
695177
function(){
		this.decodeCell( function(cell,ca){
			if     (ca==="-"){ cell.qnum = -2;}
			else if(ca!=="."){ cell.qnum = +ca;}
		});
	}
886835
private boolean checkForMapValue(TabularType pType) {
        CompositeType rowType = pType.getRowType();
        // Two entries in the row: "key" and "value"
        return rowType.containsKey(TD_KEY_VALUE) && rowType.containsKey(TD_KEY_KEY) && rowType.keySet().size() == 2;
    }