Package microsim.data.excel
Class ExcelAssistant
java.lang.Object
microsim.data.excel.ExcelAssistant
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable MultiKeyCoefficientMap
loadCoefficientMap
(@NonNull String excelFileName, @NonNull String sheetName, int keyColumns, int valueColumns) LoadsMultiKeyCoefficientMap
from Excel spreadsheet data, reading from the first line of the spreadsheet, and automatically finds the last line of the spreadsheet.static @Nullable MultiKeyCoefficientMap
loadCoefficientMap
(@NonNull String excelFileName, @NonNull String sheetName, int keyColumns, int valueColumns, int startLine, int endLine) LoadMultiKeyCoefficientMap
from Excel spreadsheet data, choosing which line to start reading from via thestartLine
parameter.
-
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) LoadsMultiKeyCoefficientMap
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 theMultiKeyCoefficientMap
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 thevalues[]
array for eachMultiKey
in theMultiKeyCoefficientMap
.- Returns:
- an instance of
MultiKeyCoefficientMap
with coefficients and their corresponding labels. - Throws:
NullPointerException
- whenexcelFileName
, orsheetName
, or both arenull
.- 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) LoadMultiKeyCoefficientMap
from Excel spreadsheet data, choosing which line to start reading from via thestartLine
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 theMultiKeyCoefficientMap
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 thevalues[]
array for eachMultiKey
in 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
MultiKeyCoefficientMap
with coefficients and their respective labels. - Throws:
NullPointerException
- whenexcelFileName
, orsheetName
, or both arenull
.- Implementation Requirements:
startLine
andendLine
are physical (not logical) rows, therefore they have to be decremented by 1.
-