Package microsim.data.excel
Class ExcelAssistant
java.lang.Object
microsim.data.excel.ExcelAssistant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable MultiKeyCoefficientMaploadCoefficientMap(@NonNull String excelFileName, @NonNull String sheetName, int keyColumns, int valueColumns) LoadsMultiKeyCoefficientMapfrom Excel spreadsheet data, reading from the first line of the spreadsheet, and automatically finds the last line of the spreadsheet.static @Nullable MultiKeyCoefficientMaploadCoefficientMap(@NonNull String excelFileName, @NonNull String sheetName, int keyColumns, int valueColumns, int startLine, int endLine) LoadMultiKeyCoefficientMapfrom Excel spreadsheet data, choosing which line to start reading from via thestartLineparameter.
-
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) LoadsMultiKeyCoefficientMapfrom 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 (*.xlsor*.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 theMultiKeyCoefficientMapthat 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 thevalues[]array for eachMultiKeyin theMultiKeyCoefficientMap.- Returns:
- an instance of
MultiKeyCoefficientMapwith coefficients and their corresponding labels. - Throws:
NullPointerException- whenexcelFileName, orsheetName, or both arenull.- See Also:
- Implementation Requirements:
- Default
startLineis first line of Excel spreadsheet.endLinewill 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) LoadMultiKeyCoefficientMapfrom Excel spreadsheet data, choosing which line to start reading from via thestartLineparameter.- Parameters:
excelFileName- An Excel workbook (*.xlsor*.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 theMultiKeyCoefficientMapthat 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 thevalues[]array for eachMultiKeyin theMultiKeyCoefficientMap.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
MultiKeyCoefficientMapwith coefficients and their respective labels. - Throws:
NullPointerException- whenexcelFileName, orsheetName, or both arenull.- Implementation Requirements:
startLineandendLineare physical (not logical) rows, therefore they have to be decremented by 1.
-