com.rubecula.spreadsheet
Class CellRange

java.lang.Object
  |
  +--com.rubecula.util.Range
        |
        +--com.rubecula.spreadsheet.CellRange

public class CellRange
extends Range

This class models a range of cells either rows or columns.

Since:
S_0_2
Version:
$Revision: 1.3 $
Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.util.Range
_End, _Start, $ALL, $NEG, $NONNEG, $NONPOS, $POS, $ZERO
 
Constructor Summary
CellRange(CellRange range)
          Constructor to create a cell range which is a copy of another cell range.
CellRange(int row)
          Constructor for single row.
CellRange(int index, boolean isColumn)
          Constructor for cell row or column.
CellRange(int start, int end)
          Constructor for row range.
CellRange(int start, int end, boolean isColumn)
          Constructor for cell range.
CellRange(Range range, boolean isColumn)
          Constructor to create a cell range from a range and the isColumn indicator.
 
Method Summary
 Range intersection(CellRange that)
          Yield the intersection of this range and that range.
 Range union(CellRange that)
          Yield the union of this cell range and that cell range.
static CellRange valueOf(java.lang.String string)
          Factory method to create a new CellRange from the given string.
static CellRange valueOf(java.lang.String start, java.lang.String end)
          Factory method to create a new CellRange from the given start and end.
 
Methods inherited from class com.rubecula.util.Range
getEnd, getStart, includes, intersection, isValid, length, substring, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellRange

public CellRange(int start,
                 int end,
                 boolean isColumn)
Constructor for cell range.

Parameters:
start - the index of the starting cell.
end - the index of the ending cell.
isColumn - true if the range is a column range rather than a row range.

CellRange

public CellRange(int index,
                 boolean isColumn)
Constructor for cell row or column.

Parameters:
index - the index of the row or column
isColumn - true if this will represent a column rather than a row.

CellRange

public CellRange(int start,
                 int end)
Constructor for row range.

Parameters:
start - the index of the starting row.
end - the index of the ending row.

CellRange

public CellRange(int row)
Constructor for single row.

Parameters:
row - the index of the row.

CellRange

public CellRange(Range range,
                 boolean isColumn)
Constructor to create a cell range from a range and the isColumn indicator.

Parameters:
range - the range to copy.
isColumn - true if this will represent a column rather than a row.

CellRange

public CellRange(CellRange range)
Constructor to create a cell range which is a copy of another cell range.

Parameters:
range - the cell range to copy.
Method Detail

valueOf

public static CellRange valueOf(java.lang.String start,
                                java.lang.String end)
Factory method to create a new CellRange from the given start and end.

Parameters:
start - of the form letter(s) OR digit(s)
end - of the form letter(s) OR digit(s)
Returns:
an appropriate cell range.

valueOf

public static CellRange valueOf(java.lang.String string)
Factory method to create a new CellRange from the given string.

Parameters:
string - of the form letter(s)[:letter(s)]* OR digit(s)[:digit(s)]* where []* indicates optional.
Returns:
an appropriate cell range.

intersection

public Range intersection(CellRange that)
Yield the intersection of this range and that range.

Parameters:
that - a cell range which is to be intersected with this.
Returns:
a cell range which runs from the maximum of the two start values through the minimum of the two end values.

union

public Range union(CellRange that)
Yield the union of this cell range and that cell range.

Parameters:
that - a cell range which is to be unioned with this.
Returns:
a cell range which runs from the minimum of the two start values through the maximum of the two end values.