svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / numeric / CeilFunction.java @ 43983
History | View | Annotate | Download (1.3 KB)
1 | 43512 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.numeric; |
---|---|---|---|
2 | |||
3 | import org.apache.commons.lang3.Range; |
||
4 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
5 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
6 | |||
7 | public class CeilFunction extends AbstractFunction { |
||
8 | |||
9 | public CeilFunction() {
|
||
10 | 43983 | jjdelcerro | super("Numeric", "CEIL", Range.is(1), |
11 | "Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer. Special cases:\n" +
|
||
12 | "- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.\n" +
|
||
13 | "- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.\n" +
|
||
14 | "- If the argument value is less than zero but greater than -1.0, then the result is negative zero.\n" +
|
||
15 | "Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).",
|
||
16 | "CEIL({{a}})",
|
||
17 | new String[]{ |
||
18 | "a - a value."
|
||
19 | }, |
||
20 | "Double"
|
||
21 | ); |
||
22 | 43512 | jjdelcerro | this.addAlias("CEILING"); |
23 | } |
||
24 | |||
25 | @Override
|
||
26 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) { |
27 | 43512 | jjdelcerro | double r = Math.ceil(getDouble(args, 0)); |
28 | return r;
|
||
29 | } |
||
30 | |||
31 | |||
32 | } |