From 0e8dd31f05f98e5a5fed96f53d50f3d10726979a Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Sat, 4 Oct 2008 04:59:26 +0000 Subject: [PATCH] changed workbook reference to index in CellLocation git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@701598 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/ss/formula/CellLocation.java | 14 +++++++------- .../CollaboratingWorkbooksEnvironment.java | 2 +- .../apache/poi/ss/formula/EvaluationCache.java | 2 +- .../poi/ss/formula/WorkbookEvaluator.java | 17 ++++++++++++----- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/poi/ss/formula/CellLocation.java b/src/java/org/apache/poi/ss/formula/CellLocation.java index 6857c4bc1b..bb32e3dfa3 100644 --- a/src/java/org/apache/poi/ss/formula/CellLocation.java +++ b/src/java/org/apache/poi/ss/formula/CellLocation.java @@ -25,24 +25,24 @@ import org.apache.poi.hssf.util.CellReference; final class CellLocation { public static final CellLocation[] EMPTY_ARRAY = { }; - private final EvaluationWorkbook _book; + private final int _bookIx; private final int _sheetIndex; private final int _rowIndex; private final int _columnIndex; private final int _hashCode; - public CellLocation(EvaluationWorkbook book, int sheetIndex, int rowIndex, int columnIndex) { + public CellLocation(int bookIx, int sheetIndex, int rowIndex, int columnIndex) { if (sheetIndex < 0) { throw new IllegalArgumentException("sheetIndex must not be negative"); } - _book = book; + _bookIx = bookIx; _sheetIndex = sheetIndex; _rowIndex = rowIndex; _columnIndex = columnIndex; - _hashCode = System.identityHashCode(book) + sheetIndex + 17 * (rowIndex + 17 * columnIndex); + _hashCode = _bookIx + 17 * (sheetIndex + 17 * (rowIndex + 17 * columnIndex)); } - public Object getBook() { - return _book; + public int getBookIndex() { + return _bookIx; } public int getSheetIndex() { return _sheetIndex; @@ -65,7 +65,7 @@ final class CellLocation { if (getSheetIndex() != other.getSheetIndex()) { return false; } - if (getBook() != other.getBook()) { + if (getBookIndex() != other.getBookIndex()) { return false; } return true; diff --git a/src/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java b/src/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java index c62d2f182d..7939596d3b 100644 --- a/src/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java +++ b/src/java/org/apache/poi/ss/formula/CollaboratingWorkbooksEnvironment.java @@ -97,7 +97,7 @@ public final class CollaboratingWorkbooksEnvironment { EvaluationCache cache = new EvaluationCache(evalListener); for(int i=0; i