From: Alain BĂ©arez Date: Tue, 21 May 2019 00:13:59 +0000 (+0000) Subject: fix whitespace contradicts operator precedence X-Git-Tag: REL_4_1_1~94 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=906c52d81d625ae2fce9905c38a4ad29fb77caf1;p=poi.git fix whitespace contradicts operator precedence git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859594 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/ss/util/CellAddress.java b/src/java/org/apache/poi/ss/util/CellAddress.java index 32c2711e2a..f9129647d9 100644 --- a/src/java/org/apache/poi/ss/util/CellAddress.java +++ b/src/java/org/apache/poi/ss/util/CellAddress.java @@ -25,9 +25,9 @@ import org.apache.poi.ss.usermodel.Cell; *

This class is a container for POI usermodel row=0 column=0 cell references. * It is barely a container for these two coordinates. The implementation * of the Comparable interface sorts by "natural" order top left to bottom right.

- * + * *

Use CellAddress when you want to refer to the location of a cell in a sheet - * when the concept of relative/absolute does not apply (such as the anchor location + * when the concept of relative/absolute does not apply (such as the anchor location * of a cell comment). Use {@link CellReference} when the concept of * relative/absolute does apply (such as a cell reference in a formula). * CellAddresses do not have a concept of "sheet", while CellReferences do.

@@ -35,10 +35,10 @@ import org.apache.poi.ss.usermodel.Cell; public class CellAddress implements Comparable { /** A constant for references to the first cell in a sheet. */ public static final CellAddress A1 = new CellAddress(0, 0); - + private final int _row; private final int _col; - + /** * Create a new CellAddress object. * @@ -50,7 +50,7 @@ public class CellAddress implements Comparable { this._row = row; this._col = column; } - + /** * Create a new CellAddress object. * @@ -77,7 +77,7 @@ public class CellAddress implements Comparable { this._row = Integer.parseInt(sRow)-1; this._col = CellReference.convertColStringToIndex(sCol); } - + /** * Create a new CellAddress object. * @@ -86,16 +86,16 @@ public class CellAddress implements Comparable { public CellAddress(CellReference reference) { this(reference.getRow(), reference.getCol()); } - + /** * Create a new CellAddress object - * + * * @param address a CellAddress */ public CellAddress(CellAddress address) { this(address.getRow(), address.getColumn()); } - + /** * Create a new CellAddress object. * @@ -104,7 +104,7 @@ public class CellAddress implements Comparable { public CellAddress(Cell cell) { this(cell.getRowIndex(), cell.getColumnIndex()); } - + /** * Get the cell address row * @@ -126,7 +126,7 @@ public class CellAddress implements Comparable { /** * Compare this CellAddress using the "natural" row-major, column-minor ordering. * That is, top-left to bottom-right ordering. - * + * * @param other * @return
    *
  • -1 if this CellAddress is before (above/left) of other
  • @@ -137,10 +137,14 @@ public class CellAddress implements Comparable { @Override public int compareTo(CellAddress other) { int r = this._row-other._row; - if (r!=0) return r; + if (r!=0) { + return r; + } r = this._col-other._col; - if (r!=0) return r; + if (r!=0) { + return r; + } return 0; } @@ -153,7 +157,7 @@ public class CellAddress implements Comparable { if(!(o instanceof CellAddress)) { return false; } - + CellAddress other = (CellAddress) o; return _row == other._row && _col == other._col; @@ -161,14 +165,14 @@ public class CellAddress implements Comparable { @Override public int hashCode() { - return this._row + this._col<<16; + return (this._row + this._col) << 16; } @Override public String toString() { return formatAsString(); } - + /** * Same as {@link #toString()} * @return A1-style cell address string representation diff --git a/src/java/org/apache/poi/ss/util/NumberToTextConverter.java b/src/java/org/apache/poi/ss/util/NumberToTextConverter.java index 6c95c2b81f..7023063de2 100644 --- a/src/java/org/apache/poi/ss/util/NumberToTextConverter.java +++ b/src/java/org/apache/poi/ss/util/NumberToTextConverter.java @@ -220,7 +220,7 @@ public final class NumberToTextConverter { appendExp(sb, decExponent); return; } - int nFractionalDigits = countSigDigits - decExponent-1; + int nFractionalDigits = countSigDigits - decExponent - 1; if (nFractionalDigits > 0) { sb.append(decimalDigits.subSequence(0, decExponent+1)); sb.append('.');