Class ExcelAssistant

java.lang.Object
microsim.data.excel.ExcelAssistant

public class ExcelAssistant extends Object
  • Constructor Details

    • ExcelAssistant

      public ExcelAssistant()
  • Method Details

    • loadCoefficientMap

      @Nullable public static @Nullable MultiKeyCoefficientMap loadCoefficientMap(@NonNull @NonNull String excelFileName, @NonNull @NonNull String sheetName, int keyColumns, int valueColumns)
      Loads MultiKeyCoefficientMap from Excel spreadsheet data, reading from the first line of the spreadsheet, and automatically finds the last line of the spreadsheet.
      Parameters:
      excelFileName - An Excel workbook (*.xls or *.xlsx) that stores the data.
      sheetName - An Excel worksheet name that stores the data.
      keyColumns - The number of columns (stored to the left of the worksheet) that represent keys. This will equal the number of keys of the MultiKeyCoefficientMap that is returned.
      valueColumns - The number of columns (stored to the right of the keys in the worksheet) that represents values, not keys. This will equal the size of the values[] array for each MultiKey in the MultiKeyCoefficientMap.
      Returns:
      an instance of MultiKeyCoefficientMap with coefficients and their corresponding labels.
      Throws:
      NullPointerException - when excelFileName, or sheetName, or both are null.
      See Also:
      Implementation Requirements:
      Default startLine is first line of Excel spreadsheet. endLine will be found automatically. Blank lines are not allowed.
    • loadCoefficientMap

      @Nullable public static @Nullable MultiKeyCoefficientMap loadCoefficientMap(@NonNull @NonNull String excelFileName, @NonNull @NonNull String sheetName, int keyColumns, int valueColumns, int startLine, int endLine)
      Load MultiKeyCoefficientMap from Excel spreadsheet data, choosing which line to start reading from via the startLine parameter.
      Parameters:
      excelFileName - An Excel workbook (*.xls or *.xlsx) that stores the data.
      sheetName - An Excel worksheet name that stores the data.
      keyColumns - The number of columns (stored to the left of the worksheet) that represent keys. This will equal the number of keys of the MultiKeyCoefficientMap that is returned.
      valueColumns - The number of columns (stored to the right of the keys in the worksheet) that represents values, not keys. This will equal the size of the values[] array for each MultiKey in the MultiKeyCoefficientMap.
      startLine - Parameter specifying the (physical, not logical) Excel row number at which to start reading (1 is the first line)
      endLine - Parameter specifying the (physical, not logical) Excel row number at which to finish reading (1 is the first line)
      Returns:
      an instance of MultiKeyCoefficientMap with coefficients and their respective labels.
      Throws:
      NullPointerException - when excelFileName, or sheetName, or both are null.
      Implementation Requirements:
      startLine and endLine are physical (not logical) rows, therefore they have to be decremented by 1.