Bugzilla 47969 - improvements to equals() methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@824972 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-10-13 23:24:14 +00:00
parent af6a4745e2
commit 1833764495
4 changed files with 206 additions and 211 deletions

View File

@ -43,6 +43,7 @@ final class FormulaUsedBlankCellSet {
return _bookIndex * 17 + _sheetIndex;
}
public boolean equals(Object obj) {
assert obj instanceof BookSheetKey : "these private cache key instances are only compared to themselves";
BookSheetKey other = (BookSheetKey) obj;
return _bookIndex == other._bookIndex && _sheetIndex == other._sheetIndex;
}

View File

@ -52,6 +52,7 @@ final class PlainCellCache {
}
public boolean equals(Object obj) {
assert obj instanceof Loc : "these package-private cache key instances are only compared to themselves";
Loc other = (Loc) obj;
return _bookSheetColumn == other._bookSheetColumn && _rowIndex == other._rowIndex;
}

View File

@ -111,6 +111,7 @@ final class ForkedEvaluationSheet implements EvaluationSheet {
}
@Override
public boolean equals(Object obj) {
assert obj instanceof RowColKey : "these private cache key instances are only compared to themselves";
RowColKey other = (RowColKey) obj;
return _rowIndex == other._rowIndex && _columnIndex == other._columnIndex;
}

View File

@ -93,14 +93,6 @@ final class MutableFPNumber {
}
@Override
public boolean equals(Object obj) {
MutableFPNumber other = (MutableFPNumber) obj;
if (_binaryExponent != other._binaryExponent) {
return false;
}
return _significand.equals(other._significand);
}
public boolean isBelowMaxRep() {
int sc = _significand.bitLength() - C_64;
return _significand.compareTo(BI_MAX_BASE.shiftLeft(sc)) < 0;