Package adams.data.spreadsheet
Class CellView
- java.lang.Object
-
- adams.data.spreadsheet.CellView
-
- All Implemented Interfaces:
Cell,Serializable
public class CellView extends Object implements Cell
Wrapper for a cell.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface adams.data.spreadsheet.Cell
Cell.ContentType
-
-
Field Summary
Fields Modifier and Type Field Description protected Cellm_Cellthe wrapped cell.protected Rowm_Ownerthe owner.-
Fields inherited from interface adams.data.spreadsheet.Cell
FORMULA_ERROR, PREFIX_FORMULA
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(Cell cell)Obtains the content/type of the other cell, but not the owner.voidcalculate()Recalculates the value from the cell's formula.CellgetCell()Returns the underlying cell.StringgetContent()Returns the content of the cell.Cell.ContentTypegetContentType()Returns the content type.StringgetFormula()Returns the formula.ObjectgetNative()Returns the cell as native object, according to its type.ObjectgetObject()Returns the object.booleangetOnlyStoreFormulas()Returns whether to only store formulas and not evaluate them.RowgetOwner()Returns the row this cell belongs to.SpreadSheetgetSpreadSheet()Returns the spreadsheet this cell belongs to.intindex()Returns the column this cell is in.booleanisAnyDateType()Checks whether the cell represents a date, time or date/time value.booleanisBoolean()Checks whether the cell represents a boolean value.booleanisDate()Checks whether the cell represents a date value.booleanisDateTime()Checks whether the cell represents a date/time value.booleanisDateTimeMsec()Checks whether the cell represents a date/time with msec value.booleanisDouble()Returns whether the content represents a double number.booleanisEmpty()Checks whether the cell is either missing or has no content.booleanisFormula()Returns whether the content represents a formula.booleanisLong()Returns whether the content represents a long number.booleanisMissing()Checks whether the cell contains a missing value.booleanisNumeric()Checks whether the stored string is numeric.booleanisObject()Returns whether the content represents an object.booleanisQuiet()Returns whether logging output is suppressed, e.g., from parse errors.booleanisTime()Checks whether the cell represents a time value.booleanisTimeMsec()Checks whether the cell represents a time/msec value.CellparseContent(String value)Attempts to determine the data type of the string.ObjectparseContent(String value, Cell.ContentType type)Parses the content of the cell using the specified type.CellsetContent(DateTime value)Sets the content of the cell.CellsetContent(DateTimeMsec value)Sets the content of the cell.CellsetContent(Time value)Sets the content of the cell.CellsetContent(TimeMsec value)Sets the content of the cell.CellsetContent(Boolean value)Sets the content of the cell.CellsetContent(Byte value)Sets the content of the cell.CellsetContent(Double value)Sets the content of the cell.CellsetContent(Float value)Sets the content of the cell.CellsetContent(Integer value)Sets the content of the cell.CellsetContent(Long value)Sets the content of the cell.CellsetContent(Short value)Sets the content of the cell.CellsetContent(String value)Sets the content of the cell.CellsetContent(Date value)Sets the content of the cell.CellsetContentAs(String value, Cell.ContentType type)Sets the content of the cell, trying to parse the content using the specified content type.CellsetContentAsString(String value)Sets the string content of the cell.CellsetFormula(String value)Sets the formula content of the cell.voidsetMissing()Sets the cell to missing.CellsetNative(Object value)Determines the best set-method based on the class of the provided object.CellsetObject(Object value)Sets the object content of the cell.voidsetOwner(Row owner)Sets the row this cell belongs to.DatetoAnyDateType()Returns the date content, null if not a date, time or date/time.BooleantoBoolean()Returns the boolean content, null if not a boolean.DatetoDate()Returns the date content, null if not a date.DateTimetoDateTime()Checks whether the cell represents a date/time with msec value.DateTimeMsectoDateTimeMsec()Returns the date/time msec content, null if not a date/time.DoubletoDouble()Returns the content as double, if possible.LongtoLong()Returns the content as long, if possible.StringtoString()Returns the content of the cell.TimetoTime()Returns the time content, null if not a time.TimeMsectoTimeMsec()Returns the time/msec content, null if not a time/msec.
-
-
-
Method Detail
-
setOwner
public void setOwner(Row owner)
Sets the row this cell belongs to.
-
getOwner
public Row getOwner()
Returns the row this cell belongs to.
-
getSpreadSheet
public SpreadSheet getSpreadSheet()
Returns the spreadsheet this cell belongs to.- Specified by:
getSpreadSheetin interfaceCell- Returns:
- the spreadsheet
-
assign
public void assign(Cell cell)
Obtains the content/type of the other cell, but not the owner.
Not implemented!
-
setMissing
public void setMissing()
Sets the cell to missing.
Not implemented!- Specified by:
setMissingin interfaceCell
-
setContent
public Cell setContent(Boolean value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Byte value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Short value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Integer value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Long value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Float value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null or NaN is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Double value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null or NaN is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Date value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(DateTime value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(DateTimeMsec value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(Time value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null is intepreted as missing value- Returns:
- the cell itself
-
setContent
public Cell setContent(TimeMsec value)
Sets the content of the cell.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content; null is intepreted as missing value- Returns:
- the cell itself
-
parseContent
public Cell parseContent(String value)
Attempts to determine the data type of the string.
Not implemented!- Specified by:
parseContentin interfaceCell- Parameters:
value- the non-empty string to parse- Returns:
- the cell itself
-
setContent
public Cell setContent(String value)
Sets the content of the cell. Tries to determine whether the cell content is numeric or not.
Not implemented!- Specified by:
setContentin interfaceCell- Parameters:
value- the content- Returns:
- the cell itself
-
parseContent
public Object parseContent(String value, Cell.ContentType type)
Parses the content of the cell using the specified type. If the string cannot be parsed according to the type, missing is used instead.
Not implemented!- Specified by:
parseContentin interfaceCell- Parameters:
value- the contenttype- the expected type- Returns:
- the parsed content
-
setContentAsString
public Cell setContentAsString(String value)
Sets the string content of the cell.
Not implemented!- Specified by:
setContentAsStringin interfaceCell- Parameters:
value- the content- Returns:
- the cell itself
-
setContentAs
public Cell setContentAs(String value, Cell.ContentType type)
Sets the content of the cell, trying to parse the content using the specified content type.
Not implemented!- Specified by:
setContentAsin interfaceCell- Parameters:
value- the contenttype- the type to use- Returns:
- the cell itself
-
setObject
public Cell setObject(Object value)
Sets the object content of the cell.
Not implemented!
-
setFormula
public Cell setFormula(String value)
Sets the formula content of the cell.
Not implemented!- Specified by:
setFormulain interfaceCell- Parameters:
value- the content- Returns:
- the cell itself
-
getFormula
public String getFormula()
Returns the formula.- Specified by:
getFormulain interfaceCell- Returns:
- the formula, null if none used
-
getObject
public Object getObject()
Returns the object.
-
getContent
public String getContent()
Returns the content of the cell.- Specified by:
getContentin interfaceCell- Returns:
- the content
-
getContentType
public Cell.ContentType getContentType()
Returns the content type.- Specified by:
getContentTypein interfaceCell- Returns:
- the type
-
setNative
public Cell setNative(Object value)
Determines the best set-method based on the class of the provided object. Fallback is thesetObject(Object)method.
Not implemented!
-
getNative
public Object getNative()
Returns the cell as native object, according to its type. If a cell is missing, the result is theSpreadSheet.MISSING_VALUEstring.
-
index
public int index()
Returns the column this cell is in.
-
isEmpty
public boolean isEmpty()
Checks whether the cell is either missing or has no content.
-
isNumeric
public boolean isNumeric()
Checks whether the stored string is numeric.
-
isMissing
public boolean isMissing()
Checks whether the cell contains a missing value.
-
isBoolean
public boolean isBoolean()
Checks whether the cell represents a boolean value.
-
toBoolean
public Boolean toBoolean()
Returns the boolean content, null if not a boolean.
-
isAnyDateType
public boolean isAnyDateType()
Checks whether the cell represents a date, time or date/time value.- Specified by:
isAnyDateTypein interfaceCell- Returns:
- true if date, time or date/time value
-
toAnyDateType
public Date toAnyDateType()
Returns the date content, null if not a date, time or date/time.- Specified by:
toAnyDateTypein interfaceCell- Returns:
- the date, null if not date, time or date/time
-
isDate
public boolean isDate()
Checks whether the cell represents a date value.
-
toDate
public Date toDate()
Returns the date content, null if not a date.
-
isDateTime
public boolean isDateTime()
Checks whether the cell represents a date/time value.- Specified by:
isDateTimein interfaceCell- Returns:
- true if date/time value
-
toDateTime
public DateTime toDateTime()
Checks whether the cell represents a date/time with msec value.- Specified by:
toDateTimein interfaceCell- Returns:
- true if date/time msec value
-
isDateTimeMsec
public boolean isDateTimeMsec()
Checks whether the cell represents a date/time with msec value.- Specified by:
isDateTimeMsecin interfaceCell- Returns:
- true if date/time msec value
-
toDateTimeMsec
public DateTimeMsec toDateTimeMsec()
Returns the date/time msec content, null if not a date/time.- Specified by:
toDateTimeMsecin interfaceCell- Returns:
- the date/time msec, null if not date/time
-
isTime
public boolean isTime()
Checks whether the cell represents a time value.
-
toTime
public Time toTime()
Returns the time content, null if not a time.
-
isTimeMsec
public boolean isTimeMsec()
Checks whether the cell represents a time/msec value.- Specified by:
isTimeMsecin interfaceCell- Returns:
- true if time/msec value
-
toTimeMsec
public TimeMsec toTimeMsec()
Returns the time/msec content, null if not a time/msec.- Specified by:
toTimeMsecin interfaceCell- Returns:
- the time/msec, null if not time/msec
-
isDouble
public boolean isDouble()
Returns whether the content represents a double number.
-
toDouble
public Double toDouble()
Returns the content as double, if possible.
-
isLong
public boolean isLong()
Returns whether the content represents a long number.
-
toLong
public Long toLong()
Returns the content as long, if possible. First, a Double object is created and then the longValue() method called to return the value.
-
isFormula
public boolean isFormula()
Returns whether the content represents a formula.
-
isObject
public boolean isObject()
Returns whether the content represents an object.
-
isQuiet
public boolean isQuiet()
Returns whether logging output is suppressed, e.g., from parse errors.
-
getOnlyStoreFormulas
public boolean getOnlyStoreFormulas()
Returns whether to only store formulas and not evaluate them.- Specified by:
getOnlyStoreFormulasin interfaceCell- Returns:
- true if only stored
-
calculate
public void calculate()
Recalculates the value from the cell's formula.
-
getCell
public Cell getCell()
Returns the underlying cell.- Returns:
- the cell
-
-