net.sf.jett.formula
Class CellRef

java.lang.Object
  extended by org.apache.poi.ss.util.CellReference
      extended by net.sf.jett.formula.CellRef
All Implemented Interfaces:
java.lang.Comparable<CellRef>
Direct Known Subclasses:
CellRefRange

public class CellRef
extends org.apache.poi.ss.util.CellReference
implements java.lang.Comparable<CellRef>

A CellRef is a subclass of the POI class CellReference that provides a correct equals method and adds the concept of a default value.

Author:
Randy Gettman

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.poi.ss.util.CellReference
org.apache.poi.ss.util.CellReference.NameType
 
Field Summary
static java.lang.String DEF_DEFAULT_VALUE
          If no default value is given, this the default default value.
static java.lang.String DEFAULT_VALUE_IND
          The token expected in a cell reference with a default value.
 
Constructor Summary
CellRef(org.apache.poi.ss.usermodel.Cell cell)
           
CellRef(int pRow, int pCol)
           
CellRef(int pRow, int pCol, boolean pAbsRow, boolean pAbsCol)
           
CellRef(int pRow, short pCol)
           
CellRef(java.lang.String cellRef)
           
CellRef(java.lang.String pSheetName, int pRow, int pCol, boolean pAbsRow, boolean pAbsCol)
           
 
Method Summary
 int compareTo(CellRef other)
          Compares this CellRef to another CellRef.
 boolean equals(java.lang.Object o)
          Checks whether this cell reference is equal to another object.
 java.lang.String formatAsStringWithDef()
          Include any default value in the formatted string.
 java.lang.String getDefaultValue()
          Returns the default value.
 void setDefaultValue(java.lang.String defaultValue)
          Sets the default value.
 
Methods inherited from class org.apache.poi.ss.util.CellReference
cellReferenceIsWithinRange, classifyCellReference, convertColStringToIndex, convertNumToColString, formatAsString, getCellRefParts, getCol, getRow, getSheetName, isColAbsolute, isColumnWithnRange, isPartAbsolute, isRowAbsolute, isRowWithnRange, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEF_DEFAULT_VALUE

public static final java.lang.String DEF_DEFAULT_VALUE
If no default value is given, this the default default value.

See Also:
Constant Field Values

DEFAULT_VALUE_IND

public static final java.lang.String DEFAULT_VALUE_IND
The token expected in a cell reference with a default value.

See Also:
Constant Field Values
Constructor Detail

CellRef

public CellRef(java.lang.String cellRef)

CellRef

public CellRef(int pRow,
               int pCol)

CellRef

public CellRef(int pRow,
               short pCol)

CellRef

public CellRef(org.apache.poi.ss.usermodel.Cell cell)

CellRef

public CellRef(int pRow,
               int pCol,
               boolean pAbsRow,
               boolean pAbsCol)

CellRef

public CellRef(java.lang.String pSheetName,
               int pRow,
               int pCol,
               boolean pAbsRow,
               boolean pAbsCol)
Method Detail

equals

public boolean equals(java.lang.Object o)
Checks whether this cell reference is equal to another object. They are equal if their row and column indexes are equal, the absolute markers are present in the same way, and either their sheet names are equal or they are both null.

Overrides:
equals in class org.apache.poi.ss.util.CellReference
Parameters:
o - The other object.
Returns:
true if equal, false otherwise.

setDefaultValue

public void setDefaultValue(java.lang.String defaultValue)
Sets the default value. If this is not called, then the default value itself defaults to null.

Parameters:
defaultValue - The default value.

getDefaultValue

public java.lang.String getDefaultValue()
Returns the default value. If this is not called, then the default value itself defaults to null.

Returns:
The default value.

formatAsStringWithDef

public java.lang.String formatAsStringWithDef()
Include any default value in the formatted string.

Returns:
The formatted string, with a possible default value appended.

compareTo

public int compareTo(CellRef other)
Compares this CellRef to another CellRef. Comparison order: sheet names, row indexes, then column indexes.

Specified by:
compareTo in interface java.lang.Comparable<CellRef>
Parameters:
other - Another CellRef.
Returns:
An integer less than zero, equal to zero, or greater than zero if this CellRef compares less than, equal to, or greater than the other CellRef.


Copyright © 2012-2013 Jett Team. All Rights Reserved.