You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ab...@apache.org on 2019/05/21 00:13:59 UTC

svn commit: r1859594 - in /poi/trunk/src/java/org/apache/poi/ss/util: CellAddress.java NumberToTextConverter.java

Author: abearez
Date: Tue May 21 00:13:59 2019
New Revision: 1859594

URL: http://svn.apache.org/viewvc?rev=1859594&view=rev
Log:
fix whitespace contradicts operator precedence

Modified:
    poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java
    poi/trunk/src/java/org/apache/poi/ss/util/NumberToTextConverter.java

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java?rev=1859594&r1=1859593&r2=1859594&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellAddress.java Tue May 21 00:13:59 2019
@@ -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 Comp
         this._row = row;
         this._col = column;
     }
-    
+
     /**
      * Create a new CellAddress object.
      *
@@ -77,7 +77,7 @@ public class CellAddress implements Comp
         this._row = Integer.parseInt(sRow)-1;
         this._col = CellReference.convertColStringToIndex(sCol);
     }
-    
+
     /**
      * Create a new CellAddress object.
      *
@@ -86,16 +86,16 @@ public class CellAddress implements Comp
     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 Comp
     public CellAddress(Cell cell) {
         this(cell.getRowIndex(), cell.getColumnIndex());
     }
-    
+
     /**
      * Get the cell address row
      *
@@ -126,7 +126,7 @@ public class CellAddress implements Comp
     /**
      * 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 Comp
     @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 Comp
         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 Comp
 
     @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

Modified: poi/trunk/src/java/org/apache/poi/ss/util/NumberToTextConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/NumberToTextConverter.java?rev=1859594&r1=1859593&r2=1859594&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/NumberToTextConverter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/NumberToTextConverter.java Tue May 21 00:13:59 2019
@@ -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('.');



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org