public class Spreadsheet
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Spreadsheet.Info
Meta-information about a spreadsheet file.
|
Modifier and Type | Field and Description |
---|---|
private Spreadsheet.Info |
info |
private int |
lastMax |
private boolean |
reloadFlag |
private java.util.List<java.lang.String[]> |
rows |
java.io.File |
tableFile |
Constructor and Description |
---|
Spreadsheet(java.io.File tableFile) |
Spreadsheet(java.io.File tableFile,
Spreadsheet.Info info) |
Modifier and Type | Method and Description |
---|---|
static void |
correctNoFirstCell(java.util.List<java.lang.String[]> allRows)
Assuming that the table has no first cell (line 0, column 0), corrects the first line.
|
static java.lang.String[] |
getDefaultColumnNames(int n) |
static java.lang.String[] |
getDefaultHeader(int x) |
static java.lang.String[] |
getFirstRowFromFile(java.io.File file,
java.lang.String sep) |
Spreadsheet.Info |
getInfo() |
java.util.List<java.lang.String[]> |
getRows() |
java.util.List<java.lang.String[]> |
getRows(int max) |
private static java.util.List<java.lang.String[]> |
getRowsFromTable(java.io.File tableFile,
int max,
java.lang.String separator) |
java.lang.String |
getSeparator() |
static boolean |
lineIsHeader(java.lang.String line,
java.lang.String sep) |
static boolean |
lineIsSampleNames(java.lang.String[] row) |
static boolean |
lineIsSampleNames(java.lang.String line,
java.lang.String sep) |
private void |
reloadRows(int max) |
static boolean |
rowIsNames(java.lang.String[] row) |
void |
setInfo(Spreadsheet.Info info) |
void |
setSeparator(java.lang.String sep) |
private Spreadsheet.Info info
private java.util.List<java.lang.String[]> rows
public java.io.File tableFile
private boolean reloadFlag
private int lastMax
public Spreadsheet(java.io.File tableFile) throws java.io.IOException
java.io.IOException
public Spreadsheet(java.io.File tableFile, Spreadsheet.Info info)
public static boolean lineIsHeader(java.lang.String line, java.lang.String sep)
line
- line from a .csv or .tsv file.sep
- Cell separator.private static java.util.List<java.lang.String[]> getRowsFromTable(java.io.File tableFile, int max, java.lang.String separator)
public static void correctNoFirstCell(java.util.List<java.lang.String[]> allRows)
allRows
- Reference to a List of String[] with all the cells from a spreadsheet file.
It will be altered by the method.public static java.lang.String[] getDefaultHeader(int x)
x
- Number of elements on the new headerpublic static java.lang.String[] getFirstRowFromFile(java.io.File file, java.lang.String sep)
file
- Spreadsheet file.sep
- Cell separator.public static boolean lineIsSampleNames(java.lang.String line, java.lang.String sep)
line
- String of text, not spliced.sep
- Cell separator.public static boolean lineIsSampleNames(java.lang.String[] row)
row
- Words in a line of text.public static boolean rowIsNames(java.lang.String[] row)
row
- Words in a line of text.public static java.lang.String[] getDefaultColumnNames(int n)
n
- Number of elements on the new headerpublic void setSeparator(java.lang.String sep)
public java.lang.String getSeparator()
private void reloadRows(int max)
public java.util.List<java.lang.String[]> getRows()
public java.util.List<java.lang.String[]> getRows(int max)
public void setInfo(Spreadsheet.Info info)
public Spreadsheet.Info getInfo()