olg.csv.base
Class Row

java.lang.Object
  extended by olg.csv.base.Row
All Implemented Interfaces:
Iterable<Cell>

public class Row
extends Object
implements Iterable<Cell>

Row in a spreadsheet. Impoverished model to be conformed to CSV.

Author:
Olivier Godineau
See Also:
IReader

Constructor Summary
Row(int num, List<Cell> cells, int size)
          Constructs a row with a num, cells and size.
 
Method Summary
 Row copy(int num)
          Create a copy with its size and cells.
 Cell getCell(int num)
          Returns registered Cell which has the given num.
 Cell getCell(String num)
          Return cell at the specific number from this row.
 int getNum()
          Return the number of the row among the target document lines.
 int getSize()
          The size of this Row corresponding to the number of cells (empty and no empty). can differ from getCells().size() depending on the chosen option at reading or at writing.
 boolean isEmpty()
           
 Iterator<Cell> iterator()
          Cells iterator.
 String toString()
          Returns a representation of this row like {num:num,size:size,cells:cells}.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Row

public Row(int num,
           List<Cell> cells,
           int size)
Constructs a row with a num, cells and size.

Parameters:
num - line number.Lines number begin at 1
cells - the cells
size - the row size. Must be >0.
Method Detail

isEmpty

public boolean isEmpty()
Returns:
true if row represents an empty row (all cells are empty).

getNum

public int getNum()
Return the number of the row among the target document lines.

Returns:
the row num.

getSize

public int getSize()
The size of this Row corresponding to the number of cells (empty and no empty). can differ from getCells().size() depending on the chosen option at reading or at writing.

Returns:
the row size.

iterator

public Iterator<Cell> iterator()
Cells iterator. Only iterate registered cells in this row.

Specified by:
iterator in interface Iterable<Cell>
Returns:
a cells iterator.

getCell

public Cell getCell(int num)
Returns registered Cell which has the given num.

Parameters:
num - num of the cell. Must be < row size.
Returns:
null if no cell found with the given num

getCell

public Cell getCell(String num)
Return cell at the specific number from this row.

Parameters:
num - Must be in a sheet cell number format (as A, B, C, ..., AB,...) or a non negative integer
Returns:
null if no cell found with the given num.
See Also:
Cell.fromSheetCellNumber(String)

toString

public String toString()
Returns a representation of this row like {num:num,size:size,cells:cells}.

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

copy

public Row copy(int num)
Create a copy with its size and cells.

Parameters:
num - the num of the row
Returns:
the row


Copyright © 2014. All rights reserved.