org.statcato.spreadsheet
Class Cell
- java.lang.Object
-
- org.statcato.spreadsheet.Cell
-
public class Cell extends java.lang.ObjectA cell in aSpreadsheetobject.- Since:
- 1.0
- See Also:
Spreadsheet
-
-
Constructor Summary
Constructors Constructor and Description Cell(java.lang.String contents, int row, int column)Constructor, given the contents as a string and the row and column of the cell.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclear()Clears the cell contents by setting to the empty string.booleanequals(Cell cell)Returns true iff the given cell object is equal to this object.intgetColumn()Returns the column number of this celljava.lang.StringgetContents()Returns the unformatted string representation the contents of this cell.java.lang.DoublegetNumValue()Returns the numerical value of the cell contents, or null if not a number.intgetRow()Returns the row number of this cell.booleanhasData()Returns true iff this cell is non-empty (the contents is not equal to an empty string).booleanisNumeric()Returns true if the cell contents represent a number.voidsetColumn(int col)Sets the column number of the cell.voidsetContents(java.lang.String svalue)Sets the contents to the cell to the specified string.voidsetRow(int row)Sets the row number of the cell.java.lang.StringtoString()Returns the string representation of this cell.
-
-
-
Constructor Detail
-
Cell
public Cell(java.lang.String contents, int row, int column)Constructor, given the contents as a string and the row and column of the cell.- Parameters:
contents- string representation of the cell contentsrow- row number (integer)column- column number (integer)
-
-
Method Detail
-
getContents
public java.lang.String getContents()
Returns the unformatted string representation the contents of this cell.- Returns:
- string representation of the contents
-
getRow
public int getRow()
Returns the row number of this cell.- Returns:
- row number (integer)
-
getColumn
public int getColumn()
Returns the column number of this cell- Returns:
- column number (integer)
-
toString
public java.lang.String toString()
Returns the string representation of this cell. If the string represents an integer, simply converts it to string. If the string represents a non-integer number, converts it to string such that there are at most six decimal places. Otherwise, simply returns the unformatted string representation of the contents.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation
-
getNumValue
public java.lang.Double getNumValue()
Returns the numerical value of the cell contents, or null if not a number.- Returns:
- double value of the cell contents, or null if not a number
-
setContents
public void setContents(java.lang.String svalue)
Sets the contents to the cell to the specified string.- Parameters:
svalue- string used to set the cell contents
-
clear
public void clear()
Clears the cell contents by setting to the empty string.
-
setRow
public void setRow(int row)
Sets the row number of the cell.- Parameters:
row- row number
-
setColumn
public void setColumn(int col)
Sets the column number of the cell.- Parameters:
col- column number
-
equals
public boolean equals(Cell cell)
Returns true iff the given cell object is equal to this object. Two cells are equal if their contents, row numbers, and column numbers are equal.- Parameters:
cell- theCellobject to be compared to this object- Returns:
- true iff objects are equal
-
isNumeric
public boolean isNumeric()
Returns true if the cell contents represent a number.- Returns:
- true iff the cell contains a number
-
hasData
public boolean hasData()
Returns true iff this cell is non-empty (the contents is not equal to an empty string).- Returns:
- true iff not empty
-
-
DMelt 3.0 © DataMelt by jWork.ORG