Implementation class for the Range interface. This merely
holds the raw range information. This implementation is used
for ranges which are present on the current working sheet, so the
getSheetIndex merely returns -1
| Method from jxl.biff.SheetRangeImpl Detail: |
public boolean equals(Object o) {
if (o == this)
{
return true;
}
if (!(o instanceof SheetRangeImpl))
{
return false;
}
SheetRangeImpl compare = (SheetRangeImpl) o;
return (column1 == compare.column1 &&
column2 == compare.column2 &&
row1 == compare.row1 &&
row2 == compare.row2);
}
|
public Cell getBottomRight() {
// If the print area exceeds the bounds of the sheet, then handle
// it here. The sheet implementation will give a NPE
if (column2 >= sheet.getColumns() ||
row2 >= sheet.getRows())
{
return new EmptyCell(column2,row2);
}
return sheet.getCell(column2, row2);
}
Gets the cell at the bottom right of this range |
public int getFirstSheetIndex() {
return -1;
}
Not supported. Returns -1, indicating that it refers to the current
sheet |
public int getLastSheetIndex() {
return -1;
}
Not supported. Returns -1, indicating that it refers to the current
sheet |
public Cell getTopLeft() {
// If the print area exceeds the bounds of the sheet, then handle
// it here. The sheet implementation will give a NPE
if (column1 >= sheet.getColumns() ||
row1 >= sheet.getRows())
{
return new EmptyCell(column1,row1);
}
return sheet.getCell(column1, row1);
}
Gets the cell at the top left of this range |
public int hashCode() {
return 0xffff ^ row1 ^ row2 ^ column1 ^ column2;
}
Standard hash code method |
public void insertColumn(int c) {
if (c > column2)
{
return;
}
if (c < = column1)
{
column1++;
}
if (c < = column2)
{
column2++;
}
}
A column has been inserted, so adjust the range objects accordingly |
public void insertRow(int r) {
if (r > row2)
{
return;
}
if (r < = row1)
{
row1++;
}
if (r < = row2)
{
row2++;
}
}
A row has been inserted, so adjust the range objects accordingly |
public boolean intersects(SheetRangeImpl range) {
if (range == this)
{
return true;
}
if (row2 < range.row1 ||
row1 > range.row2 ||
column2 < range.column1 ||
column1 > range.column2)
{
return false;
}
return true;
}
Sees whether there are any intersections between this range and the
range passed in. This method is used internally by the WritableSheet to
verify the integrity of merged cells, hyperlinks etc. Ranges are
only ever compared for the same sheet |
public void removeColumn(int c) {
if (c > column2)
{
return;
}
if (c < column1)
{
column1--;
}
if (c < column2)
{
column2--;
}
}
A column has been removed, so adjust the range objects accordingly |
public void removeRow(int r) {
if (r > row2)
{
return;
}
if (r < row1)
{
row1--;
}
if (r < row2)
{
row2--;
}
}
A row has been removed, so adjust the range objects accordingly |
public String toString() {
StringBuffer sb = new StringBuffer();
CellReferenceHelper.getCellReference(column1, row1, sb);
sb.append('-");
CellReferenceHelper.getCellReference(column2, row2, sb);
return sb.toString();
}
To string method - primarily used during debugging |