Created attachment 33100 [details] CellRangeAddressBase.java patch plus unit tests This patch resolves a couple TODO's in org.apache.poi.ss.util.CellRangeAddress. I see three options here: 1) Require the caller to supply the spreadsheet version as an argument to isFullColumnRange and isFullRowRange, deprecate the zero-argument version of these methods. 2) Add a SpreadsheetVersion instance variable to this class, set by the constructor (either a final instance variable or with a setter). 3) Let the implementing class (org.apache.poi.hssf.util.CellRangeAddress) override the zero-argument isFullColumnRange to specify the SpreadsheetVersion. The first method seems best, as it has the least impact on existing projects, reduces amount of RAM consumed by this object, and resembles other classes that have been modified with SpreadsheetVersion. The downside is the caller (rather than creator for Option 2) needs to know the SpreadsheetVersion. There seems to be a lot of overlap between AreaReference and CellRangeAddress org.apache.poi.ss.util.AreaReference[1]. In r1685101, AreaReference took the direction of #2 above, adding a SpreadsheetVersion instance variable and deprecating constructors that don't specify the spreadsheet version. AreaReference#isWholeColumnReference() seems to behave similarly to CellRangeAddress#isFullColumnRange. Oddly, AreaReference doesn't include a isWholeRowReference method. CellRangeAddressBase stores 4 ints while AreaReference stores 2 CellReferences. Key difference: References include absolute/relative fields while Addresses do not. Seems like some refactoring is needed here, perhaps merging these classes or having these classes subclassed from a common class. Anyone have any strong opinions on what direction should be taken? [1] https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/AreaReference.java?revision=1685101&view=markup#l194
Created attachment 33237 [details] CellRangeAddressBase.java patch plus unit tests Rebasing patch due to conflicts with bug 58441: define equals method for CellRangeAddressBase, needed for a different bug. Also fixed broken hashCode test.
Created attachment 33238 [details] CellRangeAddressBase.java patch plus unit tests Fix whitespace and hashCode implementation.