Package org.boris.expr.function.excel

Source Code of org.boris.expr.function.excel.TIME

package org.boris.expr.function.excel;

import org.boris.expr.Expr;
import org.boris.expr.ExprDouble;
import org.boris.expr.ExprError;
import org.boris.expr.ExprException;
import org.boris.expr.ExprNumber;
import org.boris.expr.function.AbstractFunction;
import org.boris.expr.util.ExcelDate;

public class TIME extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 3);
        Expr eH = evalArg(args[0]);
        if (!isNumber(eH))
            return ExprError.VALUE;
        double h = ((ExprNumber) eH).doubleValue();
        Expr eM = evalArg(args[1]);
        if (!isNumber(eM))
            return ExprError.VALUE;
        double m = ((ExprNumber) eM).doubleValue();
        Expr eS = evalArg(args[1]);
        if (!isNumber(eS))
            return ExprError.VALUE;
        double s = ((ExprNumber) eS).doubleValue();
        double r = ExcelDate.time(h, m, s);
        if (r < 0)
            return ExprError.NUM;
        return new ExprDouble(r);
    }
}
TOP

Related Classes of org.boris.expr.function.excel.TIME

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.