Package adams.data.spreadsheet
Class SpreadSheetView
- java.lang.Object
-
- adams.data.spreadsheet.SpreadSheetView
-
- All Implemented Interfaces:
CloneHandler<SpreadSheet>
,LocaleSupporter
,Mergeable<SpreadSheet>
,SpreadSheet
,Serializable
public class SpreadSheetView extends Object implements SpreadSheet
Provides a view of another spreadsheet.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_ColumnArray
the column array.protected gnu.trove.list.array.TIntArrayList
m_Columns
the column subset to use (null for all).protected HeaderRow
m_HeaderRow
the cached header row.protected int[]
m_RowArray
the row array.protected gnu.trove.list.array.TIntArrayList
m_Rows
the row subset to use (null for all).protected SpreadSheet
m_Sheet
the underlying spreadsheet.-
Fields inherited from interface adams.data.spreadsheet.SpreadSheet
COMMENT, MISSING_VALUE
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetView()
Initializes the view with a dummy spreadsheet.SpreadSheetView(SpreadSheet sheet, int[] rows, int[] columns)
Initializes the view.SpreadSheetView(SpreadSheet sheet, int fromRow, int toRow)
Initializes the view.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComment(String comment)
Adds the comment to the internal list of comments.void
addComment(List<String> comment)
Adds the comments to the internal list of comments.DataRow
addRow()
Appends a row to the spreadsheet.DataRow
addRow(String rowKey)
Adds a row with the given key to the list and returns the created object.void
assign(SpreadSheet sheet)
Uses this spreadsheet instead, performs no copy.void
calculate()
Triggers all formula cells to recalculate their values.void
clear()
Removes all cells, but leaves comments.String
equalsHeader(SpreadSheet other)
Compares the header of this spreadsheet with the other one.protected int
getActualColumn(int colIndex)
Returns the actual column index.protected String
getActualColumn(String cellKey)
Returns the actual cell key.protected int
getActualRow(int rowIndex)
Returns the actual row index.protected String
getActualRow(String rowKey)
Returns the actual row key.Cell
getCell(int rowIndex, int columnIndex)
Returns the corresponding cell or null if not found.int
getCellIndex(String cellKey)
Returns the cell index of the specified cell (in the header row).String
getCellPosition(String rowKey, String cellKey)
Returns the position of the cell or null if not found.List<String>
getCellValues(int colIndex)
Returns the unique string values of the specified column.List<String>
getCellValues(String colKey)
Returns the unique string values of the specified column.SpreadSheet
getClone()
Returns a clone of itself.int
getColumnCount()
Returns the number of columns.String
getColumnName(int colIndex)
Returns the name of the specified column.List<String>
getColumnNames()
Returns a list of the names of all columns (i.e., the content the header row cells).List<String>
getComments()
Returns the comments.Cell.ContentType
getContentType(int columnIndex)
Returns the pure content type of the given column, if available.Collection<Cell.ContentType>
getContentTypes(int columnIndex)
Returns the all content types of the given column, if available.Class
getDataRowClass()
Returns the class used for rows.DateFormat
getDateFormat()
Returns the date formatter.DateFormat
getDateTimeFormat()
Returns the date/time formatter.DateFormat
getDateTimeMsecFormat()
Returns the date/time msec formatter.SpreadSheet
getHeader()
Returns the view with the same header and comments.HeaderRow
getHeaderRow()
Returns the header row.Locale
getLocale()
Returns the current locale.String
getName()
Returns the name of the spreadsheet.NumberFormat
getNumberFormat()
Returns the number formatter.DataRow
getRow(int rowIndex)
Returns the row at the specified index.DataRow
getRow(String rowKey)
Returns the row associated with the given row key, null if not found.int
getRowCount()
Returns the number of rows currently stored.int
getRowIndex(String rowKey)
Returns the row index of the specified row.String
getRowKey(int rowIndex)
Returns the row key at the specified index.SharedStringsTable
getSharedStringsTable()
Returns the table for shared strings.SpreadSheet
getSheet()
Returns the underlying sheet.DateFormat
getTimeFormat()
Returns the time formatter.DateFormat
getTimeMsecFormat()
Returns the time/msec formatter.TimeZone
getTimeZone()
Returns the currently used timezone.boolean
hasCell(int rowIndex, int columnIndex)
Checks whether the cell with the given indices already exists.boolean
hasName()
Returns whether the spreadsheet has a name.boolean
hasRow(int rowIndex)
Returns whether the spreadsheet already contains the row with the given index.boolean
hasRow(String rowKey)
Returns whether the spreadsheet already contains the row with the given key.void
insertColumn(int columnIndex, String header)
Inserts a column at the specified location.void
insertColumn(int columnIndex, String header, String initial)
Inserts a column at the specified location.void
insertColumn(int columnIndex, String header, String initial, boolean forceString)
Inserts a column at the specified location.DataRow
insertRow(int index)
Inserts a row at the specified location.boolean
isContentType(int columnIndex, Cell.ContentType type)
Checks whether the given column is of the specific content type or not.boolean
isDateLenient()
Returns whether the parsing of dates is lenient or not.boolean
isDateTimeLenient()
Returns whether the parsing of date/times is lenient or not.boolean
isDateTimeMsecLenient()
Returns whether the parsing of date/time msecs is lenient or not.boolean
isNumeric(int columnIndex)
Checks whether the given column is numeric or not.boolean
isNumeric(int columnIndex, boolean allowMissing)
Checks whether the given column is numeric or not.boolean
isTimeLenient()
Returns whether the parsing of times is lenient or not.boolean
isTimeMsecLenient()
Returns whether the parsing of times/msec is lenient or not.void
mergeWith(SpreadSheet other)
Puts the content of the provided spreadsheet on the right.Cell
newCell()
Creates a new cell.SpreadSheet
newInstance()
Returns a new instance.boolean
removeColumn(int columnIndex)
Removes the specified column.boolean
removeColumn(String columnKey)
Removes the specified column.boolean
removeMissing()
Removes all cells marked "missing".Row
removeRow(int rowIndex)
Removes the specified row.Row
removeRow(String rowKey)
Removes the specified row.Collection<String>
rowKeys()
Returns a collection of all row keys.Collection<DataRow>
rows()
Returns all rows.void
setDataRowClass(Class cls)
Sets the default data row class to use.void
setDateLenient(boolean value)
Sets whether parsing of dates is to be lenient or not.void
setDateTimeLenient(boolean value)
Sets whether parsing of date/times is to be lenient or not.void
setDateTimeMsecLenient(boolean value)
Sets whether parsing of date/time mses is to be lenient or not.void
setLocale(Locale value)
Sets the locale.void
setName(String value)
Sets the name of the spreadsheet.void
setTimeLenient(boolean value)
Sets whether parsing of times is to be lenient or not.void
setTimeMsecLenient(boolean value)
Sets whether parsing of times/msec is to be lenient or not.void
setTimeZone(TimeZone value)
Sets the timezone to use.void
sort(int index, boolean asc)
Sorts the rows based on the values in the specified column.void
sort(RowComparator comp)
Sorts the rows using the given comparator.void
sort(RowComparator comp, boolean unique)
Sorts the rows using the given comparator.void
sortRowKeys()
Sorts the rows according to the row keys.void
sortRowKeys(Comparator<String> comp)
Sorts the rows according to the row keys.Object[][]
toMatrix()
Returns the spreadsheet as matrix, with the header as the first row.String
toString()
Returns the spreadsheet as string, i.e., CSV formatted.SpreadSheet
toView(int[] rows, int[] columns)
Creates a view of the spreadsheet with the specified rows/columns.protected DataRowView
wrap(DataRow row)
Wraps the data row in a view container.
-
-
-
Field Detail
-
m_Rows
protected gnu.trove.list.array.TIntArrayList m_Rows
the row subset to use (null for all).
-
m_RowArray
protected int[] m_RowArray
the row array.
-
m_Columns
protected gnu.trove.list.array.TIntArrayList m_Columns
the column subset to use (null for all).
-
m_ColumnArray
protected int[] m_ColumnArray
the column array.
-
m_Sheet
protected SpreadSheet m_Sheet
the underlying spreadsheet.
-
m_HeaderRow
protected HeaderRow m_HeaderRow
the cached header row.
-
-
Constructor Detail
-
SpreadSheetView
public SpreadSheetView()
Initializes the view with a dummy spreadsheet.
-
SpreadSheetView
public SpreadSheetView(SpreadSheet sheet, int fromRow, int toRow)
Initializes the view.- Parameters:
sheet
- the underlying spreadsheetfromRow
- the first rowtoRow
- the last row (excluded)
-
SpreadSheetView
public SpreadSheetView(SpreadSheet sheet, int[] rows, int[] columns)
Initializes the view.- Parameters:
sheet
- the underlying spreadsheetcolumns
- the columns to use, null for allrows
- the rows to use, null for all
-
-
Method Detail
-
assign
public void assign(SpreadSheet sheet)
Uses this spreadsheet instead, performs no copy.- Specified by:
assign
in interfaceSpreadSheet
- Parameters:
sheet
- the sheet to use
-
setDataRowClass
public void setDataRowClass(Class cls)
Sets the default data row class to use. Must implementDataRow
.- Specified by:
setDataRowClass
in interfaceSpreadSheet
- Parameters:
cls
- the class, null resets it to the default one- Throws:
IllegalArgumentException
- if class does not implementDataRow
-
getDataRowClass
public Class getDataRowClass()
Returns the class used for rows.- Specified by:
getDataRowClass
in interfaceSpreadSheet
- Returns:
- the class
-
newInstance
public SpreadSheet newInstance()
Returns a new instance.- Specified by:
newInstance
in interfaceSpreadSheet
- Returns:
- the new instance, null if failed to create new instance
-
getClone
public SpreadSheet getClone()
Returns a clone of itself. Creates a copy of the underlying spreadsheet!- Specified by:
getClone
in interfaceCloneHandler<SpreadSheet>
- Specified by:
getClone
in interfaceSpreadSheet
- Returns:
- the clone
-
getHeader
public SpreadSheet getHeader()
Returns the view with the same header and comments.- Specified by:
getHeader
in interfaceSpreadSheet
- Returns:
- the spreadsheet
-
getActualRow
protected int getActualRow(int rowIndex)
Returns the actual row index.- Parameters:
rowIndex
- the row in the view- Returns:
- the underlying row index
-
getActualColumn
protected int getActualColumn(int colIndex)
Returns the actual column index.- Parameters:
colIndex
- the col in the view- Returns:
- the underlying col index
-
getActualRow
protected String getActualRow(String rowKey)
Returns the actual row key.- Parameters:
rowKey
- the row key in the view- Returns:
- the underlying row key, null if not present
-
getActualColumn
protected String getActualColumn(String cellKey)
Returns the actual cell key.- Parameters:
cellKey
- the cell key in the view- Returns:
- the underlying cell key, null if not present
-
wrap
protected DataRowView wrap(DataRow row)
Wraps the data row in a view container.- Parameters:
row
- the row to wrap- Returns:
- the wrapped row
-
getDateFormat
public DateFormat getDateFormat()
Returns the date formatter.- Specified by:
getDateFormat
in interfaceSpreadSheet
- Returns:
- the formatter
- See Also:
DateUtils.getDateFormatter()
-
getDateTimeFormat
public DateFormat getDateTimeFormat()
Returns the date/time formatter.- Specified by:
getDateTimeFormat
in interfaceSpreadSheet
- Returns:
- the formatter
- See Also:
DateUtils.getTimestampFormatter()
-
getDateTimeMsecFormat
public DateFormat getDateTimeMsecFormat()
Returns the date/time msec formatter.- Specified by:
getDateTimeMsecFormat
in interfaceSpreadSheet
- Returns:
- the formatter
- See Also:
DateUtils.getTimestampFormatterMsecs()
-
getTimeFormat
public DateFormat getTimeFormat()
Returns the time formatter.- Specified by:
getTimeFormat
in interfaceSpreadSheet
- Returns:
- the formatter
- See Also:
DateUtils.getTimeFormatter()
-
getTimeMsecFormat
public DateFormat getTimeMsecFormat()
Returns the time/msec formatter.- Specified by:
getTimeMsecFormat
in interfaceSpreadSheet
- Returns:
- the formatter
- See Also:
DateUtils.getTimeFormatterMsecs()
-
getNumberFormat
public NumberFormat getNumberFormat()
Returns the number formatter.- Specified by:
getNumberFormat
in interfaceSpreadSheet
- Returns:
- the formatter
-
setName
public void setName(String value)
Sets the name of the spreadsheet.- Specified by:
setName
in interfaceSpreadSheet
- Parameters:
value
- the name
-
getName
public String getName()
Returns the name of the spreadsheet.- Specified by:
getName
in interfaceSpreadSheet
- Returns:
- the name, can be null
-
hasName
public boolean hasName()
Returns whether the spreadsheet has a name.- Specified by:
hasName
in interfaceSpreadSheet
- Returns:
- true if the spreadsheet is named
-
addComment
public void addComment(String comment)
Adds the comment to the internal list of comments. If the comment contains newlines, then it gets automatically split into multiple lines and added one by one.- Specified by:
addComment
in interfaceSpreadSheet
- Parameters:
comment
- the comment to add
-
addComment
public void addComment(List<String> comment)
Adds the comments to the internal list of comments.- Specified by:
addComment
in interfaceSpreadSheet
- Parameters:
comment
- the comment to add
-
getComments
public List<String> getComments()
Returns the comments.- Specified by:
getComments
in interfaceSpreadSheet
- Returns:
- the comments
-
clear
public void clear()
Removes all cells, but leaves comments.
Not implemented!- Specified by:
clear
in interfaceSpreadSheet
-
getHeaderRow
public HeaderRow getHeaderRow()
Returns the header row.- Specified by:
getHeaderRow
in interfaceSpreadSheet
- Returns:
- the row
-
getColumnName
public String getColumnName(int colIndex)
Returns the name of the specified column.- Specified by:
getColumnName
in interfaceSpreadSheet
- Parameters:
colIndex
- the index of the column- Returns:
- the name of the column
-
getColumnNames
public List<String> getColumnNames()
Returns a list of the names of all columns (i.e., the content the header row cells).- Specified by:
getColumnNames
in interfaceSpreadSheet
- Returns:
- the names of the columns
-
hasRow
public boolean hasRow(int rowIndex)
Returns whether the spreadsheet already contains the row with the given index.- Specified by:
hasRow
in interfaceSpreadSheet
- Parameters:
rowIndex
- the index to look for- Returns:
- true if the row already exists
-
hasRow
public boolean hasRow(String rowKey)
Returns whether the spreadsheet already contains the row with the given key.- Specified by:
hasRow
in interfaceSpreadSheet
- Parameters:
rowKey
- the key to look for- Returns:
- true if the row already exists
-
newCell
public Cell newCell()
Creates a new cell.- Specified by:
newCell
in interfaceSpreadSheet
- Returns:
- the new instance, null in case of an instantiation error
-
addRow
public DataRow addRow()
Appends a row to the spreadsheet.
Not implemented!- Specified by:
addRow
in interfaceSpreadSheet
- Returns:
- the created row
-
addRow
public DataRow addRow(String rowKey)
Adds a row with the given key to the list and returns the created object. If the row already exists, then this row is returned instead and no new object created.
Not implemented!- Specified by:
addRow
in interfaceSpreadSheet
- Parameters:
rowKey
- the key for the row to create- Returns:
- the created row or the already existing row
-
insertRow
public DataRow insertRow(int index)
Inserts a row at the specified location.
Not implemented!- Specified by:
insertRow
in interfaceSpreadSheet
- Parameters:
index
- the index where to insert the row- Returns:
- the created row
-
removeRow
public Row removeRow(int rowIndex)
Removes the specified row.
Not implemented!- Specified by:
removeRow
in interfaceSpreadSheet
- Parameters:
rowIndex
- the row to remove- Returns:
- the row that was removed, null if none removed
-
removeRow
public Row removeRow(String rowKey)
Removes the specified row.
Not implemented!- Specified by:
removeRow
in interfaceSpreadSheet
- Parameters:
rowKey
- the row to remove- Returns:
- the row that was removed, null if none removed
-
insertColumn
public void insertColumn(int columnIndex, String header)
Inserts a column at the specified location.
Not implemented!- Specified by:
insertColumn
in interfaceSpreadSheet
- Parameters:
columnIndex
- the position of the columnheader
- the name of the column
-
insertColumn
public void insertColumn(int columnIndex, String header, String initial)
Inserts a column at the specified location.
Not implemented!- Specified by:
insertColumn
in interfaceSpreadSheet
- Parameters:
columnIndex
- the position of the columnheader
- the name of the columninitial
- the initial value for the cells, "null" for missing values (in that case no cells are added)
-
insertColumn
public void insertColumn(int columnIndex, String header, String initial, boolean forceString)
Inserts a column at the specified location.
Not implemented!- Specified by:
insertColumn
in interfaceSpreadSheet
- Parameters:
columnIndex
- the position of the columnheader
- the name of the columninitial
- the initial value for the cells, "null" for missing values (in that case no cells are added)forceString
- whether to enforce the value to be set as string
-
removeColumn
public boolean removeColumn(int columnIndex)
Removes the specified column.
Not implemented!- Specified by:
removeColumn
in interfaceSpreadSheet
- Parameters:
columnIndex
- the column to remove- Returns:
- true if removed
-
removeColumn
public boolean removeColumn(String columnKey)
Removes the specified column.
Not implemented!- Specified by:
removeColumn
in interfaceSpreadSheet
- Parameters:
columnKey
- the column to remove- Returns:
- true if removed
-
getRow
public DataRow getRow(String rowKey)
Returns the row associated with the given row key, null if not found.- Specified by:
getRow
in interfaceSpreadSheet
- Parameters:
rowKey
- the key of the row to retrieve- Returns:
- the row or null if not found
-
getRow
public DataRow getRow(int rowIndex)
Returns the row at the specified index.- Specified by:
getRow
in interfaceSpreadSheet
- Parameters:
rowIndex
- the 0-based index of the row to retrieve- Returns:
- the row
-
getRowKey
public String getRowKey(int rowIndex)
Returns the row key at the specified index.- Specified by:
getRowKey
in interfaceSpreadSheet
- Parameters:
rowIndex
- the 0-based index of the row key to retrieve- Returns:
- the row key
-
getRowIndex
public int getRowIndex(String rowKey)
Returns the row index of the specified row.- Specified by:
getRowIndex
in interfaceSpreadSheet
- Parameters:
rowKey
- the row identifier- Returns:
- the 0-based row index, -1 if not found
-
getCellIndex
public int getCellIndex(String cellKey)
Returns the cell index of the specified cell (in the header row).- Specified by:
getCellIndex
in interfaceSpreadSheet
- Parameters:
cellKey
- the cell identifier- Returns:
- the 0-based column index, -1 if not found
-
hasCell
public boolean hasCell(int rowIndex, int columnIndex)
Checks whether the cell with the given indices already exists.- Specified by:
hasCell
in interfaceSpreadSheet
- Parameters:
rowIndex
- the index of the row to look forcolumnIndex
- the index of the cell in the row to look for- Returns:
- true if the cell exists
-
getCell
public Cell getCell(int rowIndex, int columnIndex)
Returns the corresponding cell or null if not found.- Specified by:
getCell
in interfaceSpreadSheet
- Parameters:
rowIndex
- the index of the row the cell is incolumnIndex
- the column of the cell to retrieve- Returns:
- the cell or null if not found
-
getCellPosition
public String getCellPosition(String rowKey, String cellKey)
Returns the position of the cell or null if not found. A position is a combination of a number of letters (for the column) and number (for the row).- Specified by:
getCellPosition
in interfaceSpreadSheet
- Parameters:
rowKey
- the key of the row the cell is incellKey
- the key of the cell to retrieve- Returns:
- the position string or null if not found
-
rowKeys
public Collection<String> rowKeys()
Returns a collection of all row keys.- Specified by:
rowKeys
in interfaceSpreadSheet
- Returns:
- the row keys
-
rows
public Collection<DataRow> rows()
Returns all rows.- Specified by:
rows
in interfaceSpreadSheet
- Returns:
- the rows
-
sortRowKeys
public void sortRowKeys()
Sorts the rows according to the row keys.
Not implemented!- Specified by:
sortRowKeys
in interfaceSpreadSheet
- See Also:
rowKeys()
-
sortRowKeys
public void sortRowKeys(Comparator<String> comp)
Sorts the rows according to the row keys.
Not implemented!- Specified by:
sortRowKeys
in interfaceSpreadSheet
- Parameters:
comp
- the comparator to use- See Also:
rowKeys()
-
sort
public void sort(int index, boolean asc)
Sorts the rows based on the values in the specified column.
Not implemented!- Specified by:
sort
in interfaceSpreadSheet
- Parameters:
index
- the index (0-based) of the column to sort onasc
- wether sorting is ascending or descending- See Also:
sort(RowComparator)
-
sort
public void sort(RowComparator comp)
Sorts the rows using the given comparator.
Not implemented!- Specified by:
sort
in interfaceSpreadSheet
- Parameters:
comp
- the row comparator to use
-
sort
public void sort(RowComparator comp, boolean unique)
Sorts the rows using the given comparator.
Not implemented!- Specified by:
sort
in interfaceSpreadSheet
- Parameters:
comp
- the row comparator to useunique
- whether to drop any duplicate rows (based on row comparator)
-
getColumnCount
public int getColumnCount()
Returns the number of columns.- Specified by:
getColumnCount
in interfaceSpreadSheet
- Returns:
- the number of columns
-
getRowCount
public int getRowCount()
Returns the number of rows currently stored.- Specified by:
getRowCount
in interfaceSpreadSheet
- Returns:
- the number of rows
-
isNumeric
public boolean isNumeric(int columnIndex)
Checks whether the given column is numeric or not. Does not accept missing values.- Specified by:
isNumeric
in interfaceSpreadSheet
- Parameters:
columnIndex
- the index of the column to check- Returns:
- true if purely numeric
- See Also:
getContentTypes(int)
-
isNumeric
public boolean isNumeric(int columnIndex, boolean allowMissing)
Checks whether the given column is numeric or not. Can accept missing values.- Specified by:
isNumeric
in interfaceSpreadSheet
- Parameters:
columnIndex
- the index of the column to check- Returns:
- true if purely numeric
- See Also:
getContentTypes(int)
-
isContentType
public boolean isContentType(int columnIndex, Cell.ContentType type)
Checks whether the given column is of the specific content type or not.- Specified by:
isContentType
in interfaceSpreadSheet
- Parameters:
columnIndex
- the index of the column to checktype
- the content type to check- Returns:
- true if column purely consists of this content type
- See Also:
getContentType(int)
-
getContentType
public Cell.ContentType getContentType(int columnIndex)
Returns the pure content type of the given column, if available.- Specified by:
getContentType
in interfaceSpreadSheet
- Parameters:
columnIndex
- the index of the column to check- Returns:
- the content type that this column consists of solely, null if mixed
-
getContentTypes
public Collection<Cell.ContentType> getContentTypes(int columnIndex)
Returns the all content types of the given column, if available.- Specified by:
getContentTypes
in interfaceSpreadSheet
- Parameters:
columnIndex
- the index of the column to check- Returns:
- the content types that this column consists of
-
getCellValues
public List<String> getCellValues(String colKey)
Returns the unique string values of the specified column. The returned list is sorted.- Specified by:
getCellValues
in interfaceSpreadSheet
- Parameters:
colKey
- the column to retrieve the values for- Returns:
- the sorted, list of unique values
-
getCellValues
public List<String> getCellValues(int colIndex)
Returns the unique string values of the specified column. The returned list is sorted.- Specified by:
getCellValues
in interfaceSpreadSheet
- Parameters:
colIndex
- the column to retrieve the values for- Returns:
- the sorted, list of unique values
-
equalsHeader
public String equalsHeader(SpreadSheet other)
Compares the header of this spreadsheet with the other one.- Specified by:
equalsHeader
in interfaceSpreadSheet
- Parameters:
other
- the other spreadsheet to compare with- Returns:
- null if equal, otherwise details what differs
-
removeMissing
public boolean removeMissing()
Removes all cells marked "missing".
Not implemented!- Specified by:
removeMissing
in interfaceSpreadSheet
- Returns:
- true if any cell was removed
-
getSharedStringsTable
public SharedStringsTable getSharedStringsTable()
Returns the table for shared strings.- Specified by:
getSharedStringsTable
in interfaceSpreadSheet
- Returns:
- the table
-
setDateLenient
public void setDateLenient(boolean value)
Sets whether parsing of dates is to be lenient or not.- Specified by:
setDateLenient
in interfaceSpreadSheet
- Parameters:
value
- if true lenient parsing is used, otherwise not- See Also:
DateFormat.setLenient(boolean)
-
isDateLenient
public boolean isDateLenient()
Returns whether the parsing of dates is lenient or not.- Specified by:
isDateLenient
in interfaceSpreadSheet
- Returns:
- true if parsing is lenient
- See Also:
DateFormat.isLenient()
-
setDateTimeLenient
public void setDateTimeLenient(boolean value)
Sets whether parsing of date/times is to be lenient or not.- Specified by:
setDateTimeLenient
in interfaceSpreadSheet
- Parameters:
value
- if true lenient parsing is used, otherwise not- See Also:
DateFormat.setLenient(boolean)
-
isDateTimeLenient
public boolean isDateTimeLenient()
Returns whether the parsing of date/times is lenient or not.- Specified by:
isDateTimeLenient
in interfaceSpreadSheet
- Returns:
- true if parsing is lenient
- See Also:
DateFormat.isLenient()
-
setDateTimeMsecLenient
public void setDateTimeMsecLenient(boolean value)
Sets whether parsing of date/time mses is to be lenient or not.- Specified by:
setDateTimeMsecLenient
in interfaceSpreadSheet
- Parameters:
value
- if true lenient parsing is used, otherwise not- See Also:
DateFormat.setLenient(boolean)
-
isDateTimeMsecLenient
public boolean isDateTimeMsecLenient()
Returns whether the parsing of date/time msecs is lenient or not.- Specified by:
isDateTimeMsecLenient
in interfaceSpreadSheet
- Returns:
- true if parsing is lenient
- See Also:
DateFormat.isLenient()
-
setTimeLenient
public void setTimeLenient(boolean value)
Sets whether parsing of times is to be lenient or not.- Specified by:
setTimeLenient
in interfaceSpreadSheet
- Parameters:
value
- if true lenient parsing is used, otherwise not
-
isTimeLenient
public boolean isTimeLenient()
Returns whether the parsing of times is lenient or not.- Specified by:
isTimeLenient
in interfaceSpreadSheet
- Returns:
- true if parsing is lenient
-
setTimeMsecLenient
public void setTimeMsecLenient(boolean value)
Sets whether parsing of times/msec is to be lenient or not.- Specified by:
setTimeMsecLenient
in interfaceSpreadSheet
- Parameters:
value
- if true lenient parsing is used, otherwise not
-
isTimeMsecLenient
public boolean isTimeMsecLenient()
Returns whether the parsing of times/msec is lenient or not.- Specified by:
isTimeMsecLenient
in interfaceSpreadSheet
- Returns:
- true if parsing is lenient
-
setTimeZone
public void setTimeZone(TimeZone value)
Sets the timezone to use.- Specified by:
setTimeZone
in interfaceSpreadSheet
- Parameters:
value
- the new timezone- See Also:
DateFormat.setTimeZone(TimeZone)
-
getTimeZone
public TimeZone getTimeZone()
Returns the currently used timezone.- Specified by:
getTimeZone
in interfaceSpreadSheet
- Returns:
- the current timezone
- See Also:
DateFormat.getTimeZone()
-
setLocale
public void setLocale(Locale value)
Sets the locale. Used in formatting/parsing numbers.- Specified by:
setLocale
in interfaceLocaleSupporter
- Specified by:
setLocale
in interfaceSpreadSheet
- Parameters:
value
- the locale to use
-
getLocale
public Locale getLocale()
Returns the current locale.- Specified by:
getLocale
in interfaceLocaleSupporter
- Specified by:
getLocale
in interfaceSpreadSheet
- Returns:
- the locale
-
calculate
public void calculate()
Triggers all formula cells to recalculate their values.- Specified by:
calculate
in interfaceSpreadSheet
-
mergeWith
public void mergeWith(SpreadSheet other)
Puts the content of the provided spreadsheet on the right.
Not implemented!- Specified by:
mergeWith
in interfaceMergeable<SpreadSheet>
- Specified by:
mergeWith
in interfaceSpreadSheet
- Parameters:
other
- the spreadsheet to merge with
-
getSheet
public SpreadSheet getSheet()
Returns the underlying sheet.- Returns:
- the underlying sheet
-
toMatrix
public Object[][] toMatrix()
Returns the spreadsheet as matrix, with the header as the first row. Missing values are represented as null values.- Specified by:
toMatrix
in interfaceSpreadSheet
- Returns:
- the row-wise matrix
-
toString
public String toString()
Returns the spreadsheet as string, i.e., CSV formatted.- Specified by:
toString
in interfaceSpreadSheet
- Overrides:
toString
in classObject
- Returns:
- the string representation
-
toView
public SpreadSheet toView(int[] rows, int[] columns)
Creates a view of the spreadsheet with the specified rows/columns.- Specified by:
toView
in interfaceSpreadSheet
- Parameters:
columns
- the columns to use, null for allrows
- the rows to use, null for all- Returns:
- the view
-
-