Package adams.data.spreadsheet
Class DefaultSpreadSheet
- java.lang.Object
-
- adams.data.spreadsheet.DefaultSpreadSheet
-
- All Implemented Interfaces:
CloneHandler<SpreadSheet>,LocaleSupporter,Mergeable<SpreadSheet>,SpreadSheet,Serializable
- Direct Known Subclasses:
DefaultDataset
public class DefaultSpreadSheet extends Object implements SpreadSheet
Represents a generic spreadsheet object.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMMENTthe line comment start.protected List<String>m_Commentsoptional comments.protected Classm_DataRowClassthe default data row class to use.protected Constructorm_DataRowConstructorthe constructor for the datarow.protected DateFormatm_DateFormatfor formatting dates.protected DateFormatm_DateTimeFormatfor formatting date/times.protected DateFormatm_DateTimeMsecFormatfor formatting date/time msecs.protected HeaderRowm_HeaderRowthe header row.protected Localem_Localethe current locale.protected Stringm_Namethe name of the spreadsheet.protected NumberFormatm_NumberFormatfor number format.protected ArrayList<String>m_RowKeysthe row keys of the spreadsheet.protected HashMap<String,DataRow>m_Rowsthe rows of the spreadsheet.protected SharedStringsTablem_StringsTablefor conserving memory.protected DateFormatm_TimeFormatfor formatting times.protected DateFormatm_TimeMsecFormatfor formatting times with msec.static StringMISSING_VALUEthe default missing value.
-
Constructor Summary
Constructors Constructor Description DefaultSpreadSheet()default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComment(String comment)Adds the comment to the internal list of comments.voidaddComment(List<String> comment)Adds the comments to the internal list of comments.DataRowaddRow()Appends a row to the spreadsheet.DataRowaddRow(String rowKey)Adds a row with the given key to the list and returns the created object.voidassign(SpreadSheet sheet)Clears this spreadsheet and copies all the data from the given one.voidcalculate()Triggers all formula cells to recalculate their values.voidclear()Removes all cells, but leaves comments.StringequalsHeader(SpreadSheet other)Compares the header of this spreadsheet with the other one.CellgetCell(int rowIndex, int columnIndex)Returns the corresponding cell or null if not found.intgetCellIndex(String cellKey)Returns the cell index of the specified cell (in the header row).StringgetCellPosition(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.SpreadSheetgetClone()Returns a clone of itself.intgetColumnCount()Returns the number of columns.StringgetColumnName(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.ContentTypegetContentType(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.ClassgetDataRowClass()Returns the class used for rows.DateFormatgetDateFormat()Returns the date formatter.DateFormatgetDateTimeFormat()Returns the date/time formatter.DateFormatgetDateTimeMsecFormat()Returns the date/time msec formatter.SpreadSheetgetHeader()Returns the a spreadsheet with the same header and comments.HeaderRowgetHeaderRow()Returns the header row.LocalegetLocale()Returns the current locale.StringgetName()Returns the name of the spreadsheet.NumberFormatgetNumberFormat()Returns the number formatter.DataRowgetRow(int rowIndex)Returns the row at the specified index.DataRowgetRow(String rowKey)Returns the row associated with the given row key, null if not found.intgetRowCount()Returns the number of rows currently stored.intgetRowIndex(String rowKey)Returns the row index of the specified row.StringgetRowKey(int rowIndex)Returns the row key at the specified index.SharedStringsTablegetSharedStringsTable()Returns the table for shared strings.DateFormatgetTimeFormat()Returns the time formatter.DateFormatgetTimeMsecFormat()Returns the time/msec formatter.TimeZonegetTimeZone()Returns the currently used timezone.booleanhasCell(int rowIndex, int columnIndex)Checks whether the cell with the given indices already exists.booleanhasName()Returns whether the spreadsheet has a name.booleanhasRow(int rowIndex)Returns whether the spreadsheet already contains the row with the given index.booleanhasRow(String rowKey)Returns whether the spreadsheet already contains the row with the given key.protected voidinitialize()Initializes the members.voidinsertColumn(int columnIndex, String header)Inserts a column at the specified location.voidinsertColumn(int columnIndex, String header, String initial)Inserts a column at the specified location.voidinsertColumn(int columnIndex, String header, String initial, boolean forceString)Inserts a column at the specified location.DataRowinsertRow(int index)Inserts a row at the specified location.booleanisContentType(int columnIndex, Cell.ContentType type)Checks whether the given column is of the specific content type or not.booleanisDateLenient()Returns whether the parsing of dates is lenient or not.booleanisDateTimeLenient()Returns whether the parsing of date/times is lenient or not.booleanisDateTimeMsecLenient()Returns whether the parsing of date/time msecs is lenient or not.booleanisNumeric(int columnIndex)Checks whether the given column is numeric or not.booleanisNumeric(int columnIndex, boolean allowMissing)Checks whether the given column is numeric or not.booleanisTimeLenient()Returns whether the parsing of times is lenient or not.booleanisTimeMsecLenient()Returns whether the parsing of times/msec is lenient or not.static voidmain(String[] args)voidmergeWith(SpreadSheet other)Puts the content of the provided spreadsheet on the right.CellnewCell()Creates a new cell.SpreadSheetnewInstance()Returns a new instance.protected DataRownewRow()Creates a new row instance.booleanremoveColumn(int columnIndex)Removes the specified column.booleanremoveColumn(String columnKey)Removes the specified column.booleanremoveMissing()Removes all cells marked "missing".RowremoveRow(int rowIndex)Removes the specified row.RowremoveRow(String rowKey)Removes the specified row.Collection<String>rowKeys()Returns a collection of all row keys.Collection<DataRow>rows()Returns all rows.voidsetDataRowClass(Class cls)Sets the default data row class to use.voidsetDateLenient(boolean value)Sets whether parsing of dates is to be lenient or not.voidsetDateTimeLenient(boolean value)Sets whether parsing of date/times is to be lenient or not.voidsetDateTimeMsecLenient(boolean value)Sets whether parsing of date/time mses is to be lenient or not.voidsetLocale(Locale value)Sets the locale.voidsetName(String value)Sets the name of the spreadsheet.voidsetTimeLenient(boolean value)Sets whether parsing of times is to be lenient or not.voidsetTimeMsecLenient(boolean value)Sets whether parsing of times/msec is to be lenient or not.voidsetTimeZone(TimeZone value)Sets the timezone to use.voidsort(int index, boolean asc)Sorts the rows based on the values in the specified column.voidsort(RowComparator comp)Sorts the rows using the given comparator.voidsort(RowComparator comp, boolean unique)Sorts the rows using the given comparator.voidsortRowKeys()Sorts the rows according to the row keys.voidsortRowKeys(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.StringtoString()Returns the spreadsheet as string, i.e., CSV formatted.SpreadSheettoView(int[] rows, int[] columns)Creates a view of the spreadsheet with the specified rows/columns.
-
-
-
Field Detail
-
COMMENT
public static final String COMMENT
the line comment start.- See Also:
- Constant Field Values
-
MISSING_VALUE
public static final String MISSING_VALUE
the default missing value.- See Also:
- Constant Field Values
-
m_HeaderRow
protected HeaderRow m_HeaderRow
the header row.
-
m_Name
protected String m_Name
the name of the spreadsheet.
-
m_DateFormat
protected DateFormat m_DateFormat
for formatting dates.
-
m_DateTimeFormat
protected DateFormat m_DateTimeFormat
for formatting date/times.
-
m_DateTimeMsecFormat
protected DateFormat m_DateTimeMsecFormat
for formatting date/time msecs.
-
m_TimeFormat
protected DateFormat m_TimeFormat
for formatting times.
-
m_TimeMsecFormat
protected DateFormat m_TimeMsecFormat
for formatting times with msec.
-
m_NumberFormat
protected NumberFormat m_NumberFormat
for number format.
-
m_Locale
protected Locale m_Locale
the current locale.
-
m_StringsTable
protected SharedStringsTable m_StringsTable
for conserving memory.
-
m_DataRowClass
protected Class m_DataRowClass
the default data row class to use.
-
m_DataRowConstructor
protected transient Constructor m_DataRowConstructor
the constructor for the datarow.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.
-
assign
public void assign(SpreadSheet sheet)
Clears this spreadsheet and copies all the data from the given one.- Specified by:
assignin interfaceSpreadSheet- Parameters:
sheet- the data to copy
-
setDataRowClass
public void setDataRowClass(Class cls)
Sets the default data row class to use. Must implementDataRow.- Specified by:
setDataRowClassin 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:
getDataRowClassin interfaceSpreadSheet- Returns:
- the class
-
newInstance
public SpreadSheet newInstance()
Returns a new instance.- Specified by:
newInstancein interfaceSpreadSheet- Returns:
- the new instance, null if failed to create new instance
-
getClone
public SpreadSheet getClone()
Returns a clone of itself.- Specified by:
getClonein interfaceCloneHandler<SpreadSheet>- Specified by:
getClonein interfaceSpreadSheet- Returns:
- the clone
-
getHeader
public SpreadSheet getHeader()
Returns the a spreadsheet with the same header and comments.- Specified by:
getHeaderin interfaceSpreadSheet- Returns:
- the spreadsheet
-
getDateFormat
public DateFormat getDateFormat()
Returns the date formatter.- Specified by:
getDateFormatin interfaceSpreadSheet- Returns:
- the formatter
- See Also:
DateUtils.getDateFormatter()
-
getDateTimeFormat
public DateFormat getDateTimeFormat()
Returns the date/time formatter.- Specified by:
getDateTimeFormatin interfaceSpreadSheet- Returns:
- the formatter
- See Also:
DateUtils.getTimestampFormatter()
-
getDateTimeMsecFormat
public DateFormat getDateTimeMsecFormat()
Returns the date/time msec formatter.- Specified by:
getDateTimeMsecFormatin interfaceSpreadSheet- Returns:
- the formatter
- See Also:
DateUtils.getTimestampFormatterMsecs()
-
getTimeFormat
public DateFormat getTimeFormat()
Returns the time formatter.- Specified by:
getTimeFormatin interfaceSpreadSheet- Returns:
- the formatter
- See Also:
DateUtils.getTimeFormatter()
-
getTimeMsecFormat
public DateFormat getTimeMsecFormat()
Returns the time/msec formatter.- Specified by:
getTimeMsecFormatin interfaceSpreadSheet- Returns:
- the formatter
- See Also:
DateUtils.getTimeFormatterMsecs()
-
getNumberFormat
public NumberFormat getNumberFormat()
Returns the number formatter.- Specified by:
getNumberFormatin interfaceSpreadSheet- Returns:
- the formatter
-
setName
public void setName(String value)
Sets the name of the spreadsheet.- Specified by:
setNamein interfaceSpreadSheet- Parameters:
value- the name
-
getName
public String getName()
Returns the name of the spreadsheet.- Specified by:
getNamein interfaceSpreadSheet- Returns:
- the name, can be null
-
hasName
public boolean hasName()
Returns whether the spreadsheet has a name.- Specified by:
hasNamein 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:
addCommentin 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:
addCommentin interfaceSpreadSheet- Parameters:
comment- the comment to add
-
getComments
public List<String> getComments()
Returns the comments.- Specified by:
getCommentsin interfaceSpreadSheet- Returns:
- the comments
-
clear
public void clear()
Removes all cells, but leaves comments.- Specified by:
clearin interfaceSpreadSheet
-
getHeaderRow
public HeaderRow getHeaderRow()
Returns the header row.- Specified by:
getHeaderRowin interfaceSpreadSheet- Returns:
- the row
-
getColumnName
public String getColumnName(int colIndex)
Returns the name of the specified column.- Specified by:
getColumnNamein 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:
getColumnNamesin 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:
hasRowin 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:
hasRowin interfaceSpreadSheet- Parameters:
rowKey- the key to look for- Returns:
- true if the row already exists
-
newRow
protected DataRow newRow()
Creates a new row instance.- Returns:
- the new instance, null in case of an instantiation error
-
newCell
public Cell newCell()
Creates a new cell.- Specified by:
newCellin interfaceSpreadSheet- Returns:
- the new instance, null in case of an instantiation error
-
addRow
public DataRow addRow()
Appends a row to the spreadsheet.- Specified by:
addRowin 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.- Specified by:
addRowin 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.- Specified by:
insertRowin interfaceSpreadSheet- Parameters:
index- the index where to insert the row- Returns:
- the created row
-
removeRow
public Row removeRow(int rowIndex)
Removes the specified row.- Specified by:
removeRowin 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.- Specified by:
removeRowin 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.- Specified by:
insertColumnin 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.- Specified by:
insertColumnin 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.- Specified by:
insertColumnin 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.- Specified by:
removeColumnin interfaceSpreadSheet- Parameters:
columnIndex- the column to remove- Returns:
- true if removed
-
removeColumn
public boolean removeColumn(String columnKey)
Removes the specified column.- Specified by:
removeColumnin 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:
getRowin 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:
getRowin 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:
getRowKeyin 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:
getRowIndexin 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:
getCellIndexin 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:
hasCellin 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:
getCellin 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:
getCellPositionin 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:
rowKeysin interfaceSpreadSheet- Returns:
- the row keys
-
rows
public Collection<DataRow> rows()
Returns all rows.- Specified by:
rowsin interfaceSpreadSheet- Returns:
- the rows
-
sortRowKeys
public void sortRowKeys()
Sorts the rows according to the row keys.- Specified by:
sortRowKeysin interfaceSpreadSheet- See Also:
rowKeys()
-
sortRowKeys
public void sortRowKeys(Comparator<String> comp)
Sorts the rows according to the row keys.- Specified by:
sortRowKeysin 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.
NB: the row keys will change!- Specified by:
sortin 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.
NB: the row keys will change!- Specified by:
sortin interfaceSpreadSheet- Parameters:
comp- the row comparator to use
-
sort
public void sort(RowComparator comp, boolean unique)
Sorts the rows using the given comparator.
NB: the row keys will change!- Specified by:
sortin 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:
getColumnCountin interfaceSpreadSheet- Returns:
- the number of columns
-
getRowCount
public int getRowCount()
Returns the number of rows currently stored.- Specified by:
getRowCountin 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:
isNumericin 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:
isNumericin 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:
isContentTypein 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:
getContentTypein 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:
getContentTypesin 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:
getCellValuesin 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:
getCellValuesin 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:
equalsHeaderin interfaceSpreadSheet- Parameters:
other- the other spreadsheet to compare with- Returns:
- null if equal, otherwise details what differs
-
toString
public String toString()
Returns the spreadsheet as string, i.e., CSV formatted.- Specified by:
toStringin interfaceSpreadSheet- Overrides:
toStringin classObject- Returns:
- the string representation
-
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:
toMatrixin interfaceSpreadSheet- Returns:
- the row-wise matrix
-
removeMissing
public boolean removeMissing()
Removes all cells marked "missing".- Specified by:
removeMissingin interfaceSpreadSheet- Returns:
- true if any cell was removed
-
getSharedStringsTable
public SharedStringsTable getSharedStringsTable()
Returns the table for shared strings.- Specified by:
getSharedStringsTablein interfaceSpreadSheet- Returns:
- the table
-
setDateLenient
public void setDateLenient(boolean value)
Sets whether parsing of dates is to be lenient or not.- Specified by:
setDateLenientin 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:
isDateLenientin 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:
setDateTimeLenientin 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:
isDateTimeLenientin 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:
setDateTimeMsecLenientin 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:
isDateTimeMsecLenientin 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:
setTimeLenientin 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:
isTimeLenientin 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:
setTimeMsecLenientin 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:
isTimeMsecLenientin interfaceSpreadSheet- Returns:
- true if parsing is lenient
-
setTimeZone
public void setTimeZone(TimeZone value)
Sets the timezone to use.- Specified by:
setTimeZonein interfaceSpreadSheet- Parameters:
value- the new timezone- See Also:
DateFormat.setTimeZone(TimeZone)
-
getTimeZone
public TimeZone getTimeZone()
Returns the currently used timezone.- Specified by:
getTimeZonein 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:
setLocalein interfaceLocaleSupporter- Specified by:
setLocalein interfaceSpreadSheet- Parameters:
value- the locale to use
-
getLocale
public Locale getLocale()
Returns the current locale.- Specified by:
getLocalein interfaceLocaleSupporter- Specified by:
getLocalein interfaceSpreadSheet- Returns:
- the locale
-
calculate
public void calculate()
Triggers all formula cells to recalculate their values.- Specified by:
calculatein interfaceSpreadSheet
-
mergeWith
public void mergeWith(SpreadSheet other)
Puts the content of the provided spreadsheet on the right.- Specified by:
mergeWithin interfaceMergeable<SpreadSheet>- Specified by:
mergeWithin interfaceSpreadSheet- Parameters:
other- the spreadsheet to merge with
-
toView
public SpreadSheet toView(int[] rows, int[] columns)
Creates a view of the spreadsheet with the specified rows/columns.- Specified by:
toViewin interfaceSpreadSheet- Parameters:
columns- the columns to use, null for allrows- the rows to use, null for all- Returns:
- the view
-
main
public static void main(String[] args)
-
-