com.iisc.jwc.jsheet
Class Cell

java.lang.Object
  extended bycom.iisc.jwc.jsheet.Cell
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Cell
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Cell contains a reference to a row, column, and sheet that represents a cell in a sheet.

See Also:
Serialized Form

Field Summary
 int col
          The column reference.
static short CURRENT_SHEET
          The current sheet has been specified for the cell.
static short NO_SHEET
          No sheet has been specified for the cell.
 int row
          The row reference.
 short sheetIdx
          The sheet index reference, default to CURRENT_SHEET or -2.
 
Constructor Summary
Cell()
          Constructs a Cell.
Cell(int row, int col)
          Constructs a Cell with a specified row and column.
Cell(int row, int col, short sheetIdx)
          Constructs a Cell with a specified row, col and sheet index.
Cell(java.lang.String cellRef)
          Parses the string and constructs a Cell.
 
Method Summary
 java.lang.Object clone()
          Performs a cloning operation for a Cell.
 boolean equals(java.lang.Object cell)
          Returns true if the object values are equal.
 short getSheetIndex()
          Returns the sheet index for the cell.
 int hashCode()
          Returns the hashcode for this Cell.
 boolean isValid()
          Returns true if the row and column are in a valid range.
 void setSheetIndex(short index)
          Sets a new sheet index for this cell.
 void setValue(int row, int col)
          Sets a new row and col value for this cell.
 void setValueUsingString(java.lang.String cellRef)
          Parses the string and creates a Cell object.
 java.lang.String toString()
          Returns a String representation of this object.
 short validate(short curSheet, int totalSheets)
          Returns the sheet index if this cell is valid.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

col

public int col
The column reference.


CURRENT_SHEET

public static final short CURRENT_SHEET
The current sheet has been specified for the cell.

See Also:
Constant Field Values

NO_SHEET

public static final short NO_SHEET
No sheet has been specified for the cell.

See Also:
Constant Field Values

row

public int row
The row reference.


sheetIdx

public short sheetIdx
The sheet index reference, default to CURRENT_SHEET or -2.

Constructor Detail

Cell

public Cell()
Constructs a Cell.


Cell

public Cell(int row,
            int col)
Constructs a Cell with a specified row and column.

Parameters:
row - the row reference.
col - the column reference.

Cell

public Cell(int row,
            int col,
            short sheetIdx)
Constructs a Cell with a specified row, col and sheet index.

Parameters:
row - the row reference.
col - the column reference.
sheetIdx - index of sheet in this book; zero based.

Cell

public Cell(java.lang.String cellRef)
     throws JSException
Parses the string and constructs a Cell.

Parameters:
cellRef - The string to parse.
Throws:
JSException - Invalid reference.
Method Detail

clone

public java.lang.Object clone()
Performs a cloning operation for a Cell.

Returns:
the new Cell.

equals

public final boolean equals(java.lang.Object cell)
Returns true if the object values are equal.

Parameters:
cell - the cell to test against.
Returns:
true if the object values are equal.

getSheetIndex

public short getSheetIndex()
Returns the sheet index for the cell.

Returns:
the sheet index.

hashCode

public int hashCode()
Returns the hashcode for this Cell. Algorithm borrowed from java.awt.Point.hashCode()

Returns:
a hash code for this Cell.

isValid

public boolean isValid()
Returns true if the row and column are in a valid range.

Returns:
true if the row and column are in a valid range.

setSheetIndex

public void setSheetIndex(short index)
Sets a new sheet index for this cell.

Parameters:
index - a valid sheet index for the book; zero based.

setValue

public void setValue(int row,
                     int col)
Sets a new row and col value for this cell.

Parameters:
row - the row reference.
col - the column reference.

setValueUsingString

public void setValueUsingString(java.lang.String cellRef)
                         throws JSException
Parses the string and creates a Cell object. Note that this method is not overloaded with the setValueUsingCCell method because JavaScript cannot handle overloaded methods that have the same number of parameters.

Parameters:
cellRef - The string to use in setting the cell value.
Throws:
JSException - Invalid reference

toString

public java.lang.String toString()
Returns a String representation of this object.

Returns:
a String representation of this object.

validate

public short validate(short curSheet,
                      int totalSheets)
               throws JSException
Returns the sheet index if this cell is valid.

Parameters:
curSheet - the current sheet index.
totalSheets - the total number of sheets in this book.
Returns:
the sheet index if this cell is valid.
Throws:
JSException - Invalid cell or sheet reference.

Email JSheet Support

www.jsheet.com
Copyright 1995 - 2003 Investment Intelligence Systems Limited.