FileDocCategorySizeDatePackage
BooleanFunction.javaAPI DocApache Poi 3.0.13499Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hssf.record.formula.functions

BooleanFunction

public abstract class BooleanFunction extends Object implements Function
author
Amol S. Deshmukh < amolweb at ya hoo dot com > Here are the general rules concerning Boolean functions:
  1. Blanks are not either true or false
  2. Strings are not either true or false (even strings "true" or "TRUE" or "0" etc.)
  3. Numbers: 0 is false. Any other number is TRUE.
  4. References are evaluated and above rules apply.
  5. Areas: Individual cells in area are evaluated and checked to see if they are blanks, strings etc.

Fields Summary
Constructors Summary
Methods Summary
private org.apache.poi.hssf.record.formula.eval.ValueEvalinternalResolve(org.apache.poi.hssf.record.formula.eval.Eval ve, boolean stringsAreBlanks)

        ValueEval retval = null;
        
        // blankeval is returned as is
        if (ve instanceof BlankEval) {
            retval = BlankEval.INSTANCE;
        }
        
        // stringeval
        else if (ve instanceof StringEval) {
            retval = stringsAreBlanks ? (ValueEval) BlankEval.INSTANCE : (StringEval) ve;
        }
        
        // bools are bools :)
        else if (ve instanceof BoolEval) {
            retval = (BoolEval) ve;
        }
        
        // convert numbers to bool
        else if (ve instanceof NumericValueEval) {
            NumericValueEval ne = (NumericValueEval) ve;
            double d = ne.getNumberValue();
            retval = Double.isNaN(d) 
                    ? (ValueEval) ErrorEval.VALUE_INVALID
                    : (d != 0) 
                        ? BoolEval.TRUE
                        : BoolEval.FALSE;
        }
        
        // since refevals
        else {
            retval = ErrorEval.VALUE_INVALID;
        }
        
        return retval;
        
    
protected org.apache.poi.hssf.record.formula.eval.ValueEvalsingleOperandEvaluate(org.apache.poi.hssf.record.formula.eval.Eval eval, int srcRow, short srcCol, boolean stringsAreBlanks)

        ValueEval retval;
        
        if (eval instanceof RefEval) {
            RefEval re = (RefEval) eval;
            ValueEval ve = re.getInnerValueEval();
            retval = internalResolve(ve, true);
        }
        else {
            retval = internalResolve(eval, stringsAreBlanks);
        }
        
        return retval;