olg.csv.base
Class Row

Package class diagram package 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.

See Also:
IReader

Field Summary
private  List<Cell> cells
          Cells of this row.
private  int num
          The number of this row among a row list.
private  int size
          number of cell (empties and no empty cells ).
 
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
 

Field Detail

num

private final int num
The number of this row among a row list.


cells

private final List<Cell> cells
Cells of this row. May be only contain cells which are no empty. Depends on reader usage and its policy


size

private final int size
number of cell (empties and no empty cells ).

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.