com.extentech.ExtenXLS
Class CellRangeRef

java.lang.Object
  extended by com.extentech.ExtenXLS.CellRangeRef
All Implemented Interfaces:
Cloneable

public class CellRangeRef
extends Object
implements Cloneable

Represents a reference to a 3D range of cells. This class is not currently part of the public API. No input validation whatsoever is performed. Any combination of values may be set, whether it makes any sense or not.

Author:
Sam Hanes

Constructor Summary
CellRangeRef(int first_row, int first_col, int last_row, int last_col)
           
CellRangeRef(int first_row, int first_col, int last_row, int last_col, String first_sheet, String last_sheet)
           
CellRangeRef(int first_row, int first_col, int last_row, int last_col, WorkSheetHandle first_sheet, WorkSheetHandle last_sheet)
           
 
Method Summary
 Object clone()
          Creates and returns a copy of this range.
 boolean contains(CellRangeRef range)
          Returns whether this range entirely contains the given range.
 boolean equals(Object other)
          Compares this range to the specified object.
static CellRangeRef fromA1(String reference)
          Parses a range in A1 notation and returns the equivalent CellRangeRef.
static CellRangeRef fromA1(String reference, WorkBookHandle book)
          Convenience method combining fromA1(String) and resolve(WorkBookHandle).
 int getFirstColumn()
          Returns the lowest-indexed column in this range.
 int getFirstRow()
          Returns the lowest-indexed row in this range.
 WorkSheetHandle getFirstSheet()
          Returns the first sheet in this range.
 String getFirstSheetName()
          Returns the name of the first sheet in this range.
 int getLastColumn()
          Returns the highest-indexed column in this range.
 int getLastRow()
          Returns the highest-indexed row in this range.
 WorkSheetHandle getLastSheet()
          Returns the last sheet in this range.
 String getLastSheetName()
          Returns the name of the last sheet in this range.
 boolean hasSheet()
          Determines whether this range is qualified with a sheet.
 boolean isMultiSheet()
          Determines whether this range spans multiple sheets.
 void resolve(WorkBookHandle book)
          Resolves sheet names into sheet handles against the given book.
 void setFirstColumn(int value)
          Sets the first column in this range.
 void setFirstRow(int value)
          Sets the first row in this range.
 void setFirstSheet(WorkSheetHandle sheet)
          Sets the first sheet in this range.
 void setLastColumn(int value)
          Sets the last column in this range.
 void setLastRow(int value)
          Sets the last row in this range.
 void setLastSheet(WorkSheetHandle sheet)
          Sets the last sheet in this range.
 String toString()
          Gets this range in A1 notation.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CellRangeRef

public CellRangeRef(int first_row,
                    int first_col,
                    int last_row,
                    int last_col)

CellRangeRef

public CellRangeRef(int first_row,
                    int first_col,
                    int last_row,
                    int last_col,
                    String first_sheet,
                    String last_sheet)

CellRangeRef

public CellRangeRef(int first_row,
                    int first_col,
                    int last_row,
                    int last_col,
                    WorkSheetHandle first_sheet,
                    WorkSheetHandle last_sheet)
Method Detail

fromA1

public static CellRangeRef fromA1(String reference)
Parses a range in A1 notation and returns the equivalent CellRangeRef.


fromA1

public static CellRangeRef fromA1(String reference,
                                  WorkBookHandle book)
                           throws com.extentech.formats.XLS.WorkSheetNotFoundException
Convenience method combining fromA1(String) and resolve(WorkBookHandle).

Throws:
com.extentech.formats.XLS.WorkSheetNotFoundException

resolve

public void resolve(WorkBookHandle book)
             throws com.extentech.formats.XLS.WorkSheetNotFoundException
Resolves sheet names into sheet handles against the given book.

Parameters:
book - the book against which the sheet names should be resolved
Throws:
com.extentech.formats.XLS.WorkSheetNotFoundException - if either of the sheets does not exist in the given book

getFirstRow

public int getFirstRow()
Returns the lowest-indexed row in this range.

Returns:
the row index or null if this is a column range

getFirstColumn

public int getFirstColumn()
Returns the lowest-indexed column in this range.

Returns:
the column index or null if this is a row range

getLastRow

public int getLastRow()
Returns the highest-indexed row in this range.

Returns:
the row index or null if this is a column range

getLastColumn

public int getLastColumn()
Returns the highest-indexed column in this range.

Returns:
the column index or null if this is a row range

getFirstSheetName

public String getFirstSheetName()
Returns the name of the first sheet in this range.

Returns:
the name of the sheet or null if this range is not qualified with a sheet

getFirstSheet

public WorkSheetHandle getFirstSheet()
Returns the first sheet in this range.

Returns:
the WorkSheetHandle or null if this range is not qualified with a sheet or the sheet names have not been resolved

getLastSheetName

public String getLastSheetName()
Returns the name of the last sheet in this range.

Returns:
the name of the sheet or null if this range is not qualified with a sheet

getLastSheet

public WorkSheetHandle getLastSheet()
Returns the last sheet in this range.

Returns:
the WorkSheetHandle or null if this range is not qualified with a sheet or the sheet names have not been resolved

hasSheet

public boolean hasSheet()
Determines whether this range is qualified with a sheet.


isMultiSheet

public boolean isMultiSheet()
Determines whether this range spans multiple sheets.


setFirstRow

public void setFirstRow(int value)
Sets the first row in this range.

Parameters:
value - the row index to set

setFirstColumn

public void setFirstColumn(int value)
Sets the first column in this range.

Parameters:
value - the column index to set

setFirstSheet

public void setFirstSheet(WorkSheetHandle sheet)
Sets the first sheet in this range.


setLastRow

public void setLastRow(int value)
Sets the last row in this range.

Parameters:
value - the row index to set

setLastColumn

public void setLastColumn(int value)
Sets the last column in this range.

Parameters:
value - the column index to set

setLastSheet

public void setLastSheet(WorkSheetHandle sheet)
Sets the last sheet in this range.


contains

public boolean contains(CellRangeRef range)
Returns whether this range entirely contains the given range. This ignores the sheets, if any, and compares only the cell ranges.


equals

public boolean equals(Object other)
Compares this range to the specified object. The result is true if and only if the argument is not null and is a CellRangeRef object that represents the same range as this object.

Overrides:
equals in class Object

clone

public Object clone()
Creates and returns a copy of this range.

Overrides:
clone in class Object

toString

public String toString()
Gets this range in A1 notation.

Overrides:
toString in class Object


Copyright © 2011 Extentech Inc. All Rights Reserved.