com.iisc.jwc.jsheet
Class Range

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

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

Range contains a reference to the top, left, bottom, and right cell references and the sheet index that represents a range in a sheet.

See Also:
Serialized Form

Field Summary
 int bottom
          The bottom reference for this range.
static short CURRENT_SHEET
          The current sheet is specified in Range.
 int left
          The left reference for this range.
static short NO_SHEET
          No sheet has been specified in Range.
 int right
          The right reference for this range.
 short sheetIdx
          The sheet index reference (defaults to CURRENT_SHEET or -2).
 int top
          The top reference for this range.
 
Constructor Summary
Range()
          Constructs a new Range.
Range(Cell upperLeft, Cell lowerRight)
          Constructs a new Range.
Range(Cell upperLeft, Cell lowerRight, short sheetIndex)
          Constructs a new Range with the sheetIndex explicitly set.
Range(com.iisc.jwc.orb.CRange range)
          For internal use only!
Range(com.iisc.jwc.orb.CRange range, short sheetIdx)
          For internal use only!
Range(int top, int left, int bottom, int right)
          Constructs a new Range.
Range(int top, int left, int bottom, int right, short sheetIdx)
          Constructs a new Range.
Range(java.lang.String rangeRef)
          Parses the string and constructs a Range.
 
Method Summary
 com.iisc.jwc.orb.CRange asCRange()
          For internal use only!
 java.lang.Object clone()
          Returns a copy of this range.
 boolean contains(Cell cell)
          Returns true if the specifed Cell is within this Range.
 boolean equals(java.lang.Object range)
          Returns true if the object values are equal.
 short getSheetIndex()
          Returns the sheet index for the range.
 boolean isValid()
          Returns true if the top, left, bottom, right and references are valid.
 void setSheetIndex(short index)
          Sets a new sheet index for this range.
 void setValue(int top, int left, int bottom, int right)
          Set new values for the range.
 void setValueUsingCRange(com.iisc.jwc.orb.CRange range)
          For internal use only!
 void setValueUsingString(java.lang.String rangeString)
          Parses the string and creates the equivalent range.
 Range[] subtract(Range range)
          Subtracts the specified range from this range; returns a range of possible ranges composed of the difference between the two.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bottom

public int bottom
The bottom reference for this range.


CURRENT_SHEET

public static short CURRENT_SHEET
The current sheet is specified in Range.


left

public int left
The left reference for this range.


NO_SHEET

public static short NO_SHEET
No sheet has been specified in Range.


right

public int right
The right reference for this range.


sheetIdx

public short sheetIdx
The sheet index reference (defaults to CURRENT_SHEET or -2).


top

public int top
The top reference for this range.

Constructor Detail

Range

public Range()
Constructs a new Range.


Range

public Range(Cell upperLeft,
             Cell lowerRight)
Constructs a new Range. The sheetIndex is set to CURRENT_SHEET.

Parameters:
upperLeft - the cell reference containing the upper left cell.
lowerRight - the cell reference containing the lower right cell.

Range

public Range(Cell upperLeft,
             Cell lowerRight,
             short sheetIndex)
Constructs a new Range with the sheetIndex explicitly set.

Parameters:
upperLeft - the cell reference containing the upper left cell.
lowerRight - the cell reference containing the lower right cell.

Range

public Range(com.iisc.jwc.orb.CRange range)
For internal use only!

Parameters:
range - for internal use only!

Range

public Range(com.iisc.jwc.orb.CRange range,
             short sheetIdx)
For internal use only!

Parameters:
range - for internal use only!
sheetIdx - for internal use only!

Range

public Range(int top,
             int left,
             int bottom,
             int right)
Constructs a new Range.

Parameters:
top - the top row.
left - the left column.
bottom - the bottom row.
right - the right column.

Range

public Range(int top,
             int left,
             int bottom,
             int right,
             short sheetIdx)
Constructs a new Range.

Parameters:
top - the top row.
left - the left column.
bottom - the bottom row.
right - the right column.
sheetIdx - the sheet index, zero based.

Range

public Range(java.lang.String rangeRef)
      throws JSException
Parses the string and constructs a Range.

Parameters:
rangeRef - the string to parse.
Throws:
JSException - If an invalid range reference.
See Also:
setValueUsingString(java.lang.String)
Method Detail

asCRange

public com.iisc.jwc.orb.CRange asCRange()
For internal use only!


clone

public java.lang.Object clone()
Returns a copy of this range.

Returns:
a copy of the range.

contains

public boolean contains(Cell cell)
Returns true if the specifed Cell is within this Range.

Parameters:
cell - the Cell object.
Returns:
whether the Cell in within this Range.

equals

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

Parameters:
range - object to test.
Returns:
whether the objects are of equal value.

getSheetIndex

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

Returns:
the sheet index.

isValid

public boolean isValid()
Returns true if the top, left, bottom, right and references are valid.

Returns:
whether the range is valid.

setSheetIndex

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

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

setValue

public void setValue(int top,
                     int left,
                     int bottom,
                     int right)
Set new values for the range.

Parameters:
top - the top row.
left - the left column.
bottom - the bottom row.
right - the right column.

setValueUsingCRange

public void setValueUsingCRange(com.iisc.jwc.orb.CRange range)
For internal use only!

Parameters:
range - for internal use only!

setValueUsingString

public void setValueUsingString(java.lang.String rangeString)
                         throws JSException
Parses the string and creates the equivalent range. Note: This method is not overloaded with the setValueUsingCRange method because JavaScript cannot handle overloaded methods that have the same number of parameters.

Parameters:
rangeString - the string to parse.
Throws:
JSException - If an invalid range reference.

subtract

public Range[] subtract(Range range)
Subtracts the specified range from this range; returns a range of possible ranges composed of the difference between the two.

Parameters:
range - the range to subtract.
Returns:
a range of possible ranges composed of the difference between the two.

toString

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

Returns:
String representation of this object.

Email JSheet Support

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