You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/07 22:38:09 UTC

svn commit: r1751839 - /poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java

Author: onealj
Date: Thu Jul  7 22:38:09 2016
New Revision: 1751839

URL: http://svn.apache.org/viewvc?rev=1751839&view=rev
Log:
whitespace (3sp to 4sp)

Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java?rev=1751839&r1=1751838&r2=1751839&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java Thu Jul  7 22:38:09 2016
@@ -624,95 +624,95 @@ public final class WorkbookEvaluator {
     }
 
 
-   /**
-    * returns an appropriate Eval impl instance for the Ptg. The Ptg must be
-    * one of: Area3DPtg, AreaPtg, ReferencePtg, Ref3DPtg, IntPtg, NumberPtg,
-    * StringPtg, BoolPtg <br/>special Note: OperationPtg subtypes cannot be
-    * passed here!
-    */
-   private ValueEval getEvalForPtg(Ptg ptg, OperationEvaluationContext ec) {
-       //  consider converting all these (ptg instanceof XxxPtg) expressions to (ptg.getClass() == XxxPtg.class)
-
-       if (ptg instanceof NamePtg) {
-           // Named ranges, macro functions
-           NamePtg namePtg = (NamePtg) ptg;
-           EvaluationName nameRecord = _workbook.getName(namePtg);
-           return getEvalForNameRecord(nameRecord, ec);
-       }
-       if (ptg instanceof NameXPtg) {
-           // Externally defined named ranges or macro functions
-           return processNameEval(ec.getNameXEval((NameXPtg)ptg), ec);
-       }
-       if (ptg instanceof NameXPxg) {
-           // Externally defined named ranges or macro functions
-           return processNameEval(ec.getNameXEval((NameXPxg)ptg), ec);
-       }
+    /**
+     * returns an appropriate Eval impl instance for the Ptg. The Ptg must be
+     * one of: Area3DPtg, AreaPtg, ReferencePtg, Ref3DPtg, IntPtg, NumberPtg,
+     * StringPtg, BoolPtg <br/>special Note: OperationPtg subtypes cannot be
+     * passed here!
+     */
+    private ValueEval getEvalForPtg(Ptg ptg, OperationEvaluationContext ec) {
+        //  consider converting all these (ptg instanceof XxxPtg) expressions to (ptg.getClass() == XxxPtg.class)
+
+        if (ptg instanceof NamePtg) {
+            // Named ranges, macro functions
+            NamePtg namePtg = (NamePtg) ptg;
+            EvaluationName nameRecord = _workbook.getName(namePtg);
+            return getEvalForNameRecord(nameRecord, ec);
+        }
+        if (ptg instanceof NameXPtg) {
+            // Externally defined named ranges or macro functions
+            return processNameEval(ec.getNameXEval((NameXPtg)ptg), ec);
+        }
+        if (ptg instanceof NameXPxg) {
+            // Externally defined named ranges or macro functions
+            return processNameEval(ec.getNameXEval((NameXPxg)ptg), ec);
+        }
 
-       if (ptg instanceof IntPtg) {
+        if (ptg instanceof IntPtg) {
            return new NumberEval(((IntPtg)ptg).getValue());
-       }
-       if (ptg instanceof NumberPtg) {
-           return new NumberEval(((NumberPtg)ptg).getValue());
-       }
-       if (ptg instanceof StringPtg) {
+        }
+        if (ptg instanceof NumberPtg) {
+            return new NumberEval(((NumberPtg)ptg).getValue());
+        }
+        if (ptg instanceof StringPtg) {
            return new StringEval(((StringPtg) ptg).getValue());
-       }
-       if (ptg instanceof BoolPtg) {
+        }
+        if (ptg instanceof BoolPtg) {
            return BoolEval.valueOf(((BoolPtg) ptg).getValue());
-       }
-       if (ptg instanceof ErrPtg) {
+        }
+        if (ptg instanceof ErrPtg) {
            return ErrorEval.valueOf(((ErrPtg) ptg).getErrorCode());
-       }
-       if (ptg instanceof MissingArgPtg) {
+        }
+        if (ptg instanceof MissingArgPtg) {
            return MissingArgEval.instance;
-       }
-       if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
+        }
+        if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
                || ptg instanceof DeletedArea3DPtg || ptg instanceof DeletedRef3DPtg) {
            return ErrorEval.REF_INVALID;
-       }
-       if (ptg instanceof Ref3DPtg) {
+        }
+        if (ptg instanceof Ref3DPtg) {
            return ec.getRef3DEval((Ref3DPtg)ptg);
-       }
-       if (ptg instanceof Ref3DPxg) {
+        }
+        if (ptg instanceof Ref3DPxg) {
            return ec.getRef3DEval((Ref3DPxg)ptg);
-       }
-       if (ptg instanceof Area3DPtg) {
+        }
+        if (ptg instanceof Area3DPtg) {
            return ec.getArea3DEval((Area3DPtg)ptg);
-       }
-       if (ptg instanceof Area3DPxg) {
+        }
+        if (ptg instanceof Area3DPxg) {
            return ec.getArea3DEval((Area3DPxg)ptg);
-       }
-       if (ptg instanceof RefPtg) {
+        }
+        if (ptg instanceof RefPtg) {
            RefPtg rptg = (RefPtg) ptg;
            return ec.getRefEval(rptg.getRow(), rptg.getColumn());
-       }
-       if (ptg instanceof AreaPtg) {
+        }
+        if (ptg instanceof AreaPtg) {
            AreaPtg aptg = (AreaPtg) ptg;
            return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
-       }
+        }
 
-       if (ptg instanceof UnknownPtg) {
-           // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
-           // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
-           // In any case, formulas are re-parsed before execution, so UnknownPtg should not get here
-           throw new RuntimeException("UnknownPtg not allowed");
-       }
-       if (ptg instanceof ExpPtg) {
-           // ExpPtg is used for array formulas and shared formulas.
-           // it is currently unsupported, and may not even get implemented here
-           throw new RuntimeException("ExpPtg currently not supported");
-       }
+        if (ptg instanceof UnknownPtg) {
+            // POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
+            // This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
+            // In any case, formulas are re-parsed before execution, so UnknownPtg should not get here
+            throw new RuntimeException("UnknownPtg not allowed");
+        }
+        if (ptg instanceof ExpPtg) {
+            // ExpPtg is used for array formulas and shared formulas.
+            // it is currently unsupported, and may not even get implemented here
+            throw new RuntimeException("ExpPtg currently not supported");
+        }
 
-       throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")");
+        throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")");
     }
    
-   private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) {
-       if (eval instanceof ExternalNameEval) {
-           EvaluationName name = ((ExternalNameEval)eval).getName();
-           return getEvalForNameRecord(name, ec);
-       }
-       return eval;
-   }
+    private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) {
+        if (eval instanceof ExternalNameEval) {
+            EvaluationName name = ((ExternalNameEval)eval).getName();
+            return getEvalForNameRecord(name, ec);
+        }
+        return eval;
+    }
     
     private ValueEval getEvalForNameRecord(EvaluationName nameRecord, OperationEvaluationContext ec) {
         if (nameRecord.isFunctionName()) {
@@ -738,7 +738,8 @@ public final class WorkbookEvaluator {
     /**
      * Used by the lazy ref evals whenever they need to get the value of a contained cell.
      */
-    /* package */ ValueEval evaluateReference(EvaluationSheet sheet, int sheetIndex, int rowIndex,
+    /* package */ ValueEval evaluateReference(
+            EvaluationSheet sheet, int sheetIndex, int rowIndex,
             int columnIndex, EvaluationTracker tracker) {
 
         EvaluationCell cell = sheet.getCell(rowIndex, columnIndex);



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