diff options
author | Alain Béarez <abearez@apache.org> | 2019-05-21 00:13:59 +0000 |
---|---|---|
committer | Alain Béarez <abearez@apache.org> | 2019-05-21 00:13:59 +0000 |
commit | 906c52d81d625ae2fce9905c38a4ad29fb77caf1 (patch) | |
tree | 340dfcec5d82bf1413c1ac6ad4490d0cd51f2c30 /src | |
parent | 5d376c8696399b58ec1a4625a84110c39c818f64 (diff) | |
download | poi-906c52d81d625ae2fce9905c38a4ad29fb77caf1.tar.gz poi-906c52d81d625ae2fce9905c38a4ad29fb77caf1.zip |
fix whitespace contradicts operator precedence
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859594 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/ss/util/CellAddress.java | 36 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/util/NumberToTextConverter.java | 2 |
2 files changed, 21 insertions, 17 deletions
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; * <p>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.</p> - * + * * <p>Use <tt>CellAddress</tt> 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). * <tt>CellAddress</tt>es do not have a concept of "sheet", while <tt>CellReference</tt>s do.</p> @@ -35,10 +35,10 @@ import org.apache.poi.ss.usermodel.Cell; public class CellAddress implements Comparable<CellAddress> { /** 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<CellAddress> { this._row = row; this._col = column; } - + /** * Create a new CellAddress object. * @@ -77,7 +77,7 @@ public class CellAddress implements Comparable<CellAddress> { 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<CellAddress> { 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<CellAddress> { public CellAddress(Cell cell) { this(cell.getRowIndex(), cell.getColumnIndex()); } - + /** * Get the cell address row * @@ -126,7 +126,7 @@ public class CellAddress implements Comparable<CellAddress> { /** * Compare this CellAddress using the "natural" row-major, column-minor ordering. * That is, top-left to bottom-right ordering. - * + * * @param other * @return <ul> * <li>-1 if this CellAddress is before (above/left) of other</li> @@ -137,10 +137,14 @@ public class CellAddress implements Comparable<CellAddress> { @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<CellAddress> { 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<CellAddress> { @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('.'); |