olg.csv.base
Class Cell

Package class diagram package Cell
java.lang.Object
  extended by olg.csv.base.Cell

public class Cell
extends Object

Cell in a spreadsheet. Impoverished model to be conformed with use of CSV.

See Also:
Row

Field Summary
private static byte CHAR_A
          A char as byte.
private static String FORMAT_NUM_REGEXP
          Reg Exp to validate num Cell format.
private static int NB_CHAR
          NB alpha char.
private  int num
          the cell num in its row.
private  String value
          The value of the cell.
 
Constructor Summary
Cell(int num, String value)
           
Cell(String num, String value)
           
 
Method Summary
static String defaultCellName(String num)
          Returns the default cell name.
 boolean equals(Object obj)
           
static int fromSheetCellNumber(String num)
          Interprets the String in argument as a cell number.
private static int fromSheetFormatNumber(String num)
          Returns the column number.
 int getNum()
          Column number of this cell among parent row cells.
 String getSheetFormatNumber()
          Returns the column number of this cell in a spreadsheet format ( A for 0, AA for 26, ...).
static String getSheetFormatNumber(int num)
          Returns a num cell in a spreadsheet cell number format.
 String getValue()
          Returns the value of this cell.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this cell represents an empty cell.
 String toString()
          Returns the couple (num: value) that this cell represents.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMAT_NUM_REGEXP

private static final String FORMAT_NUM_REGEXP
Reg Exp to validate num Cell format.

See Also:
Constant Field Values

NB_CHAR

private static final int NB_CHAR
NB alpha char.

See Also:
Constant Field Values

CHAR_A

private static final byte CHAR_A
A char as byte.

See Also:
Constant Field Values

num

private final int num
the cell num in its row.


value

private final String value
The value of the cell.

Constructor Detail

Cell

public Cell(int num,
            String value)
Parameters:
num - column number. Must be >= 0.
value - cell value

Cell

public Cell(String num,
            String value)
Parameters:
num - column number
value - cell value
Method Detail

fromSheetCellNumber

public static int fromSheetCellNumber(String num)
Interprets the String in argument as a cell number. Two ways :

Parameters:
num - the num cell. Must match one of the two cases see above.
Returns:
the cell num as integer.

getSheetFormatNumber

public static String getSheetFormatNumber(int num)
Returns a num cell in a spreadsheet cell number format.

Parameters:
num - . Must be >=0.
Returns:
the num as a spreadsheet cell number

defaultCellName

public static String defaultCellName(String num)
Returns the default cell name.

Parameters:
num - the num of a cell.
Returns:
the default cell name.

getNum

public int getNum()
Column number of this cell among parent row cells.

Returns:
the cell num.

getValue

public String getValue()
Returns the value of this cell.

Returns:
null if this cell is empty.

isEmpty

public boolean isEmpty()
Returns true if this cell represents an empty cell.

Returns:
true if cell is empty.

getSheetFormatNumber

public String getSheetFormatNumber()
Returns the column number of this cell in a spreadsheet format ( A for 0, AA for 26, ...).

Returns:
the column number in a sheet format.

toString

public String toString()
Returns the couple (num: value) that this cell represents.

Overrides:
toString in class Object
Returns:
the cell string representation.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

fromSheetFormatNumber

private static int fromSheetFormatNumber(String num)
Returns the column number.

Parameters:
num - column number in a spreadsheet format.
Returns:
the column number.


Copyright © 2014. All Rights Reserved.