aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/fo/expr/FloorFunction.java
blob: 868067bd721bc68d1ebe6882143eb5de59c4922b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * $Id$
 * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
 * For details on use and redistribution please refer to the
 * LICENSE file included with these sources.
 */

package org.apache.fop.fo.expr;

import org.apache.fop.fo.Property;
import org.apache.fop.fo.NumberProperty;


class FloorFunction extends FunctionBase {

    public int nbArgs() {
        return 1;
    }

    public Property eval(Property[] args,
                         PropertyInfo pInfo) throws PropertyException {
        Number dbl = args[0].getNumber();
        if (dbl == null)
            throw new PropertyException("Non number operand to floor function");
        return new NumberProperty(Math.floor(dbl.doubleValue()));
    }

}