// enforce singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) {
return ErrorEval.VALUE_INVALID;
}
// enforces singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) {
return ErrorEval.VALUE_INVALID;
}
// enforce singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
// enforces singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if(args.length != 2) {
return ErrorEval.VALUE_INVALID;
}
* Blank < Positive numbers
* </pre>
*/
- public final ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public final ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
if (operands.length != 2) {
return ErrorEval.VALUE_INVALID;
}
return OperandResolver.coerceValueToDouble(ve);
}
- public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result;
try {
double d0 = singleOperandEvaluate(args[0], srcCellRow, srcCellCol);
// enforce singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
// enforce singleton
}
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public abstract class BooleanFunction implements Function {
- public final ValueEval evaluate(ValueEval[] args, int srcRow, short srcCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcRow, int srcCol) {
if (args.length < 1) {
return ErrorEval.VALUE_INVALID;
}
_needsOneBaseAdjustment = needsOneBaseAdjustment;
}
- public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class Choose implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
+ public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length < 2) {
return ErrorEval.VALUE_INVALID;
}
import org.apache.poi.hssf.record.formula.eval.ValueEval;
public final class Column implements Function {
- public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
ValueEval retval = null;
int cnum = -1;
*/
public final class Columns implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) {
case 1:
// expected
*/
public final class Count implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length;
if (nArgs < 1) {
// too few arguments
*/
public final class Counta implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length;
if (nArgs < 1) {
// too few arguments
*/
public final class Countblank implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
+ public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length != 1) {
// TODO - it doesn't seem to be possible to enter COUNTBLANK() into Excel with the wrong arg count
// perhaps this should be an exception
}
}
- public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
+ public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
switch(args.length) {
case 2:
// expected
*/
public final class Errortype implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
try {
OperandResolver.getSingleValue(args[0], srcCellRow, srcCellCol);
*/
public final class False implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval;
switch (operands.length) {
default:
*/
public final class Find extends TextFunction {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
int nArgs = args.length;
* numeric functions evaluate to {@link Double#NaN} be sure to translate the result to {@link
* ErrorEval#NUM_ERROR}.
*/
- ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex);
+ ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex);
}
*/
public final class Hlookup implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval arg3 = null;
switch(args.length) {
case 4:
*/
public final class Hyperlink implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
int lastArgIx = operands.length - 1;
if (lastArgIx < 0 || lastArgIx > 1) {
return ErrorEval.VALUE_INVALID;
*/
public final class If implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval falseResult;
switch (args.length) {
case 3:
*/
public final class Index implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int nArgs = args.length;
if(nArgs < 2) {
// too few arguments
* @return the resolved 1-based index. Zero if the arg was missing or blank
* @throws EvaluationException if the arg is an error value evaluates to a negative numeric value
*/
- private static int resolveIndexArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static int resolveIndexArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ev = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
if (ev == MissingArgEval.instance) {
*/
public final class IsError implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class IsNa implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class Isblank implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
*/
public final class Isref implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) {
return ErrorEval.VALUE_INVALID;
}
return retval;
}
- public final ValueEval evaluate(ValueEval[] operands, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] operands, int srcCellRow, int srcCellCol) {
if (operands.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class Lookup implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) {
case 3:
break;
* @return
* @throws EvaluationException
*/
- public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ public static boolean resolveRangeLookupArg(ValueEval rangeLookupArg, int srcCellRow, int srcCellCol) throws EvaluationException {
if(rangeLookupArg == null) {
// range_lookup arg not provided
return true; // default is TRUE
public final class Match implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double match_type = 1; // default
- private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, short srcCellCol)
+ private static double evaluateMatchTypeArg(ValueEval arg, int srcCellRow, int srcCellCol)
throws EvaluationException {
ValueEval match_type = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
}
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result;
try {
List<Double> temp = new ArrayList<Double>();
private static final int DEFAULT_MAX_NUM_OPERANDS = 30;
- public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double d;
try {
*/
public final class Na implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
return ErrorEval.NA;
}
*/
public final class Not implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
_functionName = name;
}
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
throw new NotImplementedException(_functionName);
}
public String getFunctionName() {
*/
public final class Now implements Function {
- public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
if (evals.length > 0) {
return ErrorEval.VALUE_INVALID;
}
static final double TEN = 10.0;
static final double LOG_10_TO_BASE_e = Math.log(TEN);
- protected static final double singleOperandEvaluate(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected static final double singleOperandEvaluate(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
double result = OperandResolver.coerceValueToDouble(ve);
checkValue(result);
}
}
- public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
double result;
try {
result = eval(args, srcCellRow, srcCellCol);
return new NumberEval(result);
}
- protected abstract double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
+ protected abstract double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException;
/* -------------------------------------------------------------------------- */
// intermediate sub-classes (one-arg, two-arg and multi-arg)
protected OneArg() {
// no fields to initialise
}
- protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
if (args.length != 1) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
protected TwoArg() {
// no fields to initialise
}
- protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
if (args.length != 2) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
_minArgs = minArgs;
_maxArgs = maxArgs;
}
- protected final double eval(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected final double eval(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException {
int nArgs = args.length;
if (nArgs < _minArgs || nArgs > _maxArgs) {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
}
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if(args.length < 3 || args.length > 5) {
return ErrorEval.VALUE_INVALID;
}
/**
* OFFSET's numeric arguments (2..5) have similar processing rules
*/
- private static int evaluateIntArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static int evaluateIntArg(ValueEval eval, int srcCellRow, int srcCellCol) throws EvaluationException {
double d = evaluateDoubleArg(eval, srcCellRow, srcCellCol);
return convertDoubleToInt(d);
return (int)Math.floor(d);
}
- private static double evaluateDoubleArg(ValueEval eval, int srcCellRow, short srcCellCol) throws EvaluationException {
+ private static double evaluateDoubleArg(ValueEval eval, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcCellRow, srcCellCol);
if (ve instanceof NumericValueEval) {
private static final NumberEval PI_EVAL = new NumberEval(Math.PI);
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval;
switch (operands.length) {
default:
*/
public final class Rand implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval;
switch (operands.length) {
default:
*/
public final class Replace extends TextFunction {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length != 4) {
return ErrorEval.VALUE_INVALID;
public final class Row implements Function {
- public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
ValueEval retval = null;
int rnum = -1;
*/
public final class Rows implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch(args.length) {
case 1:
// expected
*/
public final class Substitute extends TextFunction {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length < 3 || args.length > 4) {
return ErrorEval.VALUE_INVALID;
*/
public final class Sumif implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcRowIndex, short srcColumnIndex) {
+ public ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
if (args.length < 2) {
return ErrorEval.VALUE_INVALID;
}
public final class Sumproduct implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
int maxN = args.length;
public final class T implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
switch (args.length) {
default:
return ErrorEval.VALUE_INVALID;
protected static final String EMPTY_STRING = "";
- protected static final String evaluateStringArg(ValueEval eval, int srcRow, short srcCol) throws EvaluationException {
+ protected static final String evaluateStringArg(ValueEval eval, int srcRow, int srcCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(eval, srcRow, srcCol);
return OperandResolver.coerceValueToString(ve);
}
- protected static final int evaluateIntArg(ValueEval arg, int srcCellRow, short srcCellCol) throws EvaluationException {
+ protected static final int evaluateIntArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException {
ValueEval ve = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
return OperandResolver.coerceValueToInt(ve);
}
- public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
try {
return evaluateFunc(args, srcCellRow, srcCellCol);
} catch (EvaluationException e) {
}
}
- protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
+ protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException;
/* ---------------------------------------------------------------------- */
protected SingleArgTextFunc() {
// no fields to initialise
}
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
*/
public static final Function MID = new TextFunction() {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length != 3) {
return ErrorEval.VALUE_INVALID;
protected LeftRight(boolean isLeft) {
_isLeft = isLeft;
}
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
public static final Function CONCATENATE = new TextFunction() {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
StringBuffer sb = new StringBuffer();
for (int i=0, iSize=args.length; i<iSize; i++) {
public static final Function EXACT = new TextFunction() {
- protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, short srcCellCol)
+ protected ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)
throws EvaluationException {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
private static final int SECONDS_PER_DAY = HOURS_PER_DAY * SECONDS_PER_HOUR;
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 3) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class Today implements Function {
- public ValueEval evaluate(ValueEval[] evals, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] evals, int srcCellRow, int srcCellCol) {
if (evals.length > 0) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class True implements Function {
- public ValueEval evaluate(ValueEval[] operands, int srcRow, short srcCol) {
+ public ValueEval evaluate(ValueEval[] operands, int srcRow, int srcCol) {
ValueEval retval;
switch (operands.length) {
default:
private static final int MIN_DISTANCE_BETWEEN_THOUSANDS_SEPARATOR = 4;
private static final Double ZERO = new Double(0.0);
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 1) {
return ErrorEval.VALUE_INVALID;
}
*/
public final class Vlookup implements Function {
- public ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
ValueEval arg3 = null;
switch(args.length) {
case 4:
*/
protected abstract Accumulator createAccumulator();
- public final ValueEval evaluate(ValueEval[] args, int srcCellRow, short srcCellCol) {
+ public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol) {
if (args.length != 2) {
return ErrorEval.VALUE_INVALID;
}