poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r776505 [2/3] - in /poi/trunk/src: java/org/apache/poi/hssf/record/formula/eval/ java/org/apache/poi/hssf/record/formula/functions/ testcases/org/apache/poi/hssf/record/formula/functions/
Date Wed, 20 May 2009 00:14:25 GMT
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Index.java Wed May 20 00:14:19 2009
@@ -62,7 +62,6 @@
 
 			// else the other variation of this function takes an array as the first argument
 			// it seems like interface 'ArrayEval' does not even exist yet
-
 			throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
 					+ firstArg.getClass().getName() + ")");
 		}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java Wed May 20 00:14:19 2009
@@ -24,18 +24,18 @@
 
 /**
  * Implementation for Excel function INDIRECT<p/>
- * 
- * INDIRECT() returns the cell or area reference denoted by the text argument.<p/> 
- * 
+ *
+ * INDIRECT() returns the cell or area reference denoted by the text argument.<p/>
+ *
  * <b>Syntax</b>:</br>
  * <b>INDIRECT</b>(<b>ref_text</b>,isA1Style)<p/>
- * 
+ *
  * <b>ref_text</b> a string representation of the desired reference as it would normally be written
  * in a cell formula.<br/>
  * <b>isA1Style</b> (default TRUE) specifies whether the ref_text should be interpreted as A1-style
  * or R1C1-style.
- * 
- * 
+ *
+ *
  * @author Josh Micich
  */
 public final class Indirect implements FreeRefFunction {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
@@ -31,12 +28,12 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class IsError implements Function {
+public final class IsError implements Function {
 
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         ValueEval retval = null;
         boolean b = false;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -53,9 +50,9 @@
                 else if (ae.isRow()) {
                     if (ae.containsColumn(srcCellCol)) {
                         ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCellCol);
-                        if (ve instanceof RefEval) 
+                        if (ve instanceof RefEval)
                             b = ((RefEval) ve).getInnerValueEval() instanceof ErrorEval;
-                        else 
+                        else
                             b = (ve instanceof ErrorEval);
                     }
                     else {
@@ -65,9 +62,9 @@
                 else if (ae.isColumn()) {
                     if (ae.containsRow(srcCellRow)) {
                         ValueEval ve = ae.getValueAt(srcCellRow, ae.getFirstColumn());
-                        if (ve instanceof RefEval) 
+                        if (ve instanceof RefEval)
                             b = ((RefEval) ve).getInnerValueEval() instanceof ErrorEval;
-                        else 
+                        else
                             b = (ve instanceof ErrorEval);
                     }
                     else {
@@ -85,7 +82,7 @@
                 b = false;
             }
         }
-        
+
         if (retval == null) {
             retval = b
                     ? BoolEval.TRUE

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java Wed May 20 00:14:19 2009
@@ -1,19 +1,19 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hssf.record.formula.functions;
 
@@ -36,7 +36,7 @@
 			return ErrorEval.VALUE_INVALID;
 		}
 		Eval arg = args[0];
-		
+
 		ValueEval singleCellValue;
 		try {
 			singleCellValue = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java Wed May 20 00:14:19 2009
@@ -1,40 +1,36 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.RefEval;
-import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class Islogical extends LogicalFunction {
+public final class Islogical extends LogicalFunction {
 
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         Eval retval = BoolEval.FALSE;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -51,7 +47,7 @@
                 }
             }
         }
-        
+
         return retval;
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
@@ -30,10 +27,10 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class Isnontext extends LogicalFunction {
+public final class Isnontext extends LogicalFunction {
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         Eval retval = BoolEval.TRUE;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -50,7 +47,7 @@
                 }
             }
         }
-        
+
         return retval;
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
@@ -30,10 +27,10 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class Isnumber extends LogicalFunction {
+public final class Isnumber extends LogicalFunction {
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         Eval retval = BoolEval.FALSE;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -50,7 +47,7 @@
                 }
             }
         }
-        
+
         return retval;
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
@@ -30,10 +27,10 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class Isref implements Function {
+public final class Isref implements Function {
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         Eval retval = BoolEval.FALSE;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -44,7 +41,7 @@
                 retval = BoolEval.TRUE;
             }
         }
-        
+
         return retval;
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.BoolEval;
@@ -30,10 +27,10 @@
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
  *
  */
-public class Istext extends LogicalFunction {
+public final class Istext extends LogicalFunction {
     public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
         Eval retval = BoolEval.FALSE;
-        
+
         switch (operands.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -50,7 +47,7 @@
                 }
             }
         }
-        
+
         return retval;
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java Wed May 20 00:14:19 2009
@@ -1,25 +1,23 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on Nov 25, 2006
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
+import org.apache.poi.hssf.record.formula.eval.OperandResolver;
 import org.apache.poi.hssf.record.formula.eval.RefEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
@@ -31,11 +29,11 @@
 
     /**
      * recursively evaluate any RefEvals
-     * @param reval
+     * TODO - use {@link OperandResolver}
      */
     protected ValueEval xlateRefEval(RefEval reval) {
-        ValueEval retval = (ValueEval) reval.getInnerValueEval();
-        
+        ValueEval retval = reval.getInnerValueEval();
+
         if (retval instanceof RefEval) {
             RefEval re = (RefEval) retval;
             retval = xlateRefEval(re);

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java Wed May 20 00:14:19 2009
@@ -27,16 +27,16 @@
 
 /**
  * Implementation of Excel function LOOKUP.<p/>
- * 
+ *
  * LOOKUP finds an index  row in a lookup table by the first column value and returns the value from another column.
- * 
+ *
  * <b>Syntax</b>:<br/>
  * <b>VLOOKUP</b>(<b>lookup_value</b>, <b>lookup_vector</b>, result_vector)<p/>
- * 
+ *
  * <b>lookup_value</b>  The value to be found in the lookup vector.<br/>
  * <b>lookup_vector</> An area reference for the lookup data. <br/>
  * <b>result_vector</b> Single row or single column area reference from which the result value is chosen.<br/>
- * 
+ *
  * @author Josh Micich
  */
 public final class Lookup implements Function {
@@ -51,13 +51,13 @@
 			default:
 				return ErrorEval.VALUE_INVALID;
 		}
-		
-		
+
+
 		try {
 			ValueEval lookupValue = OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol);
 			AreaEval aeLookupVector = LookupUtils.resolveTableArrayArg(args[1]);
 			AreaEval aeResultVector = LookupUtils.resolveTableArrayArg(args[2]);
-			
+
 			ValueVector lookupVector = createVector(aeLookupVector);
 			ValueVector resultVector = createVector(aeResultVector);
 			if(lookupVector.getSize() > resultVector.getSize()) {
@@ -65,7 +65,7 @@
 				throw new RuntimeException("Lookup vector and result vector of differing sizes not supported yet");
 			}
 			int index = LookupUtils.lookupIndexOfValue(lookupValue, lookupVector, true);
-			
+
 			return resultVector.getItem(index);
 		} catch (EvaluationException e) {
 			return e.getErrorEval();

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java Wed May 20 00:14:19 2009
@@ -218,7 +218,7 @@
 
 	private static abstract class LookupValueComparerBase implements LookupValueComparer {
 
-		private final Class _targetClass;
+		private final Class<? extends ValueEval> _targetClass;
 		protected LookupValueComparerBase(ValueEval targetValue) {
 			if(targetValue == null) {
 				throw new RuntimeException("targetValue cannot be null");
@@ -232,9 +232,6 @@
 			if (_targetClass != other.getClass()) {
 				return CompareResult.TYPE_MISMATCH;
 			}
-			if (_targetClass == StringEval.class) {
-
-			}
 			return compareSameType(other);
 		}
 		public String toString() {
@@ -330,7 +327,7 @@
 		if(rowColIndexArg == null) {
 			throw new IllegalArgumentException("argument must not be null");
 		}
-		
+
 		ValueEval veRowColIndexArg;
 		try {
 			veRowColIndexArg = OperandResolver.getSingleValue(rowColIndexArg, srcCellRow, (short)srcCellCol);
@@ -353,7 +350,7 @@
 		// actual BoolEval values get interpreted as FALSE->0 and TRUE->1
 		oneBasedIndex = OperandResolver.coerceValueToInt(veRowColIndexArg);
 		if (oneBasedIndex < 1) {
-			// note this is asymmetric with the errors when the index is too large (#REF!)  
+			// note this is asymmetric with the errors when the index is too large (#REF!)
 			throw EvaluationException.invalidValue();
 		}
 		return oneBasedIndex - 1; // convert to zero based
@@ -599,7 +596,7 @@
 		if (lookupValue == BlankEval.INSTANCE) {
 			// blank eval translates to zero
 			// Note - a blank eval in the lookup column/row never matches anything
-			// empty string in the lookup column/row can only be matched by explicit emtpty string
+			// empty string in the lookup column/row can only be matched by explicit empty string
 			return new NumberLookupComparer(NumberEval.ZERO);
 		}
 		if (lookupValue instanceof StringEval) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Match.java Wed May 20 00:14:19 2009
@@ -1,19 +1,19 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hssf.record.formula.functions;
 
@@ -229,7 +229,7 @@
 		throw new EvaluationException(ErrorEval.NA);
 	}
 
-	private static LookupValueComparer createLookupComparer(ValueEval lookupValue, boolean matchExact) throws EvaluationException {
+	private static LookupValueComparer createLookupComparer(ValueEval lookupValue, boolean matchExact) {
 		if (matchExact && lookupValue instanceof StringEval) {
 			String stringValue = ((StringEval) lookupValue).getStringValue();
 			if(isLookupValueWild(stringValue)) {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java Wed May 20 00:14:19 2009
@@ -1,26 +1,21 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 19, 2005
- *
- */
-package org.apache.poi.hssf.record.formula.functions;
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
+       http://www.apache.org/licenses/LICENSE-2.0
 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record.formula.functions;
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
@@ -28,22 +23,23 @@
  * provided by java.lang.Math class. It follows the Math class
  * in that it has a private constructor and all static methods.
  */
-public final class MathX {
+final class MathX {
+
+    private MathX() {
+        // no instances of this class
+    }
+
 
-    
-    private MathX() {}
-    
-    
     /**
      * Returns a value rounded to p digits after decimal.
      * If p is negative, then the number is rounded to
-     * places to the left of the decimal point. eg. 
+     * places to the left of the decimal point. eg.
      * 10.23 rounded to -1 will give: 10. If p is zero,
      * the returned value is rounded to the nearest integral
      * value.
      * <p>If n is negative, the resulting value is obtained
      * as the round value of absolute value of n multiplied
-     * by the sign value of n (@see MathX.sign(double d)). 
+     * by the sign value of n (@see MathX.sign(double d)).
      * Thus, -0.6666666 rounded to p=0 will give -1 not 0.
      * <p>If n is NaN, returned value is NaN.
      * @param n
@@ -51,7 +47,7 @@
      */
     public static double round(double n, int p) {
         double retval;
-        
+
         if (Double.isNaN(n) || Double.isInfinite(n)) {
             retval = Double.NaN;
         }
@@ -64,20 +60,20 @@
                 retval = Math.round(n);
             }
         }
-        
+
         return retval;
     }
 
     /**
      * Returns a value rounded-up to p digits after decimal.
      * If p is negative, then the number is rounded to
-     * places to the left of the decimal point. eg. 
+     * places to the left of the decimal point. eg.
      * 10.23 rounded to -1 will give: 20. If p is zero,
      * the returned value is rounded to the nearest integral
      * value.
      * <p>If n is negative, the resulting value is obtained
      * as the round-up value of absolute value of n multiplied
-     * by the sign value of n (@see MathX.sign(double d)). 
+     * by the sign value of n (@see MathX.sign(double d)).
      * Thus, -0.2 rounded-up to p=0 will give -1 not 0.
      * <p>If n is NaN, returned value is NaN.
      * @param n
@@ -85,7 +81,7 @@
      */
     public static double roundUp(double n, int p) {
         double retval;
-        
+
         if (Double.isNaN(n) || Double.isInfinite(n)) {
             retval = Double.NaN;
         }
@@ -93,34 +89,34 @@
             if (p != 0) {
                 double temp = Math.pow(10, p);
                 double nat = Math.abs(n*temp);
-                
-                retval = sign(n) * 
+
+                retval = sign(n) *
                     ((nat == (long) nat)
                             ? nat / temp
                             : Math.round(nat + 0.5) / temp);
             }
             else {
                 double na = Math.abs(n);
-                retval = sign(n) * 
+                retval = sign(n) *
                     ((na == (long) na)
                         ? na
                         : (long) na + 1);
             }
         }
-        
+
         return retval;
     }
 
     /**
      * Returns a value rounded to p digits after decimal.
      * If p is negative, then the number is rounded to
-     * places to the left of the decimal point. eg. 
+     * places to the left of the decimal point. eg.
      * 10.23 rounded to -1 will give: 10. If p is zero,
      * the returned value is rounded to the nearest integral
      * value.
      * <p>If n is negative, the resulting value is obtained
      * as the round-up value of absolute value of n multiplied
-     * by the sign value of n (@see MathX.sign(double d)). 
+     * by the sign value of n (@see MathX.sign(double d)).
      * Thus, -0.8 rounded-down to p=0 will give 0 not -1.
      * <p>If n is NaN, returned value is NaN.
      * @param n
@@ -128,7 +124,7 @@
      */
     public static double roundDown(double n, int p) {
         double retval;
-        
+
         if (Double.isNaN(n) || Double.isInfinite(n)) {
             retval = Double.NaN;
         }
@@ -141,17 +137,17 @@
                 retval = (long) n;
             }
         }
-        
+
         return retval;
     }
-    
-    
+
+
     /**
      * If d < 0, returns short -1
      * <br/>
      * If d > 0, returns short 1
      * <br/>
-     * If d == 0, returns short 0 
+     * If d == 0, returns short 0
      * <p> If d is NaN, then 1 will be returned. It is the responsibility
      * of caller to check for d isNaN if some other value is desired.
      * @param d
@@ -163,7 +159,7 @@
                         ? -1
                         : 1);
     }
-   
+
     /**
      * average of all values
      * @param values
@@ -177,8 +173,8 @@
         ave = sum / values.length;
         return ave;
     }
-    
-    
+
+
     /**
      * sum of all values
      * @param values
@@ -190,7 +186,7 @@
         }
         return sum;
     }
-    
+
     /**
      * sum of squares of all values
      * @param values
@@ -202,8 +198,8 @@
         }
         return sumsq;
     }
-    
-    
+
+
     /**
      * product of all values
      * @param values
@@ -218,7 +214,7 @@
         }
         return product;
     }
-    
+
     /**
      * min of all values. If supplied array is zero length,
      * Double.POSITIVE_INFINITY is returned.
@@ -262,17 +258,17 @@
      */
     public static double floor(double n, double s) {
         double f;
-        
+
         if ((n<0 && s>0) || (n>0 && s<0) || (s==0 && n!=0)) {
             f = Double.NaN;
         }
         else {
             f = (n==0 || s==0) ? 0 : Math.floor(n/s) * s;
         }
-        
+
         return f;
     }
-    
+
     /**
      * Note: this function is different from java.lang.Math.ceil(..).
      * <p>
@@ -290,30 +286,30 @@
      */
     public static double ceiling(double n, double s) {
         double c;
-        
+
         if ((n<0 && s>0) || (n>0 && s<0)) {
             c = Double.NaN;
         }
         else {
             c = (n == 0 || s == 0) ? 0 : Math.ceil(n/s) * s;
         }
-        
+
         return c;
     }
-    
+
     /**
-     * <br/> for all n >= 1; factorial n = n * (n-1) * (n-2) * ... * 1 
+     * <br/> for all n >= 1; factorial n = n * (n-1) * (n-2) * ... * 1
      * <br/> else if n == 0; factorial n = 1
      * <br/> else if n < 0; factorial n = Double.NaN
      * <br/> Loss of precision can occur if n is large enough.
-     * If n is large so that the resulting value would be greater 
+     * If n is large so that the resulting value would be greater
      * than Double.MAX_VALUE; Double.POSITIVE_INFINITY is returned.
-     * If n < 0, Double.NaN is returned. 
+     * If n < 0, Double.NaN is returned.
      * @param n
      */
     public static double factorial(int n) {
         double d = 1;
-        
+
         if (n >= 0) {
             if (n <= 170) {
                 for (int i=1; i<=n; i++) {
@@ -329,11 +325,11 @@
         }
         return d;
     }
-    
+
 
     /**
      * returns the remainder resulting from operation:
-     * n / d. 
+     * n / d.
      * <br/> The result has the sign of the divisor.
      * <br/> Examples:
      * <ul>
@@ -348,7 +344,7 @@
      */
     public static double mod(double n, double d) {
         double result = 0;
-        
+
         if (d == 0) {
             result = Double.NaN;
         }
@@ -363,11 +359,11 @@
             t = Math.ceil(t) - t;
             result = sign(d) * Math.abs(t * d);
         }
-        
+
         return result;
     }
-    
-    
+
+
     /**
      * inverse hyperbolic cosine
      * @param d
@@ -375,16 +371,15 @@
     public static double acosh(double d) {
         return Math.log(Math.sqrt(Math.pow(d, 2) - 1) + d);
     }
-    
+
     /**
      * inverse hyperbolic sine
      * @param d
      */
     public static double asinh(double d) {
-        double d2 = d*d;
         return Math.log(Math.sqrt(d*d + 1) + d);
     }
-    
+
     /**
      * inverse hyperbolic tangent
      * @param d
@@ -392,7 +387,7 @@
     public static double atanh(double d) {
         return Math.log((1 + d)/(1 - d)) / 2;
     }
-    
+
     /**
      * hyperbolic cosine
      * @param d
@@ -400,10 +395,9 @@
     public static double cosh(double d) {
         double ePowX = Math.pow(Math.E, d);
         double ePowNegX = Math.pow(Math.E, -d);
-        d = (ePowX + ePowNegX) / 2;
-        return d;
+        return (ePowX + ePowNegX) / 2;
     }
-    
+
     /**
      * hyperbolic sine
      * @param d
@@ -411,10 +405,9 @@
     public static double sinh(double d) {
         double ePowX = Math.pow(Math.E, d);
         double ePowNegX = Math.pow(Math.E, -d);
-        d = (ePowX - ePowNegX) / 2;
-        return d;
+        return (ePowX - ePowNegX) / 2;
     }
-    
+
     /**
      * hyperbolic tangent
      * @param d
@@ -422,40 +415,10 @@
     public static double tanh(double d) {
         double ePowX = Math.pow(Math.E, d);
         double ePowNegX = Math.pow(Math.E, -d);
-        d = (ePowX - ePowNegX) / (ePowX + ePowNegX);
-        return d;
+        return (ePowX - ePowNegX) / (ePowX + ePowNegX);
     }
-    
-    /**
-     * returns the sum of product of corresponding double value in each
-     * subarray. It is the responsibility of the caller to ensure that
-     * all the subarrays are of equal length. If the subarrays are
-     * not of equal length, the return value can be unpredictable.
-     * @param arrays
-     */
-    public static double sumproduct(double[][] arrays) {
-        double d = 0;
-        
-        try {
-            int narr = arrays.length;
-            int arrlen = arrays[0].length; 
-            
-            for (int j=0; j<arrlen; j++) {
-                double t = 1;
-                for (int i=0; i<narr; i++) {
-                    t *= arrays[i][j];
-                }
-                d += t;
-            }            
-        }
-        catch (ArrayIndexOutOfBoundsException ae) {
-            d = Double.NaN;
-        }
-        
-        return d;
-    }
-    
-    
+
+
     /**
      * returns the total number of combinations possible when
      * k items are chosen out of total of n items. If the number
@@ -479,8 +442,8 @@
             }
             d /= factorial(minnk);
         }
-        
+
         return d;
     }
-    
+
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MinaMaxa.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MinaMaxa.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MinaMaxa.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MinaMaxa.java Wed May 20 00:14:19 2009
@@ -19,7 +19,7 @@
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- * 
+ *
  */
 public abstract class MinaMaxa extends MultiOperandNumericFunction {
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Mode.java Wed May 20 00:14:19 2009
@@ -34,15 +34,15 @@
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- * 
+ *
  */
-public class Mode implements Function {
+public final class Mode implements Function {
 
 	/**
 	 * if v is zero length or contains no duplicates, return value is
 	 * Double.NaN. Else returns the value that occurs most times and if there is
 	 * a tie, returns the first such value.
-	 * 
+	 *
 	 * @param v
 	 */
 	public static double evaluate(double[] v) throws EvaluationException {
@@ -77,13 +77,13 @@
 	public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
 		double result;
 		try {
-			List temp = new ArrayList();
+			List<Double> temp = new ArrayList<Double>();
 			for (int i = 0; i < args.length; i++) {
 				collectValues(args[i], temp);
 			}
 			double[] values = new double[temp.size()];
 			for (int i = 0; i < values.length; i++) {
-				values[i] = ((Double) temp.get(i)).doubleValue();
+				values[i] = temp.get(i).doubleValue();
 			}
 			result = evaluate(values);
 		} catch (EvaluationException e) {
@@ -92,7 +92,7 @@
 		return new NumberEval(result);
 	}
 
-	private static void collectValues(Eval arg, List temp) throws EvaluationException {
+	private static void collectValues(Eval arg, List<Double> temp) throws EvaluationException {
 		if (arg instanceof AreaEval) {
 			AreaEval ae = (AreaEval) arg;
 			int width = ae.getWidth();
@@ -114,7 +114,7 @@
 
 	}
 
-	private static void collectValue(Eval arg, List temp, boolean mustBeNumber)
+	private static void collectValue(Eval arg, List<Double> temp, boolean mustBeNumber)
 			throws EvaluationException {
 		if (arg instanceof ErrorEval) {
 			throw new EvaluationException((ErrorEval) arg);

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java Wed May 20 00:14:19 2009
@@ -45,7 +45,6 @@
 		_isBlankCounted = isBlankCounted;
 	}
 
-
 	static final double[] EMPTY_DOUBLE_ARRAY = { };
 
 	private static class DoubleList {
@@ -102,7 +101,6 @@
 
 	protected abstract double evaluate(double[] values) throws EvaluationException;
 
-
 	/**
 	 * Maximum number of operands accepted by this function.
 	 * Subclasses may override to change default value.

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Na.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Na.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Na.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Na.java Wed May 20 00:14:19 2009
@@ -1,20 +1,19 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hssf.record.formula.functions;
 
@@ -23,7 +22,7 @@
 
 /**
  * Implementation of Excel function NA()
- * 
+ *
  * @author Josh Micich
  */
 public final class Na implements Function {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Not.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Not.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Not.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Not.java Wed May 20 00:14:19 2009
@@ -45,7 +45,7 @@
 		} catch (EvaluationException e) {
 			return e.getErrorEval();
 		}
-		
+
 		return BoolEval.valueOf(!boolArgVal);
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java Wed May 20 00:14:19 2009
@@ -21,15 +21,15 @@
 import org.apache.poi.ss.formula.eval.NotImplementedException;
 
 /**
- * 
+ *
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- * This is the default implementation of a Function class. 
- * The default behaviour is to raise a POI internal error 
- * ({@link NotImplementedException}). This error should alert 
+ * This is the default implementation of a Function class.
+ * The default behaviour is to raise a POI internal error
+ * ({@link NotImplementedException}). This error should alert
  * the user that the formula contained a function that is not
  * yet implemented.
  */
-public class NotImplementedFunction implements Function {
+public final class NotImplementedFunction implements Function {
 	private final String _functionName;
 	protected NotImplementedFunction() {
 		_functionName = getClass().getName();
@@ -37,8 +37,11 @@
 	public NotImplementedFunction(String name) {
 		_functionName = name;
 	}
-	
+
 	public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
 		throw new NotImplementedException(_functionName);
 	}
+	public String getFunctionName() {
+		return _functionName;
+	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Now.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Now.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Now.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Now.java Wed May 20 00:14:19 2009
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
+import java.util.Date;
+
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
 import org.apache.poi.hssf.record.formula.eval.Eval;
 import org.apache.poi.hssf.record.formula.eval.NumberEval;
@@ -34,7 +36,7 @@
 			return ErrorEval.VALUE_INVALID;
 		}
 
-		java.util.Date now = new java.util.Date(System.currentTimeMillis());
+		Date now = new Date(System.currentTimeMillis());
 		return new NumberEval(HSSFDateUtil.getExcelDate(now));
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java Wed May 20 00:14:19 2009
@@ -60,8 +60,7 @@
 	protected abstract double eval(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
 
 	/* -------------------------------------------------------------------------- */
-	// intermediate sub-classes (one-arg, two-arg and multi-arg
-
+	// intermediate sub-classes (one-arg, two-arg and multi-arg)
 
 	public static abstract class OneArg extends NumericFunction {
 		protected OneArg() {
@@ -115,7 +114,6 @@
 
 	/* -------------------------------------------------------------------------- */
 
-
 	public static final Function ABS = new OneArg() {
 		protected double evaluate(double d) {
 			return Math.abs(d);
@@ -233,7 +231,6 @@
 		}
 	};
 
-
 	/* -------------------------------------------------------------------------- */
 
 	public static final Function ATAN2 = new TwoArg() {

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java Wed May 20 00:14:19 2009
@@ -17,26 +17,22 @@
 
 package org.apache.poi.hssf.record.formula.functions;
 
-
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- *  
+ *
  */
 public final class Odd extends NumericFunction.OneArg {
 	private static final long PARITY_MASK = 0xFFFFFFFFFFFFFFFEL;
-    
+
 	protected double evaluate(double d) {
 		if (d==0) {
 			return 1;
 		}
-		long result;
 		if (d>0) {
-			result = calcOdd(d);
-		} else {
-			result = -calcOdd(-d);
+			return calcOdd(d);
 		}
-		return result;
-    }
+		return -calcOdd(-d);
+	}
 
 	private static long calcOdd(double d) {
 		double dpm1 = d+1;

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java Wed May 20 00:14:19 2009
@@ -29,10 +29,10 @@
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 /**
  * Implementation for Excel function OFFSET()<p/>
- * 
- * OFFSET returns an area reference that is a specified number of rows and columns from a 
+ *
+ * OFFSET returns an area reference that is a specified number of rows and columns from a
  * reference cell or area.<p/>
- * 
+ *
  * <b>Syntax</b>:<br/>
  * <b>OFFSET</b>(<b>reference</b>, <b>rows</b>, <b>cols</b>, height, width)<p/>
  * <b>reference</b> is the base reference.<br/>
@@ -40,16 +40,16 @@
  * <b>cols</b> is the number of columns left or right from the base reference.<br/>
  * <b>height</b> (default same height as base reference) is the row count for the returned area reference.<br/>
  * <b>width</b> (default same width as base reference) is the column count for the returned area reference.<br/>
- * 
+ *
  * @author Josh Micich
  */
 public final class Offset implements Function {
 	// These values are specific to BIFF8
 	private static final int LAST_VALID_ROW_INDEX = 0xFFFF;
 	private static final int LAST_VALID_COLUMN_INDEX = 0xFF;
-	
 
-	/** 
+
+	/**
 	 * A one dimensional base + offset.  Represents either a row range or a column range.
 	 * Two instances of this class together specify an area range.
 	 */
@@ -66,7 +66,7 @@
 			_offset = offset;
 			_length = length;
 		}
-		
+
 		public short getFirstIndex() {
 			return (short) _offset;
 		}
@@ -75,13 +75,13 @@
 		}
 		/**
 		 * Moves the range by the specified translation amount.<p/>
-		 * 
-		 * This method also 'normalises' the range: Excel specifies that the width and height 
+		 *
+		 * This method also 'normalises' the range: Excel specifies that the width and height
 		 * parameters (length field here) cannot be negative.  However, OFFSET() does produce
 		 * sensible results in these cases.  That behavior is replicated here. <p/>
-		 * 
+		 *
 		 * @param translationAmount may be zero negative or positive
-		 * 
+		 *
 		 * @return the equivalent <tt>LinearOffsetRange</tt> with a positive length, moved by the
 		 * specified translationAmount.
 		 */
@@ -123,7 +123,7 @@
 		private final int _height;
 		private final RefEval _refEval;
 		private final AreaEval _areaEval;
-		
+
 		public BaseRef(RefEval re) {
 			_refEval = re;
 			_areaEval = null;
@@ -155,7 +155,7 @@
 			return _firstColumnIndex;
 		}
 
-		public AreaEval offset(int relFirstRowIx, int relLastRowIx, 
+		public AreaEval offset(int relFirstRowIx, int relLastRowIx,
 				int relFirstColIx, int relLastColIx) {
 			if (_refEval == null) {
 				return _areaEval.offset(relFirstRowIx, relLastRowIx, relFirstColIx, relLastColIx);
@@ -163,12 +163,12 @@
 			return _refEval.offset(relFirstRowIx, relLastRowIx, relFirstColIx, relLastColIx);
 		}
 	}
-	
+
 	public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
 		if(args.length < 3 || args.length > 5) {
 			return ErrorEval.VALUE_INVALID;
 		}
-		
+
 		try {
 			BaseRef baseRef = evaluateBaseRef(args[0]);
 			int rowOffset = evaluateIntArg(args[1], srcCellRow, srcCellCol);
@@ -193,11 +193,11 @@
 		}
 	}
 
-	private static AreaEval createOffset(BaseRef baseRef, 
+	private static AreaEval createOffset(BaseRef baseRef,
 			LinearOffsetRange orRow, LinearOffsetRange orCol) throws EvaluationException {
 		LinearOffsetRange absRows = orRow.normaliseAndTranslate(baseRef.getFirstRowIndex());
 		LinearOffsetRange absCols = orCol.normaliseAndTranslate(baseRef.getFirstColumnIndex());
-		
+
 		if(absRows.isOutOfBounds(0, LAST_VALID_ROW_INDEX)) {
 			throw new EvaluationException(ErrorEval.REF_INVALID);
 		}
@@ -208,7 +208,7 @@
 	}
 
 	private static BaseRef evaluateBaseRef(Eval eval) throws EvaluationException {
-		
+
 		if(eval instanceof RefEval) {
 			return new BaseRef((RefEval)eval);
 		}
@@ -239,10 +239,10 @@
 		// but Math.floor() truncates toward negative infinity
 		return (int)Math.floor(d);
 	}
-	
+
 	private static double evaluateDoubleArg(Eval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
 		ValueEval ve = OperandResolver.getSingleValue(eval, srcCellRow, srcCellCol);
-		
+
 		if (ve instanceof NumericValueEval) {
 			return ((NumericValueEval) ve).getNumberValue();
 		}

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Or.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Or.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Or.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Or.java Wed May 20 00:14:19 2009
@@ -18,7 +18,7 @@
 package org.apache.poi.hssf.record.formula.functions;
 
 /**
- * 
+ *
  */
 public final class Or extends BooleanFunction {
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 6, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
@@ -27,9 +24,9 @@
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- *  
+ *
  */
-public class Pi implements Function {
+public final class Pi implements Function {
 
     private static final NumberEval PI_EVAL = new NumberEval(Math.PI);
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 6, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.ErrorEval;
@@ -27,9 +24,9 @@
 
 /**
  * @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
- *  
+ *
  */
-public class Rand implements Function {
+public final class Rand implements Function {
 
     public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
         ValueEval retval;

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java Wed May 20 00:14:19 2009
@@ -24,7 +24,7 @@
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
 /**
- * An implementation of the Excel REPLACE() function<p/>:
+ * An implementation of the Excel REPLACE() function:<p/>
  * Replaces part of a text string based on the number of characters
  * you specify, with another text string.<br/>
  *

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Row.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Row.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Row.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Row.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import org.apache.poi.hssf.record.formula.eval.AreaEval;
@@ -27,12 +24,12 @@
 import org.apache.poi.hssf.record.formula.eval.RefEval;
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
-public class Row implements Function {
+public final class Row implements Function {
 
     public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) {
         ValueEval retval = null;
         int rnum = -1;
-        
+
         switch (evals.length) {
         default:
             retval = ErrorEval.VALUE_INVALID;
@@ -52,14 +49,14 @@
         case 0:
             rnum = srcCellRow;
         }
-        
+
         if (retval == null) {
             retval = (rnum >= 0)
                     ? new NumberEval(rnum + 1) // +1 since excel rownums are 1 based
                     : (ValueEval) ErrorEval.VALUE_INVALID;
         }
-        
+
         return retval;
     }
-    
+
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java Wed May 20 00:14:19 2009
@@ -1,20 +1,19 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
 
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hssf.record.formula.functions;
 
@@ -26,7 +25,7 @@
 
 /**
  * Implementation for Excel ROWS function.
- * 
+ *
  * @author Josh Micich
  */
 public final class Rows implements Function {
@@ -44,16 +43,16 @@
 				return ErrorEval.VALUE_INVALID;
 		}
 		Eval firstArg = args[0];
-		
+
 		int result;
-        if (firstArg instanceof AreaEval) {
-            AreaEval ae = (AreaEval) firstArg;
-            result = ae.getLastRow() - ae.getFirstRow() + 1;
-        } else if (firstArg instanceof RefEval) {
-            result = 1;
-        } else { // anything else is not valid argument
-            return ErrorEval.VALUE_INVALID;
-        }
-        return new NumberEval(result);
+		if (firstArg instanceof AreaEval) {
+			AreaEval ae = (AreaEval) firstArg;
+			result = ae.getLastRow() - ae.getFirstRow() + 1;
+		} else if (firstArg instanceof RefEval) {
+			result = 1;
+		} else { // anything else is not valid argument
+			return ErrorEval.VALUE_INVALID;
+		}
+		return new NumberEval(result);
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * Created on May 30, 2005
- *
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.functions;
 
 import java.util.Arrays;
@@ -27,9 +24,11 @@
  *
  * Library for common statistics functions
  */
-public final class StatsLib {
+final class StatsLib {
 
-    private StatsLib() {}
+    private StatsLib() {
+        // no instances of this class
+    }
 
 
     /**
@@ -51,7 +50,7 @@
         r = s / v.length;
         return r;
     }
-    
+
     public static double stdev(double[] v) {
         double r = Double.NaN;
         if (v!=null && v.length > 1) {
@@ -59,11 +58,11 @@
         }
         return r;
     }
-    
-    
+
+
     public static double median(double[] v) {
         double r = Double.NaN;
-        
+
         if (v!=null && v.length >= 1) {
             int n = v.length;
             Arrays.sort(v);
@@ -71,11 +70,11 @@
                 ? (v[n / 2] + v[n / 2 - 1]) / 2
                 : v[n / 2];
         }
-        
+
         return r;
     }
-    
-    
+
+
     public static double devsq(double[] v) {
         double r = Double.NaN;
         if (v!=null && v.length >= 1) {
@@ -90,14 +89,14 @@
             for (int i=0; i<n; i++) {
                 s += (v[i]- m) * (v[i] - m);
             }
-            
+
             r = (n == 1)
                     ? 0
                     : s;
         }
         return r;
     }
-    
+
     /**
      * returns the kth largest element in the array. Duplicates
      * are considered as distinct values. Hence, eg.
@@ -105,15 +104,13 @@
      * <br/>
      * k <= 0 & k >= v.length and null or empty arrays
      * will result in return value Double.NaN
-     * @param v
-     * @param k
      */
     public static double kthLargest(double[] v, int k) {
         double r = Double.NaN;
-        k--; // since arrays are 0-based
-        if (v!=null && v.length > k && k >= 0) {
+        int index = k-1; // since arrays are 0-based
+        if (v!=null && v.length > index && index >= 0) {
             Arrays.sort(v);
-            r = v[v.length-k-1];
+            r = v[v.length-index-1];
         }
         return r;
     }
@@ -130,10 +127,10 @@
      */
     public static double kthSmallest(double[] v, int k) {
         double r = Double.NaN;
-        k--; // since arrays are 0-based
-        if (v!=null && v.length > k && k >= 0) {
+        int index = k-1; // since arrays are 0-based
+        if (v!=null && v.length > index && index >= 0) {
             Arrays.sort(v);
-            r = v[k];
+            r = v[index];
         }
         return r;
     }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java Wed May 20 00:14:19 2009
@@ -24,7 +24,7 @@
 import org.apache.poi.hssf.record.formula.eval.ValueEval;
 
 /**
- * An implementation of the SUBSTITUTE function:
+ * An implementation of the SUBSTITUTE function:<P/>
  * Substitutes text in a text string with new text, some number of times.
  * @author Manda Wilson &lt; wilson at c bio dot msk cc dot org &gt;
  */

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java Wed May 20 00:14:19 2009
@@ -28,7 +28,7 @@
 
 /**
  * Implementation for the Excel function SUMIF<p>
- * 
+ *
  * Syntax : <br/>
  *  SUMIF ( <b>range</b>, <b>criteria</b>, sum_range ) <br/>
  *    <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions">
@@ -45,12 +45,12 @@
 		if (args.length < 2) {
 			return ErrorEval.VALUE_INVALID;
 		}
-		
+
 		AreaEval aeRange;
 		AreaEval aeSum;
 		try {
 			aeRange = convertRangeArg(args[0]);
-			
+
 			switch (args.length) {
 				case 2:
 					aeSum = aeRange;
@@ -72,7 +72,7 @@
 	private static double sumMatchingCells(AreaEval aeRange, I_MatchPredicate mp, AreaEval aeSum) {
 		int height=aeRange.getHeight();
 		int width= aeRange.getWidth();
-		
+
 		double result = 0.0;
 		for (int r=0; r<height; r++) {
 			for (int c=0; c<width; c++) {
@@ -84,7 +84,7 @@
 
 	private static double accumulate(AreaEval aeRange, I_MatchPredicate mp, AreaEval aeSum, int relRowIndex,
 			int relColIndex) {
-		
+
 		if (!mp.matches(aeRange.getRelativeValue(relRowIndex, relColIndex))) {
 			return 0.0;
 		}



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


Mime
View raw message