FileDocCategorySizeDatePackage
UnaryMinusEval.javaAPI DocApache Poi 3.0.12803Sun Mar 11 12:59:28 GMT 2007org.apache.poi.hssf.record.formula.eval

UnaryMinusEval

public class UnaryMinusEval extends NumericOperationEval
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
private UnaryMinusPtg
delegate
private static final ValueEvalToNumericXlator
NUM_XLATOR
Constructors Summary
public UnaryMinusEval(Ptg ptg)



       
        this.delegate = (UnaryMinusPtg) ptg;
    
Methods Summary
public Evalevaluate(Eval[] operands, int srcRow, short srcCol)

        ValueEval retval = null;
        double d = 0;
        
        switch (operands.length) {
        default:
            retval = ErrorEval.UNKNOWN_ERROR;
            break;
        case 1:
            ValueEval ve = singleOperandEvaluate(operands[0], srcRow, srcCol);
            if (ve instanceof NumericValueEval) {
                d = ((NumericValueEval) ve).getNumberValue();
            }
            else if (ve instanceof BlankEval) {
                // do nothing
            }
            else if (ve instanceof ErrorEval) {
                retval = ve;
            }
        }
        
        if (retval == null) {
            retval = new NumberEval(-d);
        }

        return retval;
    
public intgetNumberOfOperands()

        return delegate.getNumberOfOperands();
    
public intgetType()

        return delegate.getType();
    
protected ValueEvalToNumericXlatorgetXlator()

        return NUM_XLATOR;