From cbd9971b86a9ff06cde49b26e2a2ffa9127f2be7 Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Wed, 20 May 2009 00:14:19 +0000 Subject: [PATCH] Changed CRLF to LF in function implementations. Removed subclasses of NotImplementedFunction. Minor fixes for compiler warnings, and formatting. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776505 13f79535-47bb-0310-9956-ffa450edef68 --- .../record/formula/eval/FunctionEval.java | 617 ++++++------------ .../hssf/record/formula/functions/Absref.java | 25 - .../record/formula/functions/Activecell.java | 25 - .../record/formula/functions/Address.java | 25 - .../formula/functions/AggregateFunction.java | 2 - .../hssf/record/formula/functions/And.java | 2 +- .../hssf/record/formula/functions/Areas.java | 25 - .../record/formula/functions/Argument.java | 25 - .../hssf/record/formula/functions/Asc.java | 25 - .../record/formula/functions/Averagea.java | 29 - .../record/formula/functions/Betadist.java | 25 - .../record/formula/functions/Betainv.java | 25 - .../record/formula/functions/Binomdist.java | 25 - .../formula/functions/BooleanFunction.java | 16 +- .../functions/CalendarFieldFunction.java | 10 +- .../hssf/record/formula/functions/Call.java | 25 - .../hssf/record/formula/functions/Caller.java | 25 - .../hssf/record/formula/functions/Cell.java | 25 - .../hssf/record/formula/functions/Char.java | 25 - .../record/formula/functions/Chidist.java | 25 - .../hssf/record/formula/functions/Chiinv.java | 25 - .../record/formula/functions/Chitest.java | 25 - .../hssf/record/formula/functions/Choose.java | 2 +- .../hssf/record/formula/functions/Clean.java | 25 - .../hssf/record/formula/functions/Code.java | 25 - .../hssf/record/formula/functions/Column.java | 47 +- .../record/formula/functions/Columns.java | 53 +- .../record/formula/functions/Confidence.java | 25 - .../hssf/record/formula/functions/Correl.java | 25 - .../hssf/record/formula/functions/Count.java | 12 +- .../record/formula/functions/CountUtils.java | 4 +- .../hssf/record/formula/functions/Counta.java | 10 +- .../record/formula/functions/Countblank.java | 25 - .../record/formula/functions/Countif.java | 22 +- .../hssf/record/formula/functions/Covar.java | 25 - .../record/formula/functions/Critbinom.java | 25 - .../formula/functions/Customrepeat.java | 25 - .../record/formula/functions/DateFunc.java | 77 ++- .../record/formula/functions/Datedif.java | 25 - .../record/formula/functions/Datestring.java | 25 - .../record/formula/functions/Datevalue.java | 25 - .../record/formula/functions/Daverage.java | 25 - .../record/formula/functions/Days360.java | 25 - .../poi/hssf/record/formula/functions/Db.java | 25 - .../hssf/record/formula/functions/Dbcs.java | 25 - .../hssf/record/formula/functions/Dcount.java | 25 - .../record/formula/functions/Dcounta.java | 25 - .../hssf/record/formula/functions/Ddb.java | 25 - .../hssf/record/formula/functions/Deref.java | 25 - .../hssf/record/formula/functions/Dget.java | 25 - .../hssf/record/formula/functions/Dmax.java | 25 - .../hssf/record/formula/functions/Dmin.java | 25 - .../record/formula/functions/Dproduct.java | 25 - .../hssf/record/formula/functions/Dstdev.java | 25 - .../record/formula/functions/Dstdevp.java | 25 - .../hssf/record/formula/functions/Dsum.java | 25 - .../hssf/record/formula/functions/Dvar.java | 25 - .../hssf/record/formula/functions/Dvarp.java | 25 - .../hssf/record/formula/functions/Echo.java | 25 - .../hssf/record/formula/functions/Error.java | 25 - .../record/formula/functions/Errortype.java | 8 +- .../record/formula/functions/Evaluate.java | 25 - .../hssf/record/formula/functions/Even.java | 2 +- .../hssf/record/formula/functions/Exec.java | 25 - .../record/formula/functions/Expondist.java | 25 - .../hssf/record/formula/functions/False.java | 41 +- .../hssf/record/formula/functions/Fdist.java | 25 - .../hssf/record/formula/functions/Files.java | 25 - .../formula/functions/FinanceFunction.java | 2 +- .../record/formula/functions/FinanceLib.java | 93 ++- .../hssf/record/formula/functions/Find.java | 4 +- .../hssf/record/formula/functions/Findb.java | 25 - .../hssf/record/formula/functions/Finv.java | 25 - .../hssf/record/formula/functions/Fisher.java | 25 - .../record/formula/functions/Fisherinv.java | 25 - .../hssf/record/formula/functions/Fixed.java | 25 - .../record/formula/functions/Forecast.java | 25 - .../formula/functions/Formulaconvert.java | 25 - .../hssf/record/formula/functions/Fpos.java | 25 - .../formula/functions/FreeRefFunction.java | 22 +- .../record/formula/functions/Frequency.java | 25 - .../hssf/record/formula/functions/Ftest.java | 25 - .../record/formula/functions/Function.java | 12 +- .../record/formula/functions/Gammadist.java | 25 - .../record/formula/functions/Gammainv.java | 25 - .../record/formula/functions/Gammaln.java | 25 - .../record/formula/functions/Geomean.java | 25 - .../hssf/record/formula/functions/Goto.java | 25 - .../hssf/record/formula/functions/Group.java | 25 - .../hssf/record/formula/functions/Growth.java | 25 - .../hssf/record/formula/functions/Halt.java | 25 - .../record/formula/functions/Harmean.java | 25 - .../hssf/record/formula/functions/Help.java | 25 - .../record/formula/functions/Hlookup.java | 18 +- .../hssf/record/formula/functions/Hour.java | 25 - .../record/formula/functions/Hyperlink.java | 12 +- .../record/formula/functions/Hypgeomdist.java | 25 - .../poi/hssf/record/formula/functions/If.java | 2 +- .../hssf/record/formula/functions/Index.java | 1 - .../record/formula/functions/Indirect.java | 12 +- .../hssf/record/formula/functions/Info.java | 25 - .../record/formula/functions/Initiate.java | 25 - .../hssf/record/formula/functions/Input.java | 25 - .../record/formula/functions/Intercept.java | 25 - .../hssf/record/formula/functions/Ipmt.java | 25 - .../hssf/record/formula/functions/Irr.java | 25 - .../record/formula/functions/IsError.java | 51 +- .../hssf/record/formula/functions/IsNa.java | 25 - .../record/formula/functions/Isblank.java | 34 +- .../hssf/record/formula/functions/Iserr.java | 25 - .../record/formula/functions/Islogical.java | 44 +- .../record/formula/functions/Isnontext.java | 43 +- .../record/formula/functions/Isnumber.java | 43 +- .../hssf/record/formula/functions/Ispmt.java | 25 - .../hssf/record/formula/functions/Isref.java | 43 +- .../hssf/record/formula/functions/Istext.java | 43 +- .../hssf/record/formula/functions/Kurt.java | 25 - .../record/formula/functions/Lasterror.java | 25 - .../hssf/record/formula/functions/Leftb.java | 25 - .../hssf/record/formula/functions/Lenb.java | 25 - .../hssf/record/formula/functions/Linest.java | 25 - .../hssf/record/formula/functions/Links.java | 25 - .../hssf/record/formula/functions/Logest.java | 25 - .../formula/functions/LogicalFunction.java | 44 +- .../hssf/record/formula/functions/Loginv.java | 25 - .../record/formula/functions/Lognormdist.java | 25 - .../hssf/record/formula/functions/Lookup.java | 16 +- .../record/formula/functions/LookupUtils.java | 11 +- .../hssf/record/formula/functions/Match.java | 34 +- .../hssf/record/formula/functions/MathX.java | 187 +++--- .../record/formula/functions/Mdeterm.java | 25 - .../hssf/record/formula/functions/Midb.java | 25 - .../record/formula/functions/MinaMaxa.java | 2 +- .../hssf/record/formula/functions/Minute.java | 25 - .../record/formula/functions/Minverse.java | 25 - .../hssf/record/formula/functions/Mirr.java | 25 - .../hssf/record/formula/functions/Mmult.java | 25 - .../hssf/record/formula/functions/Mode.java | 14 +- .../MultiOperandNumericFunction.java | 2 - .../poi/hssf/record/formula/functions/N.java | 25 - .../poi/hssf/record/formula/functions/Na.java | 33 +- .../hssf/record/formula/functions/Names.java | 25 - .../formula/functions/Negbinomdist.java | 25 - .../record/formula/functions/Normdist.java | 25 - .../record/formula/functions/Norminv.java | 25 - .../record/formula/functions/Normsdist.java | 25 - .../record/formula/functions/Normsinv.java | 25 - .../hssf/record/formula/functions/Not.java | 2 +- .../functions/NotImplementedFunction.java | 15 +- .../hssf/record/formula/functions/Note.java | 25 - .../hssf/record/formula/functions/Now.java | 4 +- .../hssf/record/formula/functions/Npv.java | 25 - .../formula/functions/Numberstring.java | 25 - .../formula/functions/NumericFunction.java | 5 +- .../hssf/record/formula/functions/Odd.java | 14 +- .../hssf/record/formula/functions/Offset.java | 40 +- .../poi/hssf/record/formula/functions/Or.java | 2 +- .../record/formula/functions/Pearson.java | 25 - .../record/formula/functions/Percentile.java | 25 - .../record/formula/functions/Percentrank.java | 25 - .../hssf/record/formula/functions/Permut.java | 25 - .../poi/hssf/record/formula/functions/Pi.java | 41 +- .../record/formula/functions/Poisson.java | 25 - .../hssf/record/formula/functions/Ppmt.java | 25 - .../hssf/record/formula/functions/Prob.java | 25 - .../hssf/record/formula/functions/Proper.java | 25 - .../record/formula/functions/Quartile.java | 25 - .../hssf/record/formula/functions/Rand.java | 41 +- .../hssf/record/formula/functions/Rank.java | 25 - .../hssf/record/formula/functions/Rate.java | 25 - .../record/formula/functions/Reftext.java | 25 - .../hssf/record/formula/functions/Relref.java | 25 - .../record/formula/functions/Replace.java | 2 +- .../record/formula/functions/Replaceb.java | 25 - .../hssf/record/formula/functions/Rept.java | 25 - .../record/formula/functions/Request.java | 25 - .../hssf/record/formula/functions/Result.java | 25 - .../hssf/record/formula/functions/Rightb.java | 25 - .../hssf/record/formula/functions/Roman.java | 25 - .../hssf/record/formula/functions/Row.java | 47 +- .../hssf/record/formula/functions/Rows.java | 53 +- .../hssf/record/formula/functions/Rsq.java | 25 - .../hssf/record/formula/functions/Search.java | 25 - .../record/formula/functions/Searchb.java | 25 - .../hssf/record/formula/functions/Second.java | 25 - .../hssf/record/formula/functions/Series.java | 25 - .../record/formula/functions/Setname.java | 25 - .../record/formula/functions/Setvalue.java | 25 - .../hssf/record/formula/functions/Skew.java | 25 - .../hssf/record/formula/functions/Sln.java | 25 - .../hssf/record/formula/functions/Slope.java | 25 - .../record/formula/functions/Standardize.java | 25 - .../record/formula/functions/StatsLib.java | 75 +-- .../hssf/record/formula/functions/Stdeva.java | 25 - .../hssf/record/formula/functions/Stdevp.java | 25 - .../record/formula/functions/Stdevpa.java | 25 - .../hssf/record/formula/functions/Step.java | 25 - .../hssf/record/formula/functions/Steyx.java | 25 - .../record/formula/functions/Substitute.java | 2 +- .../record/formula/functions/Subtotal.java | 25 - .../hssf/record/formula/functions/Sumif.java | 10 +- .../record/formula/functions/Sumproduct.java | 83 ++- .../record/formula/functions/Sumx2my2.java | 8 +- .../record/formula/functions/Sumx2py2.java | 8 +- .../record/formula/functions/Sumxmy2.java | 8 +- .../hssf/record/formula/functions/Syd.java | 25 - .../poi/hssf/record/formula/functions/T.java | 41 +- .../hssf/record/formula/functions/Tdist.java | 25 - .../hssf/record/formula/functions/Text.java | 25 - .../formula/functions/TextFunction.java | 6 +- .../record/formula/functions/Textref.java | 25 - .../hssf/record/formula/functions/Time.java | 2 +- .../record/formula/functions/Timevalue.java | 25 - .../hssf/record/formula/functions/Tinv.java | 25 - .../hssf/record/formula/functions/Today.java | 4 +- .../record/formula/functions/Transpose.java | 25 - .../hssf/record/formula/functions/Trend.java | 25 - .../record/formula/functions/Trimmean.java | 25 - .../hssf/record/formula/functions/True.java | 41 +- .../hssf/record/formula/functions/Trunc.java | 25 - .../hssf/record/formula/functions/Ttest.java | 25 - .../hssf/record/formula/functions/Type.java | 25 - .../record/formula/functions/Usdollar.java | 25 - .../hssf/record/formula/functions/Value.java | 12 +- .../hssf/record/formula/functions/Var.java | 25 - .../hssf/record/formula/functions/Vara.java | 25 - .../hssf/record/formula/functions/Varp.java | 25 - .../hssf/record/formula/functions/Varpa.java | 25 - .../hssf/record/formula/functions/Vdb.java | 25 - .../record/formula/functions/Vlookup.java | 18 +- .../record/formula/functions/Volatile.java | 25 - .../record/formula/functions/Weekday.java | 25 - .../record/formula/functions/Weibull.java | 25 - .../formula/functions/XYNumericFunction.java | 2 +- .../hssf/record/formula/functions/Ztest.java | 25 - .../record/formula/functions/TestMathX.java | 48 -- 236 files changed, 1024 insertions(+), 5511 deletions(-) delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Absref.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Activecell.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Address.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Areas.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Argument.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Asc.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Averagea.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Betadist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Betainv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Binomdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Call.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Caller.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Cell.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Char.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Chidist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Chiinv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Chitest.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Clean.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Code.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Confidence.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Correl.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Countblank.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Covar.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Critbinom.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Customrepeat.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Datedif.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Datestring.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Datevalue.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Daverage.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Days360.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Db.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dbcs.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dcount.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dcounta.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ddb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Deref.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dget.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dmax.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dmin.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dproduct.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dstdev.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dstdevp.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dsum.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dvar.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Dvarp.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Echo.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Error.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Evaluate.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Exec.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Expondist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Fdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Files.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Findb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Finv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Fisher.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Fisherinv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Fixed.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Forecast.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Formulaconvert.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Fpos.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Frequency.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ftest.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Gammadist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Gammainv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Gammaln.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Geomean.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Goto.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Group.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Growth.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Halt.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Harmean.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Help.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Hour.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Hypgeomdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Info.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Initiate.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Input.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Intercept.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ipmt.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Irr.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Iserr.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ispmt.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Kurt.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Lasterror.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Leftb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Lenb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Linest.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Links.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Logest.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Loginv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Lognormdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Mdeterm.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Midb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Minute.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Minverse.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Mirr.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Mmult.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/N.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Names.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Negbinomdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Normdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Norminv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Normsdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Normsinv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Note.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Npv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Numberstring.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Pearson.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Percentile.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Percentrank.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Permut.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Poisson.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ppmt.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Prob.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Proper.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Quartile.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Rank.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Rate.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Reftext.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Relref.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Replaceb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Rept.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Request.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Result.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Rightb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Roman.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Rsq.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Search.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Searchb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Second.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Series.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Setname.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Setvalue.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Skew.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Sln.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Slope.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Standardize.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Stdeva.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Stdevp.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Stdevpa.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Step.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Steyx.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Subtotal.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Syd.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Tdist.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Text.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Textref.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Timevalue.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Tinv.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Transpose.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Trend.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Trimmean.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Trunc.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ttest.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Type.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Usdollar.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Var.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Vara.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Varp.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Varpa.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Vdb.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Volatile.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Weekday.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Weibull.java delete mode 100644 src/java/org/apache/poi/hssf/record/formula/functions/Ztest.java diff --git a/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java b/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java index 12da871e6d..ef7f39a6b0 100644 --- a/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java +++ b/src/java/org/apache/poi/hssf/record/formula/eval/FunctionEval.java @@ -20,6 +20,7 @@ package org.apache.poi.hssf.record.formula.eval; import java.util.HashMap; import java.util.Map; +import org.apache.poi.hssf.record.formula.function.FunctionMetadata; import org.apache.poi.hssf.record.formula.function.FunctionMetadataRegistry; import org.apache.poi.hssf.record.formula.functions.*; @@ -28,404 +29,220 @@ import org.apache.poi.hssf.record.formula.functions.*; * */ public abstract class FunctionEval implements OperationEval { - /** - * Some function IDs that require special treatment - */ - private static final class FunctionID { - /** 4 */ - public static final int SUM = FunctionMetadataRegistry.FUNCTION_INDEX_SUM; - /** 78 */ - public static final int OFFSET = 78; - /** 148 */ - public static final int INDIRECT = 148; - /** 255 */ - public static final int EXTERNAL_FUNC = FunctionMetadataRegistry.FUNCTION_INDEX_EXTERNAL; - } - // convenient access to namespace - private static final FunctionID ID = null; - - protected static Function[] functions = produceFunctions(); - - private static Map freeRefFunctionsByIdMap; - - static { - Map m = new HashMap(); - m.put(createFRFKey(ID.INDIRECT), new Indirect()); - m.put(createFRFKey(ID.EXTERNAL_FUNC), new ExternalFunction()); - freeRefFunctionsByIdMap = m; - } - private static Integer createFRFKey(int functionIndex) { - return new Integer(functionIndex); - } - - - public Function getFunction() { - short fidx = getFunctionIndex(); - return functions[fidx]; - } - public boolean isFreeRefFunction() { - return freeRefFunctionsByIdMap.containsKey(createFRFKey(getFunctionIndex())); - } - public FreeRefFunction getFreeRefFunction() { - return freeRefFunctionsByIdMap.get(createFRFKey(getFunctionIndex())); - } - - public abstract short getFunctionIndex(); - - private static Function[] produceFunctions() { - Function[] retval = new Function[368]; - retval[0] = new Count(); // COUNT - retval[1] = new If(); // IF - retval[2] = new IsNa(); // ISNA - retval[3] = new IsError(); // ISERROR - retval[ID.SUM] = AggregateFunction.SUM; - retval[5] = AggregateFunction.AVERAGE; - retval[6] = AggregateFunction.MIN; - retval[7] = AggregateFunction.MAX; - retval[8] = new Row(); // ROW - retval[9] = new Column(); // COLUMN - retval[10] = new Na(); // NA - retval[11] = new Npv(); // NPV - retval[12] = AggregateFunction.STDEV; - retval[13] = NumericFunction.DOLLAR; - retval[14] = new Fixed(); // FIXED - retval[15] = NumericFunction.SIN; - retval[16] = NumericFunction.COS; - retval[17] = NumericFunction.TAN; - retval[18] = NumericFunction.ATAN; - retval[19] = new Pi(); // PI - retval[20] = NumericFunction.SQRT; - retval[21] = NumericFunction.EXP; - retval[22] = NumericFunction.LN; - retval[23] = NumericFunction.LOG10; - retval[24] = NumericFunction.ABS; - retval[25] = NumericFunction.INT; - retval[26] = NumericFunction.SIGN; - retval[27] = NumericFunction.ROUND; - retval[28] = new Lookup(); // LOOKUP - retval[29] = new Index(); // INDEX - retval[30] = new Rept(); // REPT - retval[31] = TextFunction.MID; - retval[32] = TextFunction.LEN; - retval[33] = new Value(); // VALUE - retval[34] = new True(); // TRUE - retval[35] = new False(); // FALSE - retval[36] = new And(); // AND - retval[37] = new Or(); // OR - retval[38] = new Not(); // NOT - retval[39] = NumericFunction.MOD; - retval[40] = new Dcount(); // DCOUNT - retval[41] = new Dsum(); // DSUM - retval[42] = new Daverage(); // DAVERAGE - retval[43] = new Dmin(); // DMIN - retval[44] = new Dmax(); // DMAX - retval[45] = new Dstdev(); // DSTDEV - retval[46] = new Var(); // VAR - retval[47] = new Dvar(); // DVAR - retval[48] = new Text(); // TEXT - retval[49] = new Linest(); // LINEST - retval[50] = new Trend(); // TREND - retval[51] = new Logest(); // LOGEST - retval[52] = new Growth(); // GROWTH - retval[53] = new Goto(); // GOTO - retval[54] = new Halt(); // HALT - retval[56] = FinanceFunction.PV; - retval[57] = FinanceFunction.FV; - retval[58] = FinanceFunction.NPER; - retval[59] = FinanceFunction.PMT; - retval[60] = new Rate(); // RATE - retval[61] = new Mirr(); // MIRR - retval[62] = new Irr(); // IRR - retval[63] = new Rand(); // RAND - retval[64] = new Match(); // MATCH - retval[65] = DateFunc.instance; // DATE - retval[66] = new Time(); // TIME - retval[67] = CalendarFieldFunction.DAY; // DAY - retval[68] = CalendarFieldFunction.MONTH; // MONTH - retval[69] = CalendarFieldFunction.YEAR; // YEAR - retval[70] = new Weekday(); // WEEKDAY - retval[71] = new Hour(); // HOUR - retval[72] = new Minute(); // MINUTE - retval[73] = new Second(); // SECOND - retval[74] = new Now(); // NOW - retval[75] = new Areas(); // AREAS - retval[76] = new Rows(); // ROWS - retval[77] = new Columns(); // COLUMNS - retval[ID.OFFSET] = new Offset(); // OFFSET - retval[79] = new Absref(); // ABSREF - retval[80] = new Relref(); // RELREF - retval[81] = new Argument(); // ARGUMENT - retval[82] = new Search(); // SEARCH - retval[83] = new Transpose(); // TRANSPOSE - retval[84] = new org.apache.poi.hssf.record.formula.functions.Error(); // ERROR - retval[85] = new Step(); // STEP - retval[86] = new Type(); // TYPE - retval[87] = new Echo(); // ECHO - retval[88] = new Setname(); // SETNAME - retval[89] = new Caller(); // CALLER - retval[90] = new Deref(); // DEREF - retval[91] = new NotImplementedFunction("WINDOWS"); - retval[92] = new Series(); // SERIES - retval[93] = new NotImplementedFunction("DOCUMENTS"); - retval[94] = new Activecell(); // ACTIVECELL - retval[95] = new NotImplementedFunction("SELECTION"); - retval[96] = new Result(); // RESULT - retval[97] = NumericFunction.ATAN2; - retval[98] = NumericFunction.ASIN; - retval[99] = NumericFunction.ACOS; - retval[100] = new Choose(); // CHOOSE - retval[101] = new Hlookup(); // HLOOKUP - retval[102] = new Vlookup(); // VLOOKUP - retval[103] = new Links(); // LINKS - retval[104] = new Input(); // INPUT - retval[105] = new Isref(); // ISREF - retval[106] = new NotImplementedFunction("GETFORMULA"); - retval[107] = new NotImplementedFunction("GETNAME"); - retval[108] = new Setvalue(); // SETVALUE - retval[109] = NumericFunction.LOG; - retval[110] = new Exec(); // EXEC - retval[111] = new Char(); // CHAR - retval[112] = TextFunction.LOWER; - retval[113] = TextFunction.UPPER; - retval[114] = new Proper(); // PROPER - retval[115] = TextFunction.LEFT; - retval[116] = TextFunction.RIGHT; - retval[117] = TextFunction.EXACT; - retval[118] = TextFunction.TRIM; - retval[119] = new Replace(); // REPLACE - retval[120] = new Substitute(); // SUBSTITUTE - retval[121] = new Code(); // CODE - retval[122] = new Names(); // NAMES - retval[123] = new NotImplementedFunction("DIRECTORY"); - retval[124] = new Find(); // FIND - retval[125] = new Cell(); // CELL - retval[126] = new Iserr(); // ISERR - retval[127] = new Istext(); // ISTEXT - retval[128] = new Isnumber(); // ISNUMBER - retval[129] = new Isblank(); // ISBLANK - retval[130] = new T(); // T - retval[131] = new N(); // N - retval[132] = new NotImplementedFunction("FOPEN"); - retval[133] = new NotImplementedFunction("FCLOSE"); - retval[134] = new NotImplementedFunction("FSIZE"); - retval[135] = new NotImplementedFunction("FREADLN"); - retval[136] = new NotImplementedFunction("FREAD"); - retval[137] = new NotImplementedFunction("FWRITELN"); - retval[138] = new NotImplementedFunction("FWRITE"); - retval[139] = new Fpos(); // FPOS - retval[140] = new Datevalue(); // DATEVALUE - retval[141] = new Timevalue(); // TIMEVALUE - retval[142] = new Sln(); // SLN - retval[143] = new Syd(); // SYD - retval[144] = new Ddb(); // DDB - retval[145] = new NotImplementedFunction("GETDEF"); - retval[146] = new Reftext(); // REFTEXT - retval[147] = new Textref(); // TEXTREF - retval[ID.INDIRECT] = null; // Indirect.evaluate has different signature - retval[149] = new NotImplementedFunction("REGISTER"); - retval[150] = new Call(); // CALL - retval[151] = new NotImplementedFunction("ADDBAR"); - retval[152] = new NotImplementedFunction("ADDMENU"); - retval[153] = new NotImplementedFunction("ADDCOMMAND"); - retval[154] = new NotImplementedFunction("ENABLECOMMAND"); - retval[155] = new NotImplementedFunction("CHECKCOMMAND"); - retval[156] = new NotImplementedFunction("RENAMECOMMAND"); - retval[157] = new NotImplementedFunction("SHOWBAR"); - retval[158] = new NotImplementedFunction("DELETEMENU"); - retval[159] = new NotImplementedFunction("DELETECOMMAND"); - retval[160] = new NotImplementedFunction("GETCHARTITEM"); - retval[161] = new NotImplementedFunction("DIALOGBOX"); - retval[162] = new Clean(); // CLEAN - retval[163] = new Mdeterm(); // MDETERM - retval[164] = new Minverse(); // MINVERSE - retval[165] = new Mmult(); // MMULT - retval[166] = new Files(); // FILES - retval[167] = new Ipmt(); // IPMT - retval[168] = new Ppmt(); // PPMT - retval[169] = new Counta(); // COUNTA - retval[170] = new NotImplementedFunction("CANCELKEY"); - retval[175] = new Initiate(); // INITIATE - retval[176] = new Request(); // REQUEST - retval[177] = new NotImplementedFunction("POKE"); - retval[178] = new NotImplementedFunction("EXECUTE"); - retval[179] = new NotImplementedFunction("TERMINATE"); - retval[180] = new NotImplementedFunction("RESTART"); - retval[181] = new Help(); // HELP - retval[182] = new NotImplementedFunction("GETBAR"); - retval[183] = AggregateFunction.PRODUCT; - retval[184] = NumericFunction.FACT; - retval[185] = new NotImplementedFunction("GETCELL"); - retval[186] = new NotImplementedFunction("GETWORKSPACE"); - retval[187] = new NotImplementedFunction("GETWINDOW"); - retval[188] = new NotImplementedFunction("GETDOCUMENT"); - retval[189] = new Dproduct(); // DPRODUCT - retval[190] = new Isnontext(); // ISNONTEXT - retval[191] = new NotImplementedFunction("GETNOTE"); - retval[192] = new Note(); // NOTE - retval[193] = new Stdevp(); // STDEVP - retval[194] = new Varp(); // VARP - retval[195] = new Dstdevp(); // DSTDEVP - retval[196] = new Dvarp(); // DVARP - retval[197] = new Trunc(); // TRUNC - retval[198] = new Islogical(); // ISLOGICAL - retval[199] = new Dcounta(); // DCOUNTA - retval[200] = new NotImplementedFunction("DELETEBAR"); - retval[201] = new NotImplementedFunction("UNREGISTER"); - retval[204] = new Usdollar(); // USDOLLAR - retval[205] = new Findb(); // FINDB - retval[206] = new Searchb(); // SEARCHB - retval[207] = new Replaceb(); // REPLACEB - retval[208] = new Leftb(); // LEFTB - retval[209] = new Rightb(); // RIGHTB - retval[210] = new Midb(); // MIDB - retval[211] = new Lenb(); // LENB - retval[212] = NumericFunction.ROUNDUP; - retval[213] = NumericFunction.ROUNDDOWN; - retval[214] = new Asc(); // ASC - retval[215] = new Dbcs(); // DBCS - retval[216] = new Rank(); // RANK - retval[219] = new Address(); // ADDRESS - retval[220] = new Days360(); // DAYS360 - retval[221] = new Today(); // TODAY - retval[222] = new Vdb(); // VDB - retval[227] = AggregateFunction.MEDIAN; - retval[228] = new Sumproduct(); // SUMPRODUCT - retval[229] = NumericFunction.SINH; - retval[230] = NumericFunction.COSH; - retval[231] = NumericFunction.TANH; - retval[232] = NumericFunction.ASINH; - retval[233] = NumericFunction.ACOSH; - retval[234] = NumericFunction.ATANH; - retval[235] = new Dget(); // DGET - retval[236] = new NotImplementedFunction("CREATEOBJECT"); - retval[237] = new Volatile(); // VOLATILE - retval[238] = new Lasterror(); // LASTERROR - retval[239] = new NotImplementedFunction("CUSTOMUNDO"); - retval[240] = new Customrepeat(); // CUSTOMREPEAT - retval[241] = new Formulaconvert(); // FORMULACONVERT - retval[242] = new NotImplementedFunction("GETLINKINFO"); - retval[243] = new NotImplementedFunction("TEXTBOX"); - retval[244] = new Info(); // INFO - retval[245] = new Group(); // GROUP - retval[246] = new NotImplementedFunction("GETOBJECT"); - retval[247] = new Db(); // DB - retval[248] = new NotImplementedFunction("PAUSE"); - retval[250] = new NotImplementedFunction("RESUME"); - retval[252] = new Frequency(); // FREQUENCY - retval[253] = new NotImplementedFunction("ADDTOOLBAR"); - retval[254] = new NotImplementedFunction("DELETETOOLBAR"); - retval[ID.EXTERNAL_FUNC] = null; // ExternalFunction is a FreeREfFunction - retval[256] = new NotImplementedFunction("RESETTOOLBAR"); - retval[257] = new Evaluate(); // EVALUATE - retval[258] = new NotImplementedFunction("GETTOOLBAR"); - retval[259] = new NotImplementedFunction("GETTOOL"); - retval[260] = new NotImplementedFunction("SPELLINGCHECK"); - retval[261] = new Errortype(); // ERRORTYPE - retval[262] = new NotImplementedFunction("APPTITLE"); - retval[263] = new NotImplementedFunction("WINDOWTITLE"); - retval[264] = new NotImplementedFunction("SAVETOOLBAR"); - retval[265] = new NotImplementedFunction("ENABLETOOL"); - retval[266] = new NotImplementedFunction("PRESSTOOL"); - retval[267] = new NotImplementedFunction("REGISTERID"); - retval[268] = new NotImplementedFunction("GETWORKBOOK"); - retval[269] = AggregateFunction.AVEDEV; - retval[270] = new Betadist(); // BETADIST - retval[271] = new Gammaln(); // GAMMALN - retval[272] = new Betainv(); // BETAINV - retval[273] = new Binomdist(); // BINOMDIST - retval[274] = new Chidist(); // CHIDIST - retval[275] = new Chiinv(); // CHIINV - retval[276] = NumericFunction.COMBIN; - retval[277] = new Confidence(); // CONFIDENCE - retval[278] = new Critbinom(); // CRITBINOM - retval[279] = new Even(); // EVEN - retval[280] = new Expondist(); // EXPONDIST - retval[281] = new Fdist(); // FDIST - retval[282] = new Finv(); // FINV - retval[283] = new Fisher(); // FISHER - retval[284] = new Fisherinv(); // FISHERINV - retval[285] = NumericFunction.FLOOR; - retval[286] = new Gammadist(); // GAMMADIST - retval[287] = new Gammainv(); // GAMMAINV - retval[288] = NumericFunction.CEILING; - retval[289] = new Hypgeomdist(); // HYPGEOMDIST - retval[290] = new Lognormdist(); // LOGNORMDIST - retval[291] = new Loginv(); // LOGINV - retval[292] = new Negbinomdist(); // NEGBINOMDIST - retval[293] = new Normdist(); // NORMDIST - retval[294] = new Normsdist(); // NORMSDIST - retval[295] = new Norminv(); // NORMINV - retval[296] = new Normsinv(); // NORMSINV - retval[297] = new Standardize(); // STANDARDIZE - retval[298] = new Odd(); // ODD - retval[299] = new Permut(); // PERMUT - retval[300] = new Poisson(); // POISSON - retval[301] = new Tdist(); // TDIST - retval[302] = new Weibull(); // WEIBULL - retval[303] = new Sumxmy2(); // SUMXMY2 - retval[304] = new Sumx2my2(); // SUMX2MY2 - retval[305] = new Sumx2py2(); // SUMX2PY2 - retval[306] = new Chitest(); // CHITEST - retval[307] = new Correl(); // CORREL - retval[308] = new Covar(); // COVAR - retval[309] = new Forecast(); // FORECAST - retval[310] = new Ftest(); // FTEST - retval[311] = new Intercept(); // INTERCEPT - retval[312] = new Pearson(); // PEARSON - retval[313] = new Rsq(); // RSQ - retval[314] = new Steyx(); // STEYX - retval[315] = new Slope(); // SLOPE - retval[316] = new Ttest(); // TTEST - retval[317] = new Prob(); // PROB - retval[318] = AggregateFunction.DEVSQ; - retval[319] = new Geomean(); // GEOMEAN - retval[320] = new Harmean(); // HARMEAN - retval[321] = AggregateFunction.SUMSQ; - retval[322] = new Kurt(); // KURT - retval[323] = new Skew(); // SKEW - retval[324] = new Ztest(); // ZTEST - retval[325] = AggregateFunction.LARGE; - retval[326] = AggregateFunction.SMALL; - retval[327] = new Quartile(); // QUARTILE - retval[328] = new Percentile(); // PERCENTILE - retval[329] = new Percentrank(); // PERCENTRANK - retval[330] = new Mode(); // MODE - retval[331] = new Trimmean(); // TRIMMEAN - retval[332] = new Tinv(); // TINV - retval[334] = new NotImplementedFunction("MOVIECOMMAND"); - retval[335] = new NotImplementedFunction("GETMOVIE"); - retval[336] = TextFunction.CONCATENATE; - retval[337] = NumericFunction.POWER; - retval[338] = new NotImplementedFunction("PIVOTADDDATA"); - retval[339] = new NotImplementedFunction("GETPIVOTTABLE"); - retval[340] = new NotImplementedFunction("GETPIVOTFIELD"); - retval[341] = new NotImplementedFunction("GETPIVOTITEM"); - retval[342] = NumericFunction.RADIANS; - retval[343] = NumericFunction.DEGREES; - retval[344] = new Subtotal(); // SUBTOTAL - retval[345] = new Sumif(); // SUMIF - retval[346] = new Countif(); // COUNTIF - retval[347] = new Countblank(); // COUNTBLANK - retval[348] = new NotImplementedFunction("SCENARIOGET"); - retval[349] = new NotImplementedFunction("OPTIONSLISTSGET"); - retval[350] = new Ispmt(); // ISPMT - retval[351] = new Datedif(); // DATEDIF - retval[352] = new Datestring(); // DATESTRING - retval[353] = new Numberstring(); // NUMBERSTRING - retval[354] = new Roman(); // ROMAN - retval[355] = new NotImplementedFunction("OPENDIALOG"); - retval[356] = new NotImplementedFunction("SAVEDIALOG"); - retval[357] = new NotImplementedFunction("VIEWGET"); - retval[358] = new NotImplementedFunction("GETPIVOTDATA"); - retval[359] = new Hyperlink(); // HYPERLINK - retval[360] = new NotImplementedFunction("PHONETIC"); - retval[361] = new Averagea(); // AVERAGEA - retval[362] = MinaMaxa.MAXA; - retval[363] = MinaMaxa.MINA; - retval[364] = new Stdevpa(); // STDEVPA - retval[365] = new Varpa(); // VARPA - retval[366] = new Stdeva(); // STDEVA - retval[367] = new Vara(); // VARA - return retval; - } + /** + * Some function IDs that require special treatment + */ + private static final class FunctionID { + /** 4 */ + public static final int SUM = FunctionMetadataRegistry.FUNCTION_INDEX_SUM; + /** 78 */ + public static final int OFFSET = 78; + /** 148 */ + public static final int INDIRECT = 148; + /** 255 */ + public static final int EXTERNAL_FUNC = FunctionMetadataRegistry.FUNCTION_INDEX_EXTERNAL; + } + // convenient access to namespace + private static final FunctionID ID = null; + + protected static final Function[] functions ; + + private static Map freeRefFunctionsByIdMap; + + static { + Map m = new HashMap(); + m.put(createFRFKey(ID.INDIRECT), new Indirect()); + m.put(createFRFKey(ID.EXTERNAL_FUNC), new ExternalFunction()); + freeRefFunctionsByIdMap = m; + functions = produceFunctions(); + } + private static Integer createFRFKey(int functionIndex) { + return new Integer(functionIndex); + } + + + public Function getFunction() { + short fidx = getFunctionIndex(); + return functions[fidx]; + } + public boolean isFreeRefFunction() { + return freeRefFunctionsByIdMap.containsKey(createFRFKey(getFunctionIndex())); + } + public FreeRefFunction getFreeRefFunction() { + return freeRefFunctionsByIdMap.get(createFRFKey(getFunctionIndex())); + } + + public abstract short getFunctionIndex(); + + private static Function[] produceFunctions() { + Function[] retval = new Function[368]; + + retval[0] = new Count(); + retval[1] = new If(); + + retval[3] = new IsError(); + retval[ID.SUM] = AggregateFunction.SUM; + retval[5] = AggregateFunction.AVERAGE; + retval[6] = AggregateFunction.MIN; + retval[7] = AggregateFunction.MAX; + retval[8] = new Row(); // ROW + retval[9] = new Column(); + retval[10] = new Na(); + + retval[12] = AggregateFunction.STDEV; + retval[13] = NumericFunction.DOLLAR; + + retval[15] = NumericFunction.SIN; + retval[16] = NumericFunction.COS; + retval[17] = NumericFunction.TAN; + retval[18] = NumericFunction.ATAN; + retval[19] = new Pi(); + retval[20] = NumericFunction.SQRT; + retval[21] = NumericFunction.EXP; + retval[22] = NumericFunction.LN; + retval[23] = NumericFunction.LOG10; + retval[24] = NumericFunction.ABS; + retval[25] = NumericFunction.INT; + retval[26] = NumericFunction.SIGN; + retval[27] = NumericFunction.ROUND; + retval[28] = new Lookup(); + retval[29] = new Index(); + + retval[31] = TextFunction.MID; + retval[32] = TextFunction.LEN; + retval[33] = new Value(); + retval[34] = new True(); + retval[35] = new False(); + retval[36] = new And(); + retval[37] = new Or(); + retval[38] = new Not(); + retval[39] = NumericFunction.MOD; + + retval[56] = FinanceFunction.PV; + retval[57] = FinanceFunction.FV; + retval[58] = FinanceFunction.NPER; + retval[59] = FinanceFunction.PMT; + + retval[63] = new Rand(); + retval[64] = new Match(); + retval[65] = DateFunc.instance; + retval[66] = new Time(); + retval[67] = CalendarFieldFunction.DAY; + retval[68] = CalendarFieldFunction.MONTH; + retval[69] = CalendarFieldFunction.YEAR; + + retval[74] = new Now(); + + retval[76] = new Rows(); + retval[77] = new Columns(); + retval[ID.OFFSET] = new Offset(); + + retval[97] = NumericFunction.ATAN2; + retval[98] = NumericFunction.ASIN; + retval[99] = NumericFunction.ACOS; + retval[100] = new Choose(); + retval[101] = new Hlookup(); + retval[102] = new Vlookup(); + + retval[105] = new Isref(); + + retval[109] = NumericFunction.LOG; + + retval[112] = TextFunction.LOWER; + retval[113] = TextFunction.UPPER; + + retval[115] = TextFunction.LEFT; + retval[116] = TextFunction.RIGHT; + retval[117] = TextFunction.EXACT; + retval[118] = TextFunction.TRIM; + retval[119] = new Replace(); + retval[120] = new Substitute(); + + retval[124] = new Find(); + + retval[127] = new Istext(); + retval[128] = new Isnumber(); + retval[129] = new Isblank(); + retval[130] = new T(); + + retval[ID.INDIRECT] = null; // Indirect.evaluate has different signature + + retval[169] = new Counta(); + + retval[183] = AggregateFunction.PRODUCT; + retval[184] = NumericFunction.FACT; + + retval[190] = new Isnontext(); + + retval[198] = new Islogical(); + + retval[212] = NumericFunction.ROUNDUP; + retval[213] = NumericFunction.ROUNDDOWN; + + retval[221] = new Today(); + + retval[227] = AggregateFunction.MEDIAN; + retval[228] = new Sumproduct(); + retval[229] = NumericFunction.SINH; + retval[230] = NumericFunction.COSH; + retval[231] = NumericFunction.TANH; + retval[232] = NumericFunction.ASINH; + retval[233] = NumericFunction.ACOSH; + retval[234] = NumericFunction.ATANH; + + retval[ID.EXTERNAL_FUNC] = null; // ExternalFunction is a FreeREfFunction + + retval[261] = new Errortype(); + + retval[269] = AggregateFunction.AVEDEV; + + retval[276] = NumericFunction.COMBIN; + + retval[279] = new Even(); + + retval[285] = NumericFunction.FLOOR; + + retval[288] = NumericFunction.CEILING; + + retval[298] = new Odd(); + + retval[303] = new Sumxmy2(); + retval[304] = new Sumx2my2(); + retval[305] = new Sumx2py2(); + + retval[318] = AggregateFunction.DEVSQ; + + retval[321] = AggregateFunction.SUMSQ; + + retval[325] = AggregateFunction.LARGE; + retval[326] = AggregateFunction.SMALL; + + retval[330] = new Mode(); + + retval[336] = TextFunction.CONCATENATE; + retval[337] = NumericFunction.POWER; + + retval[342] = NumericFunction.RADIANS; + retval[343] = NumericFunction.DEGREES; + + retval[345] = new Sumif(); + retval[346] = new Countif(); + + retval[359] = new Hyperlink(); + + retval[362] = MinaMaxa.MAXA; + retval[363] = MinaMaxa.MINA; + + for (int i = 0; i < retval.length; i++) { + Function f = retval[i]; + if (f == null) { + FunctionMetadata fm = FunctionMetadataRegistry.getFunctionByIndex(i); + if (fm == null) { + continue; + } + retval[i] = new NotImplementedFunction(fm.getName()); + } + } + return retval; + } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Absref.java b/src/java/org/apache/poi/hssf/record/formula/functions/Absref.java deleted file mode 100644 index 3a6e94a66e..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Absref.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Absref extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Activecell.java b/src/java/org/apache/poi/hssf/record/formula/functions/Activecell.java deleted file mode 100644 index 17b04137af..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Activecell.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Activecell extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Address.java b/src/java/org/apache/poi/hssf/record/formula/functions/Address.java deleted file mode 100644 index 9b408e0d34..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Address.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Address extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/AggregateFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/AggregateFunction.java index 0495ee3fc4..6397ea39f5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/AggregateFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/AggregateFunction.java @@ -30,8 +30,6 @@ public abstract class AggregateFunction extends MultiOperandNumericFunction { super(false, false); } - /* ---------------------------------------------------------------------- */ - public static final Function AVEDEV = new AggregateFunction() { protected double evaluate(double[] values) { return StatsLib.avedev(values); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/And.java b/src/java/org/apache/poi/hssf/record/formula/functions/And.java index 8ef99f8904..e024562865 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/And.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/And.java @@ -18,7 +18,7 @@ package org.apache.poi.hssf.record.formula.functions; /** - * + * */ public final class And extends BooleanFunction { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Areas.java b/src/java/org/apache/poi/hssf/record/formula/functions/Areas.java deleted file mode 100644 index a54b3e7188..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Areas.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Areas extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Argument.java b/src/java/org/apache/poi/hssf/record/formula/functions/Argument.java deleted file mode 100644 index d07b6d6a02..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Argument.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Argument extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Asc.java b/src/java/org/apache/poi/hssf/record/formula/functions/Asc.java deleted file mode 100644 index 295aba29ae..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Asc.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Asc extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Averagea.java b/src/java/org/apache/poi/hssf/record/formula/functions/Averagea.java deleted file mode 100644 index e9eb83eaf4..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Averagea.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - - -/** - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - */ -public class Averagea extends NotImplementedFunction { -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Betadist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Betadist.java deleted file mode 100644 index 87992f2d53..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Betadist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Betadist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Betainv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Betainv.java deleted file mode 100644 index 219eaf5e52..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Betainv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Betainv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Binomdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Binomdist.java deleted file mode 100644 index 6a13a25c79..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Binomdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Binomdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java index 9ec924e27a..4995599ea5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/BooleanFunction.java @@ -30,11 +30,11 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; * Here are the general rules concerning Boolean functions: *
    *
  1. Blanks are ignored (not either true or false)
  2. - *
  3. Strings are ignored if part of an area ref or cell ref, otherwise they must be 'true' or 'false'
  4. + *
  5. Strings are ignored if part of an area ref or cell ref, otherwise they must be 'true' or 'false'
  6. *
  7. Numbers: 0 is false. Any other number is TRUE
  8. *
  9. Areas: *all* cells in area are evaluated according to the above rules
  10. *
- * + * * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public abstract class BooleanFunction implements Function { @@ -56,7 +56,7 @@ public abstract class BooleanFunction implements Function { boolean result = getInitialResultValue(); boolean atleastOneNonBlank = false; - + /* * Note: no short-circuit boolean loop exit because any ErrorEvals will override the result */ @@ -88,21 +88,21 @@ public abstract class BooleanFunction implements Function { } else { throw new RuntimeException("Unexpected eval (" + arg.getClass().getName() + ")"); } - - + + if (tempVe != null) { result = partialEvaluate(result, tempVe.booleanValue()); atleastOneNonBlank = true; } } - + if (!atleastOneNonBlank) { throw new EvaluationException(ErrorEval.VALUE_INVALID); } return result; } - - + + protected abstract boolean getInitialResultValue(); protected abstract boolean partialEvaluate(boolean cumulativeResult, boolean currentValue); } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java index b1ea02fdc0..ce6c2b4285 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/CalendarFieldFunction.java @@ -31,16 +31,16 @@ import org.apache.poi.hssf.usermodel.HSSFDateUtil; /** * Implementation of Excel functions DAY, MONTH and YEAR - * - * + * + * * @author Guenter Kickinger g.kickinger@gmx.net */ public final class CalendarFieldFunction implements Function { - + public static final Function YEAR = new CalendarFieldFunction(Calendar.YEAR, false); public static final Function MONTH = new CalendarFieldFunction(Calendar.MONTH, true); public static final Function DAY = new CalendarFieldFunction(Calendar.DAY_OF_MONTH, false); - + private final int _dateFieldId; private final boolean _needsOneBaseAdjustment; @@ -89,4 +89,4 @@ public final class CalendarFieldFunction implements Function { } return result; } -} \ No newline at end of file +} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Call.java b/src/java/org/apache/poi/hssf/record/formula/functions/Call.java deleted file mode 100644 index a1cb4ca376..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Call.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Call extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Caller.java b/src/java/org/apache/poi/hssf/record/formula/functions/Caller.java deleted file mode 100644 index 206d08a703..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Caller.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Caller extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Cell.java b/src/java/org/apache/poi/hssf/record/formula/functions/Cell.java deleted file mode 100644 index ffbd322395..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Cell.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Cell extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Char.java b/src/java/org/apache/poi/hssf/record/formula/functions/Char.java deleted file mode 100644 index 2c4271dc70..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Char.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Char extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Chidist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Chidist.java deleted file mode 100644 index b431fe361a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Chidist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Chidist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Chiinv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Chiinv.java deleted file mode 100644 index c2d45b0e6e..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Chiinv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Chiinv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Chitest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Chitest.java deleted file mode 100644 index b7065b0ea6..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Chitest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Chitest extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Choose.java b/src/java/org/apache/poi/hssf/record/formula/functions/Choose.java index 2f3ac240a9..dbe0aa7a9b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Choose.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Choose.java @@ -24,7 +24,7 @@ import org.apache.poi.hssf.record.formula.eval.OperandResolver; import org.apache.poi.hssf.record.formula.eval.ValueEval; /** - * + * * @author Josh Micich */ public final class Choose implements Function { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Clean.java b/src/java/org/apache/poi/hssf/record/formula/functions/Clean.java deleted file mode 100644 index cc01655d57..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Clean.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Clean extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Code.java b/src/java/org/apache/poi/hssf/record/formula/functions/Code.java deleted file mode 100644 index e340a5757d..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Code.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Code extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Column.java b/src/java/org/apache/poi/hssf/record/formula/functions/Column.java index adde35c162..5b04836123 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Column.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Column.java @@ -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,11 +24,11 @@ import org.apache.poi.hssf.record.formula.eval.NumberEval; import org.apache.poi.hssf.record.formula.eval.RefEval; import org.apache.poi.hssf.record.formula.eval.ValueEval; -public class Column implements Function { +public final class Column implements Function { public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) { ValueEval retval = null; int cnum = -1; - + switch (evals.length) { default: retval = ErrorEval.VALUE_INVALID; @@ -51,15 +48,15 @@ public class Column implements Function { case 0: cnum = srcCellCol; } - + if (retval == null) { retval = (cnum >= 0) ? new NumberEval(cnum + 1) // +1 since excel colnums are 1 based : (ValueEval) ErrorEval.VALUE_INVALID; } - + return retval; } - + } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java b/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java index b75864e72d..2a57bedb2d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Columns.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.RefEval; /** * Implementation for Excel COLUMNS function. - * + * * @author Josh Micich */ public final class Columns implements Function { @@ -44,16 +43,16 @@ public final class Columns implements Function { return ErrorEval.VALUE_INVALID; } Eval firstArg = args[0]; - + int result; - if (firstArg instanceof AreaEval) { - AreaEval ae = (AreaEval) firstArg; - result = ae.getLastColumn() - ae.getFirstColumn() + 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.getLastColumn() - ae.getFirstColumn() + 1; + } else if (firstArg instanceof RefEval) { + result = 1; + } else { // anything else is not valid argument + return ErrorEval.VALUE_INVALID; + } + return new NumberEval(result); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Confidence.java b/src/java/org/apache/poi/hssf/record/formula/functions/Confidence.java deleted file mode 100644 index 0d30a8de49..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Confidence.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Confidence extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Correl.java b/src/java/org/apache/poi/hssf/record/formula/functions/Correl.java deleted file mode 100644 index 53cf4fd796..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Correl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Correl extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Count.java b/src/java/org/apache/poi/hssf/record/formula/functions/Count.java index 62f4b6137a..4b8b217f4d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Count.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Count.java @@ -25,12 +25,12 @@ import org.apache.poi.hssf.record.formula.functions.CountUtils.I_MatchPredicate; /** * Counts the number of cells that contain numeric data within - * the list of arguments. + * the list of arguments. * * Excel Syntax * COUNT(value1,value2,...) * Value1, value2, ... are 1 to 30 arguments representing the values or ranges to be counted. - * + * * TODO: Check this properly matches excel on edge cases * like formula cells, error cells etc */ @@ -47,12 +47,12 @@ public final class Count implements Function { // too many arguments return ErrorEval.VALUE_INVALID; } - + int temp = 0; - + for(int i=0; icriteriais used to determine which cells to count * *

- * + * * @author Josh Micich */ public final class Countif implements Function { @@ -121,7 +121,7 @@ public final class Countif implements Function { case NE: return !cmpResult; } - throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + _representation + "'"); } public boolean evaluate(int cmpResult) { @@ -135,7 +135,7 @@ public final class Countif implements Function { case GT: return cmpResult > 0; case GE: return cmpResult <= 0; } - throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '" + _representation + "'"); } public String toString() { @@ -204,7 +204,7 @@ public final class Countif implements Function { return true; default: // never matches (also inconsistent with above three cases). - // for example '>5' does not match '6', + // for example '>5' does not match '6', return false; } StringEval se = (StringEval)x; @@ -244,7 +244,7 @@ public final class Countif implements Function { int testValue; if(x instanceof StringEval) { if (true) { // change to false to observe more intuitive behaviour - // Note - Unlike with numbers, it seems that COUNTIF never matches + // Note - Unlike with numbers, it seems that COUNTIF never matches // boolean values when the target(x) is a string return false; } @@ -387,7 +387,7 @@ public final class Countif implements Function { case ']': case '(': case ')': - // escape literal characters that would have special meaning in regex + // escape literal characters that would have special meaning in regex sb.append("\\").append(ch); continue; } @@ -423,7 +423,7 @@ public final class Countif implements Function { * @return the number of evaluated cells in the range that match the specified criteria */ private double countMatchingCellsInArea(Eval rangeArg, I_MatchPredicate criteriaPredicate) { - + if (rangeArg instanceof RefEval) { return CountUtils.countMatchingCell((RefEval) rangeArg, criteriaPredicate); } else if (rangeArg instanceof AreaEval) { @@ -440,7 +440,7 @@ public final class Countif implements Function { /* package */ static I_MatchPredicate createCriteriaPredicate(Eval arg, int srcRowIndex, int srcColumnIndex) { Eval evaluatedCriteriaArg = evaluateCriteriaArg(arg, srcRowIndex, srcColumnIndex); - + if(evaluatedCriteriaArg instanceof NumberEval) { return new NumberMatcher(((NumberEval)evaluatedCriteriaArg).getNumberValue(), CmpOp.OP_NONE); } @@ -457,12 +457,12 @@ public final class Countif implements Function { if(evaluatedCriteriaArg == BlankEval.INSTANCE) { return null; } - throw new RuntimeException("Unexpected type for criteria (" + throw new RuntimeException("Unexpected type for criteria (" + evaluatedCriteriaArg.getClass().getName() + ")"); } /** - * + * * @return the de-referenced criteria arg (possibly {@link ErrorEval}) */ private static Eval evaluateCriteriaArg(Eval arg, int srcRowIndex, int srcColumnIndex) { @@ -512,7 +512,7 @@ public final class Countif implements Function { return null; } /** - * Boolean literals ('TRUE', 'FALSE') treated similarly but NOT same as numbers. + * Boolean literals ('TRUE', 'FALSE') treated similarly but NOT same as numbers. */ /* package */ static Boolean parseBoolean(String strRep) { if (strRep.length() < 1) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Covar.java b/src/java/org/apache/poi/hssf/record/formula/functions/Covar.java deleted file mode 100644 index fc1188992d..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Covar.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Covar extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Critbinom.java b/src/java/org/apache/poi/hssf/record/formula/functions/Critbinom.java deleted file mode 100644 index 3a3d1a67b9..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Critbinom.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Critbinom extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Customrepeat.java b/src/java/org/apache/poi/hssf/record/formula/functions/Customrepeat.java deleted file mode 100644 index 4206a173fa..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Customrepeat.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Customrepeat extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java b/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java index 6cbe8414fe..8c06837168 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java @@ -28,49 +28,48 @@ import org.apache.poi.hssf.usermodel.HSSFDateUtil; * @author Pavel Krupets (pkrupets at palmtreebusiness dot com) */ public final class DateFunc extends NumericFunction.MultiArg { - + public static final Function instance = new DateFunc(); - + private DateFunc() { super(3,3); } - + protected double evaluate(double[] ds) throws EvaluationException { int year = getYear(ds[0]); - int month = (int) ds[1] - 1; - int day = (int) ds[2]; - - if (year < 0 || month < 0 || day < 0) { - throw new EvaluationException(ErrorEval.VALUE_INVALID); - } - - if (year == 1900 && month == Calendar.FEBRUARY && day == 29) { - return 60.0; - } - - if (year == 1900) { - if ((month == Calendar.JANUARY && day >= 60) || - (month == Calendar.FEBRUARY && day >= 30)) - { - day--; - } - } - - Calendar c = new GregorianCalendar(); - - c.set(year, month, day, 0, 0, 0); - c.set(Calendar.MILLISECOND, 0); - - return HSSFDateUtil.getExcelDate(c.getTime(), false); // XXX fix 1900/1904 problem - } - - private static int getYear(double d) { - int year = (int)d; - - if (year < 0) { - return -1; - } - - return year < 1900 ? 1900 + year : year; - } + int month = (int) ds[1] - 1; + int day = (int) ds[2]; + + if (year < 0 || month < 0 || day < 0) { + throw new EvaluationException(ErrorEval.VALUE_INVALID); + } + + if (year == 1900 && month == Calendar.FEBRUARY && day == 29) { + return 60.0; + } + + if (year == 1900) { + if ((month == Calendar.JANUARY && day >= 60) || + (month == Calendar.FEBRUARY && day >= 30)) { + day--; + } + } + + Calendar c = new GregorianCalendar(); + + c.set(year, month, day, 0, 0, 0); + c.set(Calendar.MILLISECOND, 0); + + return HSSFDateUtil.getExcelDate(c.getTime(), false); // TODO - fix 1900/1904 problem + } + + private static int getYear(double d) { + int year = (int)d; + + if (year < 0) { + return -1; + } + + return year < 1900 ? 1900 + year : year; + } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Datedif.java b/src/java/org/apache/poi/hssf/record/formula/functions/Datedif.java deleted file mode 100644 index 1a14516049..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Datedif.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Datedif extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Datestring.java b/src/java/org/apache/poi/hssf/record/formula/functions/Datestring.java deleted file mode 100644 index 0a80110b79..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Datestring.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Datestring extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Datevalue.java b/src/java/org/apache/poi/hssf/record/formula/functions/Datevalue.java deleted file mode 100644 index a0377527cf..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Datevalue.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Datevalue extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Daverage.java b/src/java/org/apache/poi/hssf/record/formula/functions/Daverage.java deleted file mode 100644 index ebf9c28bce..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Daverage.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Daverage extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Days360.java b/src/java/org/apache/poi/hssf/record/formula/functions/Days360.java deleted file mode 100644 index 2187576429..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Days360.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Days360 extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Db.java b/src/java/org/apache/poi/hssf/record/formula/functions/Db.java deleted file mode 100644 index 1dd80b6af7..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Db.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Db extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dbcs.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dbcs.java deleted file mode 100644 index 30ad221bcf..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dbcs.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dbcs extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dcount.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dcount.java deleted file mode 100644 index 1d64ae2595..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dcount.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dcount extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dcounta.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dcounta.java deleted file mode 100644 index 72d36bc0fd..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dcounta.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dcounta extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ddb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ddb.java deleted file mode 100644 index 66b5a33e08..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ddb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ddb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Deref.java b/src/java/org/apache/poi/hssf/record/formula/functions/Deref.java deleted file mode 100644 index bb773522b2..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Deref.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Deref extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dget.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dget.java deleted file mode 100644 index ebd846333b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dget.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dget extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dmax.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dmax.java deleted file mode 100644 index 18ea2bdc7b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dmax.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dmax extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dmin.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dmin.java deleted file mode 100644 index 9307af584a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dmin.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dmin extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dproduct.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dproduct.java deleted file mode 100644 index bf86748d2c..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dproduct.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dproduct extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dstdev.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dstdev.java deleted file mode 100644 index 0cdb4c237f..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dstdev.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dstdev extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dstdevp.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dstdevp.java deleted file mode 100644 index e9a2bfaf13..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dstdevp.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dstdevp extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dsum.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dsum.java deleted file mode 100644 index 3c057ca28b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dsum.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dsum extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dvar.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dvar.java deleted file mode 100644 index 764cf618c4..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dvar.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dvar extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Dvarp.java b/src/java/org/apache/poi/hssf/record/formula/functions/Dvarp.java deleted file mode 100644 index 03928b77d4..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Dvarp.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Dvarp extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Echo.java b/src/java/org/apache/poi/hssf/record/formula/functions/Echo.java deleted file mode 100644 index 87d4e29bf8..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Echo.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Echo extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Error.java b/src/java/org/apache/poi/hssf/record/formula/functions/Error.java deleted file mode 100644 index 41a7ecd9d4..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Error.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Error extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java b/src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java index abd32c94d0..0240f817e7 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Errortype.java @@ -6,7 +6,7 @@ (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 + 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, @@ -43,8 +43,8 @@ import org.apache.poi.hssf.usermodel.HSSFErrorConstants; * #N/A!7 * everything else#N/A! * - * - * Note - the results of ERROR.TYPE() are different to the constants defined in + * + * Note - the results of ERROR.TYPE() are different to the constants defined in * HSSFErrorConstants. *

* @@ -53,7 +53,7 @@ import org.apache.poi.hssf.usermodel.HSSFErrorConstants; public final class Errortype implements Function { public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) { - + try { OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol); return ErrorEval.NA; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Evaluate.java b/src/java/org/apache/poi/hssf/record/formula/functions/Evaluate.java deleted file mode 100644 index d458875406..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Evaluate.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Evaluate extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Even.java b/src/java/org/apache/poi/hssf/record/formula/functions/Even.java index eaeed89247..8426416d42 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Even.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Even.java @@ -20,7 +20,7 @@ package org.apache.poi.hssf.record.formula.functions; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ public final class Even extends NumericFunction.OneArg { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Exec.java b/src/java/org/apache/poi/hssf/record/formula/functions/Exec.java deleted file mode 100644 index 327ba77f4e..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Exec.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Exec extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Expondist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Expondist.java deleted file mode 100644 index 5ba8727d9d..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Expondist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Expondist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/False.java b/src/java/org/apache/poi/hssf/record/formula/functions/False.java index 2a16b1c73a..b94686bb9e 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/False.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/False.java @@ -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.BoolEval; @@ -27,9 +24,9 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ -public class False implements Function { +public final class False implements Function { public Eval evaluate(Eval[] operands, int srcRow, short srcCol) { ValueEval retval; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Fdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Fdist.java deleted file mode 100644 index be27363247..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Fdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Fdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Files.java b/src/java/org/apache/poi/hssf/record/formula/functions/Files.java deleted file mode 100644 index 156fc67012..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Files.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Files extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/FinanceFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/FinanceFunction.java index 01fcf9ef0b..2de9ab1350 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/FinanceFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/FinanceFunction.java @@ -34,7 +34,7 @@ public abstract class FinanceFunction extends NumericFunction.MultiArg { // All finance functions have 3 to 5 args, first 4 are numbers, last is boolean // default for last 2 args are 0.0 and false // Text boolean literals are not valid for the last arg - + double arg3 = 0.0; double arg4 = 0.0; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/FinanceLib.java b/src/java/org/apache/poi/hssf/record/formula/functions/FinanceLib.java index 96f8717a2c..d811116c10 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/FinanceLib.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/FinanceLib.java @@ -1,29 +1,26 @@ -/* -* 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 21, 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; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * - * + * + * * This class is a functon library for common fiscal functions. * Glossary of terms/abbreviations: *
@@ -32,9 +29,9 @@ package org.apache.poi.hssf.record.formula.functions; *
  • PV: Present Value
  • *
  • NPV: Net Present Value
  • *
  • PMT: (Periodic) Payment
  • - * + * * - * For more info on the terms/abbreviations please use the references below + * For more info on the terms/abbreviations please use the references below * (hyperlinks are subject to change): *
    Online References: *
      @@ -59,19 +56,17 @@ package org.apache.poi.hssf.record.formula.functions; * ny + p + f=0 ...{when r=0} * */ -public final class FinanceLib { - - // constants for default values - - - - private FinanceLib() {} - +final class FinanceLib { + + private FinanceLib() { + // no instances of this class + } + /** * Future value of an amount given the number of payments, rate, amount * of individual payment, present value and boolean value indicating whether - * payments are due at the beginning of period - * (false => payments are due at end of period) + * payments are due at the beginning of period + * (false => payments are due at end of period) * @param r rate * @param n num of periods * @param y pmt per period @@ -85,18 +80,18 @@ public final class FinanceLib { } else { double r1 = r + 1; - retval =((1-Math.pow(r1, n)) * (t ? r1 : 1) * y ) / r - - + retval =((1-Math.pow(r1, n)) * (t ? r1 : 1) * y ) / r + - p*Math.pow(r1, n); } return retval; } - + /** * Present value of an amount given the number of future payments, rate, amount * of individual payment, future value and boolean value indicating whether - * payments are due at the beginning of period - * (false => payments are due at end of period) + * payments are due at the beginning of period + * (false => payments are due at end of period) * @param r * @param n * @param y @@ -116,12 +111,12 @@ public final class FinanceLib { } return retval; } - + /** * calculates the Net Present Value of a principal amount - * given the discount rate and a sequence of cash flows - * (supplied as an array). If the amounts are income the value should - * be positive, else if they are payments and not income, the + * given the discount rate and a sequence of cash flows + * (supplied as an array). If the amounts are income the value should + * be positive, else if they are payments and not income, the * value should be negative. * @param r * @param cfs cashflow amounts @@ -136,9 +131,9 @@ public final class FinanceLib { } return npv; } - + /** - * + * * @param r * @param n * @param p @@ -152,15 +147,15 @@ public final class FinanceLib { } else { double r1 = r + 1; - retval = ( f + p * Math.pow(r1, n) ) * r - / + retval = ( f + p * Math.pow(r1, n) ) * r + / ((t ? r1 : 1) * (1 - Math.pow(r1, n))); } return retval; } /** - * + * * @param r * @param y * @param p @@ -185,6 +180,6 @@ public final class FinanceLib { } return retval; } - + } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Find.java b/src/java/org/apache/poi/hssf/record/formula/functions/Find.java index 5621eb5cea..802b8161f5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Find.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Find.java @@ -29,13 +29,13 @@ import org.apache.poi.hssf.record.formula.eval.EvaluationException; * Syntax:
      * FIND(find_text, within_text, start_num)

      * - * FIND returns the character position of the first occurrence of find_text inside + * FIND returns the character position of the first occurrence of find_text inside * within_text. The third parameter, start_num, is optional (default=1) * and specifies where to start searching from. Character positions are 1-based.

      * * @author Torstein Tauno Svendsen (torstei@officenet.no) */ -public class Find extends TextFunction { +public final class Find extends TextFunction { protected ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Findb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Findb.java deleted file mode 100644 index e722f74da1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Findb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Findb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Finv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Finv.java deleted file mode 100644 index 3ebb914bcd..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Finv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Finv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Fisher.java b/src/java/org/apache/poi/hssf/record/formula/functions/Fisher.java deleted file mode 100644 index 8d2fba2585..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Fisher.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Fisher extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Fisherinv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Fisherinv.java deleted file mode 100644 index 9f5167c9f7..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Fisherinv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Fisherinv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Fixed.java b/src/java/org/apache/poi/hssf/record/formula/functions/Fixed.java deleted file mode 100644 index e5e5dc6377..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Fixed.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Fixed extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Forecast.java b/src/java/org/apache/poi/hssf/record/formula/functions/Forecast.java deleted file mode 100644 index 5fb4095038..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Forecast.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Forecast extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Formulaconvert.java b/src/java/org/apache/poi/hssf/record/formula/functions/Formulaconvert.java deleted file mode 100644 index 32b3a7beba..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Formulaconvert.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Formulaconvert extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Fpos.java b/src/java/org/apache/poi/hssf/record/formula/functions/Fpos.java deleted file mode 100644 index 6e0b66fbf8..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Fpos.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Fpos extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/FreeRefFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/FreeRefFunction.java index cdec045b40..edec7df5ce 100755 --- a/src/java/org/apache/poi/hssf/record/formula/functions/FreeRefFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/FreeRefFunction.java @@ -23,34 +23,34 @@ import org.apache.poi.ss.formula.EvaluationWorkbook; /** - * For most Excel functions, involving references ((cell, area), (2d, 3d)), the references are + * For most Excel functions, involving references ((cell, area), (2d, 3d)), the references are * passed in as arguments, and the exact location remains fixed. However, a select few Excel * functions have the ability to access cells that were not part of any reference passed as an * argument.
      * Two important functions with this feature are INDIRECT and OFFSET

      - * + * * In POI, the HSSFFormulaEvaluator evaluates every cell in each reference argument before * calling the function. This means that functions using fixed references do not need access to * the rest of the workbook to execute. Hence the evaluate() method on the common - * interface Function does not take a workbook parameter.

      - * - * This interface recognises the requirement of some functions to freely create and evaluate + * interface Function does not take a workbook parameter.

      + * + * This interface recognises the requirement of some functions to freely create and evaluate * references beyond those passed in as arguments. - * + * * @author Josh Micich */ public interface FreeRefFunction { /** - * + * * @param args the pre-evaluated arguments for this function. args is never null, * nor are any of its elements. * @param srcCellSheet zero based sheet index of the cell containing the currently evaluating formula - * @param srcCellRow zero based row index of the cell containing the currently evaluating formula - * @param srcCellCol zero based column index of the cell containing the currently evaluating formula + * @param srcCellRow zero based row index of the cell containing the currently evaluating formula + * @param srcCellCol zero based column index of the cell containing the currently evaluating formula * @param workbook is the workbook containing the formula/cell being evaluated - * @return never null. Possibly an instance of ErrorEval in the case of + * @return never null. Possibly an instance of ErrorEval in the case of * a specified Excel error (Exceptions are never thrown to represent Excel errors). - * + * */ ValueEval evaluate(Eval[] args, EvaluationWorkbook workbook, int srcCellSheet, int srcCellRow, int srcCellCol); } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Frequency.java b/src/java/org/apache/poi/hssf/record/formula/functions/Frequency.java deleted file mode 100644 index fc003c3e2e..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Frequency.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Frequency extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ftest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ftest.java deleted file mode 100644 index fb662027ef..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ftest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ftest extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Function.java b/src/java/org/apache/poi/hssf/record/formula/functions/Function.java index 3bce8ffa83..90e6afe05f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Function.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Function.java @@ -25,22 +25,22 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * Common interface for all implementations of Excel built-in functions. - * + * * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public interface Function { /** - * @param args the evaluated function arguments. Elements of this array typically implement - * {@link ValueEval}. Empty values are represented with {@link BlankEval} or {@link + * @param args the evaluated function arguments. Elements of this array typically implement + * {@link ValueEval}. Empty values are represented with {@link BlankEval} or {@link * MissingArgEval}, never null. * @param srcRowIndex row index of the cell containing the formula under evaluation * @param srcColumnIndex column index of the cell containing the formula under evaluation * @return The evaluated result, possibly an {@link ErrorEval}, never null. * Note - Excel uses the error code #NUM! instead of IEEE NaN, so when - * numeric functions evaluate to {@link Double#NaN} be sure to translate the result to {@link - * ErrorEval#NUM_ERROR}. - * + * numeric functions evaluate to {@link Double#NaN} be sure to translate the result to {@link + * ErrorEval#NUM_ERROR}. + * */ Eval evaluate(Eval[] args, int srcRowIndex, short srcColumnIndex); } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Gammadist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Gammadist.java deleted file mode 100644 index fa788c55e5..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Gammadist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Gammadist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Gammainv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Gammainv.java deleted file mode 100644 index ea8bdc53be..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Gammainv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Gammainv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Gammaln.java b/src/java/org/apache/poi/hssf/record/formula/functions/Gammaln.java deleted file mode 100644 index fb6026657a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Gammaln.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Gammaln extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Geomean.java b/src/java/org/apache/poi/hssf/record/formula/functions/Geomean.java deleted file mode 100644 index 1669a78901..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Geomean.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Geomean extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Goto.java b/src/java/org/apache/poi/hssf/record/formula/functions/Goto.java deleted file mode 100644 index c1a4d596da..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Goto.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Goto extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Group.java b/src/java/org/apache/poi/hssf/record/formula/functions/Group.java deleted file mode 100644 index 91c6cc5d18..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Group.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Group extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Growth.java b/src/java/org/apache/poi/hssf/record/formula/functions/Growth.java deleted file mode 100644 index 5a35a2b24b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Growth.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Growth extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Halt.java b/src/java/org/apache/poi/hssf/record/formula/functions/Halt.java deleted file mode 100644 index 74ce5761c6..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Halt.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Halt extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Harmean.java b/src/java/org/apache/poi/hssf/record/formula/functions/Harmean.java deleted file mode 100644 index ade3109a1b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Harmean.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Harmean extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Help.java b/src/java/org/apache/poi/hssf/record/formula/functions/Help.java deleted file mode 100644 index 1bf4004ac1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Help.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Help extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java b/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java index 2bbf6f5cd5..8230fb01f9 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Hlookup.java @@ -26,22 +26,22 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.functions.LookupUtils.ValueVector; /** * Implementation of the HLOOKUP() function.

      - * + * * HLOOKUP finds a column in a lookup table by the first row value and returns the value from another row.
      - * + * * Syntax:
      * HLOOKUP(lookup_value, table_array, row_index_num, range_lookup)

      - * + * * lookup_value The value to be found in the first column of the table array.
      * table_array An area reference for the lookup data.
      * row_index_num a 1 based index specifying which row value of the lookup data will be returned.
      - * range_lookup If TRUE (default), HLOOKUP finds the largest value less than or equal to - * the lookup_value. If FALSE, only exact matches will be considered
      - * + * range_lookup If TRUE (default), HLOOKUP finds the largest value less than or equal to + * the lookup_value. If FALSE, only exact matches will be considered
      + * * @author Josh Micich */ public final class Hlookup implements Function { - + public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) { Eval arg3 = null; switch(args.length) { @@ -71,9 +71,9 @@ public final class Hlookup implements Function { /** * Returns one column from an AreaEval - * + * * @param rowIndex assumed to be non-negative - * + * * @throws EvaluationException (#REF!) if colIndex is too high */ private ValueVector createResultColumnVector(AreaEval tableArray, int rowIndex) throws EvaluationException { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Hour.java b/src/java/org/apache/poi/hssf/record/formula/functions/Hour.java deleted file mode 100644 index 0caeda4d8c..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Hour.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Hour extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java b/src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java index d729762a50..ecfdebf26f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Hyperlink.java @@ -25,21 +25,21 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; /** * Implementation of Excel HYPERLINK function.

      - * + * * In Excel this function has special behaviour - it causes the displayed cell value to behave like - * a hyperlink in the GUI. From an evaluation perspective however, it is very simple.

      - * + * a hyperlink in the GUI. From an evaluation perspective however, it is very simple.

      + * * Syntax:
      * HYPERLINK(link_location, friendly_name)

      - * + * * link_location The URL of the hyperlink
      * friendly_name (optional) the value to display

      - * + * * Returns last argument. Leaves type unchanged (does not convert to {@link StringEval}). * @author Wayne Clingingsmith */ -public class Hyperlink implements Function { +public final class Hyperlink implements Function { public Eval evaluate(Eval[] operands, int srcRow, short srcCol) { int lastArgIx = operands.length - 1; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Hypgeomdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Hypgeomdist.java deleted file mode 100644 index 9c76cc148a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Hypgeomdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Hypgeomdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/If.java b/src/java/org/apache/poi/hssf/record/formula/functions/If.java index 4b066b8226..450a96834b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/If.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/If.java @@ -26,7 +26,7 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ public final class If implements Function { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Index.java b/src/java/org/apache/poi/hssf/record/formula/functions/Index.java index 371a06e30a..b4eca2b9b5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Index.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Index.java @@ -62,7 +62,6 @@ public final class Index implements Function { // 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() + ")"); } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java b/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java index acac8488d4..4640a099a2 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Indirect.java @@ -24,18 +24,18 @@ import org.apache.poi.ss.formula.eval.NotImplementedException; /** * Implementation for Excel function INDIRECT

      - * - * INDIRECT() returns the cell or area reference denoted by the text argument.

      - * + * + * INDIRECT() returns the cell or area reference denoted by the text argument.

      + * * Syntax:
      * INDIRECT(ref_text,isA1Style)

      - * + * * ref_text a string representation of the desired reference as it would normally be written * in a cell formula.
      * isA1Style (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 { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Info.java b/src/java/org/apache/poi/hssf/record/formula/functions/Info.java deleted file mode 100644 index 2b542dd717..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Info extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Initiate.java b/src/java/org/apache/poi/hssf/record/formula/functions/Initiate.java deleted file mode 100644 index 6795c7aeb1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Initiate.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Initiate extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Input.java b/src/java/org/apache/poi/hssf/record/formula/functions/Input.java deleted file mode 100644 index 0d3614c796..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Input.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Input extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Intercept.java b/src/java/org/apache/poi/hssf/record/formula/functions/Intercept.java deleted file mode 100644 index bf94b5ba29..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Intercept.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Intercept extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ipmt.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ipmt.java deleted file mode 100644 index 61e85a4d5b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ipmt.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ipmt extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Irr.java b/src/java/org/apache/poi/hssf/record/formula/functions/Irr.java deleted file mode 100644 index f23325e4f9..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Irr.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Irr extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java b/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java index 786060704e..818a463d95 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/IsError.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -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 @@ public class IsError implements Function { 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 @@ public class IsError implements Function { 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 @@ public class IsError implements Function { b = false; } } - + if (retval == null) { retval = b ? BoolEval.TRUE diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java b/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java deleted file mode 100644 index b1f8f09641..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/IsNa.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class IsNa extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java b/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java index c0e482e5a8..655d296c39 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Isblank.java @@ -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 @@ public final class Isblank implements Function { return ErrorEval.VALUE_INVALID; } Eval arg = args[0]; - + ValueEval singleCellValue; try { singleCellValue = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Iserr.java b/src/java/org/apache/poi/hssf/record/formula/functions/Iserr.java deleted file mode 100644 index f1ebd48fbd..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Iserr.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Iserr extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java b/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java index 318d1e69f1..666c89ee04 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Islogical.java @@ -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 < amolweb at ya hoo dot com > * */ -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 @@ public class Islogical extends LogicalFunction { } } } - + return retval; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java b/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java index eb07e63eb8..e62dc69019 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Isnontext.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -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 @@ public class Isnontext extends LogicalFunction { } } } - + return retval; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java b/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java index e3ff8d49aa..f00fd05c24 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Isnumber.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.RefEval; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -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 @@ public class Isnumber extends LogicalFunction { } } } - + return retval; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ispmt.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ispmt.java deleted file mode 100644 index 69c7f428c3..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ispmt.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ispmt extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java b/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java index 1deb606544..565d5e4989 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Isref.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.RefEval; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -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 @@ public class Isref implements Function { retval = BoolEval.TRUE; } } - + return retval; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java b/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java index ec87d79cbd..f669d7f497 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Istext.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; * @author Amol S. Deshmukh < amolweb at ya hoo dot com > * */ -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 @@ public class Istext extends LogicalFunction { } } } - + return retval; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Kurt.java b/src/java/org/apache/poi/hssf/record/formula/functions/Kurt.java deleted file mode 100644 index fe4e76eef5..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Kurt.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Kurt extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Lasterror.java b/src/java/org/apache/poi/hssf/record/formula/functions/Lasterror.java deleted file mode 100644 index c5024a5ad3..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Lasterror.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Lasterror extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Leftb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Leftb.java deleted file mode 100644 index 9c3d362970..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Leftb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Leftb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Lenb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Lenb.java deleted file mode 100644 index b47105aa13..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Lenb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Lenb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Linest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Linest.java deleted file mode 100644 index ea415a40c1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Linest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Linest extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Links.java b/src/java/org/apache/poi/hssf/record/formula/functions/Links.java deleted file mode 100644 index 1f2d570204..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Links.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Links extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Logest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Logest.java deleted file mode 100644 index 2a36f7dad2..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Logest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Logest extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java index 03756e1faf..ae5a0ebf6b 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java @@ -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 @@ public abstract class LogicalFunction implements Function { /** * 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); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Loginv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Loginv.java deleted file mode 100644 index 8b885ca506..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Loginv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Loginv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Lognormdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Lognormdist.java deleted file mode 100644 index 26ca53baec..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Lognormdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Lognormdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java b/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java index 305d8fb0d7..0cbae7fb88 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Lookup.java @@ -27,16 +27,16 @@ import org.apache.poi.hssf.record.formula.functions.LookupUtils.ValueVector; /** * Implementation of Excel function LOOKUP.

      - * + * * LOOKUP finds an index row in a lookup table by the first column value and returns the value from another column. - * + * * Syntax:
      * VLOOKUP(lookup_value, lookup_vector, result_vector)

      - * + * * lookup_value The value to be found in the lookup vector.
      * lookup_vector An area reference for the lookup data.
      * result_vector Single row or single column area reference from which the result value is chosen.
      - * + * * @author Josh Micich */ public final class Lookup implements Function { @@ -51,13 +51,13 @@ public final class Lookup implements Function { 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 @@ public final class Lookup implements Function { 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(); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java b/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java index 613a3d144c..376d9a4e0a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/LookupUtils.java @@ -218,7 +218,7 @@ final class LookupUtils { private static abstract class LookupValueComparerBase implements LookupValueComparer { - private final Class _targetClass; + private final Class _targetClass; protected LookupValueComparerBase(ValueEval targetValue) { if(targetValue == null) { throw new RuntimeException("targetValue cannot be null"); @@ -231,9 +231,6 @@ final class LookupUtils { } if (_targetClass != other.getClass()) { return CompareResult.TYPE_MISMATCH; - } - if (_targetClass == StringEval.class) { - } return compareSameType(other); } @@ -330,7 +327,7 @@ final class LookupUtils { 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 @@ final class LookupUtils { // 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 @@ final class LookupUtils { 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) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Match.java b/src/java/org/apache/poi/hssf/record/formula/functions/Match.java index a464ec873a..7a8cc6cc24 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Match.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Match.java @@ -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 @@ public final class Match implements Function { 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)) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java b/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java index 311707665e..f51821d042 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/MathX.java @@ -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 < amolweb at ya hoo dot com > @@ -28,22 +23,23 @@ package org.apache.poi.hssf.record.formula.functions; * 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. *

      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. *

      If n is NaN, returned value is NaN. * @param n @@ -51,7 +47,7 @@ public final class MathX { */ public static double round(double n, int p) { double retval; - + if (Double.isNaN(n) || Double.isInfinite(n)) { retval = Double.NaN; } @@ -64,20 +60,20 @@ public final class MathX { 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. *

      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. *

      If n is NaN, returned value is NaN. * @param n @@ -85,7 +81,7 @@ public final class MathX { */ public static double roundUp(double n, int p) { double retval; - + if (Double.isNaN(n) || Double.isInfinite(n)) { retval = Double.NaN; } @@ -93,34 +89,34 @@ public final class MathX { 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. *

      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. *

      If n is NaN, returned value is NaN. * @param n @@ -128,7 +124,7 @@ public final class MathX { */ public static double roundDown(double n, int p) { double retval; - + if (Double.isNaN(n) || Double.isInfinite(n)) { retval = Double.NaN; } @@ -141,17 +137,17 @@ public final class MathX { retval = (long) n; } } - + return retval; } - - + + /** * If d < 0, returns short -1 *
      * If d > 0, returns short 1 *
      - * If d == 0, returns short 0 + * If d == 0, returns short 0 *

      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 @@ public final class MathX { ? -1 : 1); } - + /** * average of all values * @param values @@ -177,8 +173,8 @@ public final class MathX { ave = sum / values.length; return ave; } - - + + /** * sum of all values * @param values @@ -190,7 +186,7 @@ public final class MathX { } return sum; } - + /** * sum of squares of all values * @param values @@ -202,8 +198,8 @@ public final class MathX { } return sumsq; } - - + + /** * product of all values * @param values @@ -218,7 +214,7 @@ public final class MathX { } return product; } - + /** * min of all values. If supplied array is zero length, * Double.POSITIVE_INFINITY is returned. @@ -262,17 +258,17 @@ public final class MathX { */ 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(..). *

      @@ -290,30 +286,30 @@ public final class MathX { */ 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; } - + /** - *
      for all n >= 1; factorial n = n * (n-1) * (n-2) * ... * 1 + *
      for all n >= 1; factorial n = n * (n-1) * (n-2) * ... * 1 *
      else if n == 0; factorial n = 1 *
      else if n < 0; factorial n = Double.NaN *
      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 @@ public final class MathX { } return d; } - + /** * returns the remainder resulting from operation: - * n / d. + * n / d. *
      The result has the sign of the divisor. *
      Examples: *

        @@ -348,7 +344,7 @@ public final class MathX { */ public static double mod(double n, double d) { double result = 0; - + if (d == 0) { result = Double.NaN; } @@ -363,11 +359,11 @@ public final class MathX { t = Math.ceil(t) - t; result = sign(d) * Math.abs(t * d); } - + return result; } - - + + /** * inverse hyperbolic cosine * @param d @@ -375,16 +371,15 @@ public final class MathX { 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 final class MathX { public static double atanh(double d) { return Math.log((1 + d)/(1 - d)) / 2; } - + /** * hyperbolic cosine * @param d @@ -400,10 +395,9 @@ public final class MathX { 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 final class MathX { 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 final class MathX { 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 temp = new ArrayList(); 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 @@ public class Mode implements Function { return new NumberEval(result); } - private static void collectValues(Eval arg, List temp) throws EvaluationException { + private static void collectValues(Eval arg, List temp) throws EvaluationException { if (arg instanceof AreaEval) { AreaEval ae = (AreaEval) arg; int width = ae.getWidth(); @@ -114,7 +114,7 @@ public class Mode implements Function { } - private static void collectValue(Eval arg, List temp, boolean mustBeNumber) + private static void collectValue(Eval arg, List temp, boolean mustBeNumber) throws EvaluationException { if (arg instanceof ErrorEval) { throw new EvaluationException((ErrorEval) arg); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java index b3feac6a07..30b72ee74f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/MultiOperandNumericFunction.java @@ -45,7 +45,6 @@ public abstract class MultiOperandNumericFunction implements Function { _isBlankCounted = isBlankCounted; } - static final double[] EMPTY_DOUBLE_ARRAY = { }; private static class DoubleList { @@ -102,7 +101,6 @@ public abstract class MultiOperandNumericFunction implements Function { protected abstract double evaluate(double[] values) throws EvaluationException; - /** * Maximum number of operands accepted by this function. * Subclasses may override to change default value. diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/N.java b/src/java/org/apache/poi/hssf/record/formula/functions/N.java deleted file mode 100644 index a5e65c334a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/N.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class N extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Na.java b/src/java/org/apache/poi/hssf/record/formula/functions/Na.java index eef0f45130..720b0c661f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Na.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Na.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.Eval; /** * Implementation of Excel function NA() - * + * * @author Josh Micich */ public final class Na implements Function { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Names.java b/src/java/org/apache/poi/hssf/record/formula/functions/Names.java deleted file mode 100644 index 476156a6f6..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Names.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Names extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Negbinomdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Negbinomdist.java deleted file mode 100644 index 0eb494bc2b..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Negbinomdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Negbinomdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Normdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Normdist.java deleted file mode 100644 index 3daca07365..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Normdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Normdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Norminv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Norminv.java deleted file mode 100644 index 4a5948245c..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Norminv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Norminv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Normsdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Normsdist.java deleted file mode 100644 index 84d8aca881..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Normsdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Normsdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Normsinv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Normsinv.java deleted file mode 100644 index 161da9bde5..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Normsinv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Normsinv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Not.java b/src/java/org/apache/poi/hssf/record/formula/functions/Not.java index b383e090df..46d1e7142a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Not.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Not.java @@ -45,7 +45,7 @@ public final class Not implements Function { } catch (EvaluationException e) { return e.getErrorEval(); } - + return BoolEval.valueOf(!boolArgVal); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java index 19643abf66..9c685d0f51 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/NotImplementedFunction.java @@ -21,15 +21,15 @@ import org.apache.poi.hssf.record.formula.eval.Eval; import org.apache.poi.ss.formula.eval.NotImplementedException; /** - * + * * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * 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 class NotImplementedFunction implements Function { public NotImplementedFunction(String name) { _functionName = name; } - + public Eval evaluate(Eval[] operands, int srcRow, short srcCol) { throw new NotImplementedException(_functionName); } + public String getFunctionName() { + return _functionName; + } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Note.java b/src/java/org/apache/poi/hssf/record/formula/functions/Note.java deleted file mode 100644 index 210770ad71..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Note.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Note extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Now.java b/src/java/org/apache/poi/hssf/record/formula/functions/Now.java index 70930a9dcb..528d7f98ab 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Now.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Now.java @@ -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 @@ public final class Now implements Function { 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)); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Npv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Npv.java deleted file mode 100644 index 9e57999d76..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Npv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Npv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Numberstring.java b/src/java/org/apache/poi/hssf/record/formula/functions/Numberstring.java deleted file mode 100644 index 51403415cd..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Numberstring.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Numberstring extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java index 9a702ee6a3..136cf36630 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/NumericFunction.java @@ -60,8 +60,7 @@ public abstract class NumericFunction implements Function { 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 abstract class NumericFunction implements Function { /* -------------------------------------------------------------------------- */ - public static final Function ABS = new OneArg() { protected double evaluate(double d) { return Math.abs(d); @@ -233,7 +231,6 @@ public abstract class NumericFunction implements Function { } }; - /* -------------------------------------------------------------------------- */ public static final Function ATAN2 = new TwoArg() { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java b/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java index 74eddac2de..4904c01d47 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Odd.java @@ -17,26 +17,22 @@ package org.apache.poi.hssf.record.formula.functions; - /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ 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; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java b/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java index 086596ae21..0fda540e3a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Offset.java @@ -29,10 +29,10 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * Implementation for Excel function OFFSET()

        - * - * 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.

        - * + * * Syntax:
        * OFFSET(reference, rows, cols, height, width)

        * reference is the base reference.
        @@ -40,16 +40,16 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; * cols is the number of columns left or right from the base reference.
        * height (default same height as base reference) is the row count for the returned area reference.
        * width (default same width as base reference) is the column count for the returned area reference.
        - * + * * @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 @@ public final class Offset implements Function { _offset = offset; _length = length; } - + public short getFirstIndex() { return (short) _offset; } @@ -75,13 +75,13 @@ public final class Offset implements Function { } /** * Moves the range by the specified translation amount.

        - * - * 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.

        - * + * * @param translationAmount may be zero negative or positive - * + * * @return the equivalent LinearOffsetRange with a positive length, moved by the * specified translationAmount. */ @@ -123,7 +123,7 @@ public final class Offset implements Function { private final int _height; private final RefEval _refEval; private final AreaEval _areaEval; - + public BaseRef(RefEval re) { _refEval = re; _areaEval = null; @@ -155,7 +155,7 @@ public final class Offset implements Function { 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 @@ public final class Offset implements Function { 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 @@ public final class Offset implements Function { } } - 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 @@ public final class Offset implements Function { } private static BaseRef evaluateBaseRef(Eval eval) throws EvaluationException { - + if(eval instanceof RefEval) { return new BaseRef((RefEval)eval); } @@ -239,10 +239,10 @@ public final class Offset implements Function { // 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(); } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Or.java b/src/java/org/apache/poi/hssf/record/formula/functions/Or.java index 2d36037f5d..bab77471ae 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Or.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Or.java @@ -18,7 +18,7 @@ package org.apache.poi.hssf.record.formula.functions; /** - * + * */ public final class Or extends BooleanFunction { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Pearson.java b/src/java/org/apache/poi/hssf/record/formula/functions/Pearson.java deleted file mode 100644 index dda597a259..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Pearson.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Pearson extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Percentile.java b/src/java/org/apache/poi/hssf/record/formula/functions/Percentile.java deleted file mode 100644 index a3f59f1a8e..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Percentile.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Percentile extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Percentrank.java b/src/java/org/apache/poi/hssf/record/formula/functions/Percentrank.java deleted file mode 100644 index a47e4ff13a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Percentrank.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Percentrank extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Permut.java b/src/java/org/apache/poi/hssf/record/formula/functions/Permut.java deleted file mode 100644 index e896f70f08..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Permut.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Permut extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java b/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java index 0713dc7ed6..d69015b148 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Pi.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ -public class Pi implements Function { +public final class Pi implements Function { private static final NumberEval PI_EVAL = new NumberEval(Math.PI); diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Poisson.java b/src/java/org/apache/poi/hssf/record/formula/functions/Poisson.java deleted file mode 100644 index f4aba4c7f1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Poisson.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Poisson extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ppmt.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ppmt.java deleted file mode 100644 index 4e36630b94..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ppmt.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ppmt extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Prob.java b/src/java/org/apache/poi/hssf/record/formula/functions/Prob.java deleted file mode 100644 index 12293687f1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Prob.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Prob extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Proper.java b/src/java/org/apache/poi/hssf/record/formula/functions/Proper.java deleted file mode 100644 index 26a8c3a90a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Proper.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Proper extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Quartile.java b/src/java/org/apache/poi/hssf/record/formula/functions/Quartile.java deleted file mode 100644 index ec81094f1f..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Quartile.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Quartile extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java index 4c180383d8..c9940fffed 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Rand.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ -public class Rand implements Function { +public final class Rand implements Function { public Eval evaluate(Eval[] operands, int srcRow, short srcCol) { ValueEval retval; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rank.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rank.java deleted file mode 100644 index 2bb13d3fec..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rank.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Rank extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rate.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rate.java deleted file mode 100644 index 485920c751..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rate.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Rate extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Reftext.java b/src/java/org/apache/poi/hssf/record/formula/functions/Reftext.java deleted file mode 100644 index 3ba7bc988a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Reftext.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Reftext extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Relref.java b/src/java/org/apache/poi/hssf/record/formula/functions/Relref.java deleted file mode 100644 index 7e7bee8df8..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Relref.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Relref extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java b/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java index 1dfc4f8f05..8ff69491c6 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Replace.java @@ -24,7 +24,7 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; import org.apache.poi.hssf.record.formula.eval.ValueEval; /** - * An implementation of the Excel REPLACE() function

        : + * An implementation of the Excel REPLACE() function:

        * Replaces part of a text string based on the number of characters * you specify, with another text string.
        * diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Replaceb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Replaceb.java deleted file mode 100644 index 93d05bf083..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Replaceb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Replaceb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rept.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rept.java deleted file mode 100644 index ce56e70d9d..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rept.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Rept extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Request.java b/src/java/org/apache/poi/hssf/record/formula/functions/Request.java deleted file mode 100644 index 23eeea5ce0..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Request.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Request extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Result.java b/src/java/org/apache/poi/hssf/record/formula/functions/Result.java deleted file mode 100644 index c15f2421e1..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Result.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Result extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rightb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rightb.java deleted file mode 100644 index 4ee99fdf04..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rightb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Rightb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Roman.java b/src/java/org/apache/poi/hssf/record/formula/functions/Roman.java deleted file mode 100644 index c2db7e86c6..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Roman.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Roman extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Row.java b/src/java/org/apache/poi/hssf/record/formula/functions/Row.java index d111d594b5..ac16401262 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Row.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Row.java @@ -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.NumberEval; 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 @@ public class Row implements Function { 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; } - + } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java index aabffab2f6..9f331f47d7 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Rows.java @@ -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 @@ import org.apache.poi.hssf.record.formula.eval.RefEval; /** * Implementation for Excel ROWS function. - * + * * @author Josh Micich */ public final class Rows implements Function { @@ -44,16 +43,16 @@ public final class Rows implements Function { 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); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Rsq.java b/src/java/org/apache/poi/hssf/record/formula/functions/Rsq.java deleted file mode 100644 index f1addc391f..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Rsq.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Rsq extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Search.java b/src/java/org/apache/poi/hssf/record/formula/functions/Search.java deleted file mode 100644 index 351495c6ce..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Search.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Search extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Searchb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Searchb.java deleted file mode 100644 index 3dfa711ab6..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Searchb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Searchb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Second.java b/src/java/org/apache/poi/hssf/record/formula/functions/Second.java deleted file mode 100644 index 3ebd5534a7..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Second.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Second extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Series.java b/src/java/org/apache/poi/hssf/record/formula/functions/Series.java deleted file mode 100644 index 3e60685936..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Series.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Series extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Setname.java b/src/java/org/apache/poi/hssf/record/formula/functions/Setname.java deleted file mode 100644 index 5f01782027..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Setname.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Setname extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Setvalue.java b/src/java/org/apache/poi/hssf/record/formula/functions/Setvalue.java deleted file mode 100644 index c86e65e80c..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Setvalue.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Setvalue extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Skew.java b/src/java/org/apache/poi/hssf/record/formula/functions/Skew.java deleted file mode 100644 index bb6d259fb0..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Skew.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Skew extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Sln.java b/src/java/org/apache/poi/hssf/record/formula/functions/Sln.java deleted file mode 100644 index dfb81768c4..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Sln.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Sln extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Slope.java b/src/java/org/apache/poi/hssf/record/formula/functions/Slope.java deleted file mode 100644 index fb631f5649..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Slope.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Slope extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Standardize.java b/src/java/org/apache/poi/hssf/record/formula/functions/Standardize.java deleted file mode 100644 index 6fa1df51cf..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Standardize.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Standardize extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java b/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java index e78f38caaa..2cc4a78f37 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/StatsLib.java @@ -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 @@ import java.util.Arrays; * * 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 @@ public final class StatsLib { 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 @@ public final class StatsLib { } 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 @@ public final class StatsLib { ? (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 @@ public final class StatsLib { for (int i=0; i * 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 final class StatsLib { */ 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; } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Stdeva.java b/src/java/org/apache/poi/hssf/record/formula/functions/Stdeva.java deleted file mode 100644 index 50306a2d69..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Stdeva.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Stdeva extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Stdevp.java b/src/java/org/apache/poi/hssf/record/formula/functions/Stdevp.java deleted file mode 100644 index c270c3c7f9..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Stdevp.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Stdevp extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Stdevpa.java b/src/java/org/apache/poi/hssf/record/formula/functions/Stdevpa.java deleted file mode 100644 index 2554b22014..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Stdevpa.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Stdevpa extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Step.java b/src/java/org/apache/poi/hssf/record/formula/functions/Step.java deleted file mode 100644 index 3febcca471..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Step.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Step extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Steyx.java b/src/java/org/apache/poi/hssf/record/formula/functions/Steyx.java deleted file mode 100644 index d92f3ef405..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Steyx.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Steyx extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java b/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java index b00d7510e3..2cd3a719c4 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Substitute.java @@ -24,7 +24,7 @@ import org.apache.poi.hssf.record.formula.eval.StringEval; import org.apache.poi.hssf.record.formula.eval.ValueEval; /** - * An implementation of the SUBSTITUTE function: + * An implementation of the SUBSTITUTE function:

        * Substitutes text in a text string with new text, some number of times. * @author Manda Wilson < wilson at c bio dot msk cc dot org > */ diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Subtotal.java b/src/java/org/apache/poi/hssf/record/formula/functions/Subtotal.java deleted file mode 100644 index ddfa3ad12a..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Subtotal.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Subtotal extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java b/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java index 5255cda285..8eb2565d89 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Sumif.java @@ -28,7 +28,7 @@ import org.apache.poi.hssf.record.formula.functions.CountUtils.I_MatchPredicate; /** * Implementation for the Excel function SUMIF

        - * + * * Syntax :
        * SUMIF ( range, criteria, sum_range )
        * @@ -45,12 +45,12 @@ public final class Sumif implements Function { 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 @@ public final class Sumif implements Function { 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 - * + * * Syntax :
        * SUMPRODUCT ( array1[, array2[, array3[, ...]]]) *
        - * *
        array1, ... arrayN  typically area references, + *
        array1, ... arrayN  typically area references, * possibly cell references or scalar values

        - * - * Let An(i,j) represent the element in the ith row jth column - * of the nth array
        - * Assuming each array has the same dimensions (W, H), the result is defined as:
        + * + * Let An(i,j) represent the element in the ith row jth column + * of the nth array
        + * Assuming each array has the same dimensions (W, H), the result is defined as:
        * SUMPRODUCT = Σi: 1..H   * (  Σj: 1..W   - * (  Πn: 1..N + * (  Πn: 1..N * An(i,j)  * )  - * ) + * ) *

        * @author Josh Micich */ @@ -56,9 +55,9 @@ public final class Sumproduct implements Function { public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) { - + int maxN = args.length; - + if(maxN < 1) { return ErrorEval.VALUE_INVALID; } @@ -80,7 +79,7 @@ public final class Sumproduct implements Function { } catch (EvaluationException e) { return e.getErrorEval(); } - throw new RuntimeException("Invalid arg type for SUMPRODUCT: (" + throw new RuntimeException("Invalid arg type for SUMPRODUCT: (" + firstArg.getClass().getName() + ")"); } @@ -96,7 +95,7 @@ public final class Sumproduct implements Function { } private static double getScalarValue(Eval arg) throws EvaluationException { - + Eval eval; if (arg instanceof RefEval) { RefEval re = (RefEval) arg; @@ -104,7 +103,7 @@ public final class Sumproduct implements Function { } else { eval = arg; } - + if (eval == null) { throw new RuntimeException("parameter may not be null"); } @@ -118,10 +117,10 @@ public final class Sumproduct implements Function { } if (!(eval instanceof ValueEval)) { - throw new RuntimeException("Unexpected value eval class (" + throw new RuntimeException("Unexpected value eval class (" + eval.getClass().getName() + ")"); } - + return getProductTerm((ValueEval) eval, true); } @@ -135,15 +134,15 @@ public final class Sumproduct implements Function { return ErrorEval.VALUE_INVALID; } - + AreaEval firstArg = args[0]; - + int height = firstArg.getHeight(); int width = firstArg.getWidth(); // TODO - junit - + // first check dimensions if (!areasAllSameSize(args, height, width)) { - // normally this results in #VALUE!, + // normally this results in #VALUE!, // but errors in individual cells take precedence for (int i = 1; i < args.length; i++) { throwFirstError(args[i]); @@ -152,7 +151,7 @@ public final class Sumproduct implements Function { } double acc = 0; - + for (int rrIx=0; rrIxdouble value for the specified ValueEval. + * Determines a double value for the specified ValueEval. * @param isScalarProduct false for SUMPRODUCTs over area refs. * @throws EvaluationException if ve represents an error value. *

        - * Note - string values and empty cells are interpreted differently depending on + * Note - string values and empty cells are interpreted differently depending on * isScalarProduct. For scalar products, if any term is blank or a string, the * error (#VALUE!) is raised. For area (sum)products, if any term is blank or a string, the * result is zero. @@ -215,7 +214,7 @@ public final class Sumproduct implements Function { } return 0; } - + if(ve instanceof ErrorEval) { throw new EvaluationException((ErrorEval)ve); } @@ -231,7 +230,7 @@ public final class Sumproduct implements Function { NumericValueEval nve = (NumericValueEval) ve; return nve.getNumberValue(); } - throw new RuntimeException("Unexpected value eval class (" + throw new RuntimeException("Unexpected value eval class (" + ve.getClass().getName() + ")"); } } diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java b/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java index 4dedf26574..b271169666 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java @@ -20,14 +20,14 @@ package org.apache.poi.hssf.record.formula.functions; /** * Implementation of Excel function SUMX2MY2()

        - * + * * Calculates the sum of differences of squares in two arrays of the same size.
        * Syntax:
        * SUMX2MY2(arrayX, arrayY)

        - * + * * result = Σi: 0..n(xi2-yi2) - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > + * + * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumx2my2 extends XYNumericFunction { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java b/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java index c3af0bd380..3cedca35e2 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java @@ -20,14 +20,14 @@ package org.apache.poi.hssf.record.formula.functions; /** * Implementation of Excel function SUMX2PY2()

        - * + * * Calculates the sum of squares in two arrays of the same size.
        * Syntax:
        * SUMX2PY2(arrayX, arrayY)

        - * + * * result = Σi: 0..n(xi2+yi2) - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > + * + * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumx2py2 extends XYNumericFunction { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java b/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java index 4fa11e36ba..bb95c9fdf6 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java @@ -19,14 +19,14 @@ package org.apache.poi.hssf.record.formula.functions; /** * Implementation of Excel function SUMXMY2()

        - * + * * Calculates the sum of squares of differences between two arrays of the same size.
        * Syntax:
        * SUMXMY2(arrayX, arrayY)

        - * + * * result = Σi: 0..n(xi-yi)2 - * - * @author Amol S. Deshmukh < amolweb at ya hoo dot com > + * + * @author Amol S. Deshmukh < amolweb at ya hoo dot com > */ public final class Sumxmy2 extends XYNumericFunction { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Syd.java b/src/java/org/apache/poi/hssf/record/formula/functions/Syd.java deleted file mode 100644 index 45347f2d51..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Syd.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Syd extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/T.java b/src/java/org/apache/poi/hssf/record/formula/functions/T.java index b322cd985c..9d764c33bc 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/T.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/T.java @@ -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.ErrorEval; @@ -39,12 +36,12 @@ public final class T implements Function { RefEval re = (RefEval) arg; arg = re.getInnerValueEval(); } - + if (arg instanceof StringEval) { // Text values are returned unmodified return arg; } - + if (arg instanceof ErrorEval) { // Error values also returned unmodified return arg; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Tdist.java b/src/java/org/apache/poi/hssf/record/formula/functions/Tdist.java deleted file mode 100644 index d2a76de2eb..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Tdist.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Tdist extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Text.java b/src/java/org/apache/poi/hssf/record/formula/functions/Text.java deleted file mode 100644 index 833fa82d00..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Text.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Text extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java index be269d93dc..5fd758962d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java @@ -54,7 +54,7 @@ public abstract class TextFunction implements Function { protected abstract ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException; /* ---------------------------------------------------------------------- */ - + private static abstract class SingleArgTextFunc extends TextFunction { protected SingleArgTextFunc() { @@ -102,10 +102,10 @@ public abstract class TextFunction implements Function { * An implementation of the MID function
        * MID returns a specific number of * characters from a text string, starting at the specified position.

        - * + * * Syntax:
        MID(text, start_num, * num_chars)
        - * + * * Author: Manda Wilson < wilson at c bio dot msk cc dot org > */ public static final Function MID = new TextFunction() { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Textref.java b/src/java/org/apache/poi/hssf/record/formula/functions/Textref.java deleted file mode 100644 index 8fa2514f68..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Textref.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Textref extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Time.java b/src/java/org/apache/poi/hssf/record/formula/functions/Time.java index 764e166436..1ddb8516ff 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Time.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Time.java @@ -43,7 +43,7 @@ public final class Time implements Function { return ErrorEval.VALUE_INVALID; } double result; - + try { result = evaluate(evalArg(args[0]), evalArg(args[1]), evalArg(args[2])); } catch (EvaluationException e) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Timevalue.java b/src/java/org/apache/poi/hssf/record/formula/functions/Timevalue.java deleted file mode 100644 index 049bd30ff0..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Timevalue.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Timevalue extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Tinv.java b/src/java/org/apache/poi/hssf/record/formula/functions/Tinv.java deleted file mode 100644 index dab7dcd0e0..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Tinv.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Tinv extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Today.java b/src/java/org/apache/poi/hssf/record/formula/functions/Today.java index b707412136..b71fce4611 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Today.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Today.java @@ -27,10 +27,10 @@ import org.apache.poi.hssf.usermodel.HSSFDateUtil; /** * Implementation of Excel TODAY() Function
        - * + * * @author Frank Taffelt */ -public class Today implements Function { +public final class Today implements Function { public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) { if (evals.length > 0) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Transpose.java b/src/java/org/apache/poi/hssf/record/formula/functions/Transpose.java deleted file mode 100644 index cd414ff1c8..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Transpose.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Transpose extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Trend.java b/src/java/org/apache/poi/hssf/record/formula/functions/Trend.java deleted file mode 100644 index 80cece928c..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Trend.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Trend extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Trimmean.java b/src/java/org/apache/poi/hssf/record/formula/functions/Trimmean.java deleted file mode 100644 index 4775a9ee90..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Trimmean.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Trimmean extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/True.java b/src/java/org/apache/poi/hssf/record/formula/functions/True.java index 78df7776a1..429cc5f0d5 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/True.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/True.java @@ -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.BoolEval; @@ -27,9 +24,9 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ -public class True implements Function { +public final class True implements Function { public Eval evaluate(Eval[] operands, int srcRow, short srcCol) { ValueEval retval; diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Trunc.java b/src/java/org/apache/poi/hssf/record/formula/functions/Trunc.java deleted file mode 100644 index 65fedd126d..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Trunc.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Trunc extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ttest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ttest.java deleted file mode 100644 index b453043c13..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ttest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ttest extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Type.java b/src/java/org/apache/poi/hssf/record/formula/functions/Type.java deleted file mode 100644 index 423038211f..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Type.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Type extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Usdollar.java b/src/java/org/apache/poi/hssf/record/formula/functions/Usdollar.java deleted file mode 100644 index 3baf71c9b3..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Usdollar.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Usdollar extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Value.java b/src/java/org/apache/poi/hssf/record/formula/functions/Value.java index 84f61db98e..0dbfdb52de 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Value.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Value.java @@ -26,14 +26,14 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; /** * Implementation for Excel VALUE() function.

        - * + * * Syntax:
        VALUE(text)
        - * + * * Converts the text argument to a number. Leading and/or trailing whitespace is * ignored. Currency symbols and thousands separators are stripped out. * Scientific notation is also supported. If the supplied text does not convert * properly the result is #VALUE! error. Blank string converts to zero. - * + * * @author Josh Micich */ public final class Value implements Function { @@ -61,8 +61,8 @@ public final class Value implements Function { } /** - * TODO see if the same functionality is needed in {@link OperandResolver#parseDouble(String)} - * + * TODO see if the same functionality is needed in {@link OperandResolver#parseDouble(String)} + * * @return null if there is any problem converting the text */ private static Double convertTextToNumber(String strText) { @@ -156,7 +156,7 @@ public final class Value implements Function { lastThousandsSeparatorIndex = i; // don't append ',' continue; - + case 'E': case 'e': if (i - lastThousandsSeparatorIndex < MIN_DISTANCE_BETWEEN_THOUSANDS_SEPARATOR) { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Var.java b/src/java/org/apache/poi/hssf/record/formula/functions/Var.java deleted file mode 100644 index 2b0a3b67c7..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Var.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Var extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Vara.java b/src/java/org/apache/poi/hssf/record/formula/functions/Vara.java deleted file mode 100644 index c484c5a9ea..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Vara.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Vara extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Varp.java b/src/java/org/apache/poi/hssf/record/formula/functions/Varp.java deleted file mode 100644 index e8c8bd30dc..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Varp.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Varp extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Varpa.java b/src/java/org/apache/poi/hssf/record/formula/functions/Varpa.java deleted file mode 100644 index 290b97de89..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Varpa.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Varpa extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Vdb.java b/src/java/org/apache/poi/hssf/record/formula/functions/Vdb.java deleted file mode 100644 index 5fb594d6ee..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Vdb.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Vdb extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java b/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java index 28923c0f37..27d16ee867 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java @@ -26,22 +26,22 @@ import org.apache.poi.hssf.record.formula.eval.ValueEval; import org.apache.poi.hssf.record.formula.functions.LookupUtils.ValueVector; /** * Implementation of the VLOOKUP() function.

        - * + * * VLOOKUP finds a row in a lookup table by the first column value and returns the value from another column.
        - * + * * Syntax:
        * VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)

        - * + * * lookup_value The value to be found in the first column of the table array.
        * table_array An area reference for the lookup data.
        * col_index_num a 1 based index specifying which column value of the lookup data will be returned.
        - * range_lookup If TRUE (default), VLOOKUP finds the largest value less than or equal to - * the lookup_value. If FALSE, only exact matches will be considered
        - * + * range_lookup If TRUE (default), VLOOKUP finds the largest value less than or equal to + * the lookup_value. If FALSE, only exact matches will be considered
        + * * @author Josh Micich */ public final class Vlookup implements Function { - + public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) { Eval arg3 = null; switch(args.length) { @@ -71,9 +71,9 @@ public final class Vlookup implements Function { /** * Returns one column from an AreaEval - * + * * @param colIndex assumed to be non-negative - * + * * @throws EvaluationException (#REF!) if colIndex is too high */ private ValueVector createResultColumnVector(AreaEval tableArray, int colIndex) throws EvaluationException { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Volatile.java b/src/java/org/apache/poi/hssf/record/formula/functions/Volatile.java deleted file mode 100644 index 734eb0fbe7..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Volatile.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Volatile extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Weekday.java b/src/java/org/apache/poi/hssf/record/formula/functions/Weekday.java deleted file mode 100644 index 7de5f952b3..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Weekday.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Weekday extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Weibull.java b/src/java/org/apache/poi/hssf/record/formula/functions/Weibull.java deleted file mode 100644 index b2a4895fad..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Weibull.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Weibull extends NotImplementedFunction { - -} diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java b/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java index 1d83b363fd..5c80068fff 100644 --- a/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java +++ b/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java @@ -28,7 +28,7 @@ import org.apache.poi.hssf.record.formula.functions.LookupUtils.ValueVector; /** * @author Amol S. Deshmukh < amolweb at ya hoo dot com > - * + * */ public abstract class XYNumericFunction implements Function { diff --git a/src/java/org/apache/poi/hssf/record/formula/functions/Ztest.java b/src/java/org/apache/poi/hssf/record/formula/functions/Ztest.java deleted file mode 100644 index ed12b63328..0000000000 --- a/src/java/org/apache/poi/hssf/record/formula/functions/Ztest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* -* 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 - * - */ -package org.apache.poi.hssf.record.formula.functions; - -public class Ztest extends NotImplementedFunction { - -} diff --git a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java index d957185249..783294e9d3 100644 --- a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java +++ b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java @@ -458,54 +458,6 @@ public class TestMathX extends AbstractNumericTestCase { } - public void testSumproduct() { - double d = 0; - double[][] darr = new double[][] - {{0 ,0.11 ,23.23}, - {1 ,0.22 ,46.46}, - {2 ,0.33 ,69.69}, - {3 ,0.44 ,92.92}, - {4 ,0.55 ,116.15}, - {5 ,0.66 ,139.38}, - {6 ,0.77 ,162.61}, - {7 ,0.88 ,185.84}, - {8 ,0.99 ,209.07}, - {9 ,1.1 ,232.3}, - {10 ,1.21 ,255.53}}; - d = MathX.sumproduct(darr); - assertEquals("Sumproduct ", 4.243234425E+22, d); - darr = new double[][] - {{0 ,0.11 ,23.23}, - {0 ,0.22 ,46.46}, - {0 ,0.33 ,69.69}, - {0 ,0.44 ,92.92}, - {0 ,0.55 ,116.15}, - {0 ,0.66 ,139.38}, - {0 ,0.77 ,162.61}, - {0 ,0.88 ,185.84}, - {0 ,0.99 ,209.07}, - {0 ,1.1 ,232.3}, - {0 ,1.21 ,255.53}}; - d = MathX.sumproduct(darr); - assertEquals("Sumproduct ", 4.243234425E+22, d); - - darr = new double[][] - {{0, 0, 0, 0, 0, 0, 0, 0}, - {0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88}, - {23.23, 46.46, 69.69, 92.92, 116.15, 139.38, 162.61, 185.84}}; - d = MathX.sumproduct(darr); - assertEquals("Sumproduct ", 0, d); - - darr = new double[][] - {{0, 1, 2, 3, 4, 5, 6, 7}, - {0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88}, - {23.23, 46.46, 69.69, 92.92, 116.15, 139.38, 162.61, 185.84}}; - d = MathX.sumproduct(darr); - assertEquals("Sumproduct ", 2790.3876, d); - - - } - public void testSumsq() { double[] d = new double[100]; d[0] = 1.1; d[1] = 2.1; d[2] = 3.1; d[3] = 4.1; -- 2.39.5