Statistics
| Revision:

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 / programming / PrintFunction.java @ 44207

History | View | Annotate | Download (1.05 KB)

1 44138 jjdelcerro
package org.gvsig.expressionevaluator.impl.function.programming;
2 43512 jjdelcerro
3 44138 jjdelcerro
import java.util.Objects;
4 43512 jjdelcerro
import org.apache.commons.lang3.Range;
5 43939 jjdelcerro
import org.gvsig.expressionevaluator.Function;
6 43521 jjdelcerro
import org.gvsig.expressionevaluator.Interpreter;
7 43512 jjdelcerro
import org.gvsig.expressionevaluator.spi.AbstractFunction;
8
9 44138 jjdelcerro
public class PrintFunction extends AbstractFunction {
10
11
    public static final String NAME = "PRINT";
12 43512 jjdelcerro
13 44138 jjdelcerro
    public PrintFunction() {
14
        super(Function.GROUP_PROGRAMMING,
15
                NAME,
16
                Range.between(0, Integer.MAX_VALUE),
17 44098 jjdelcerro
                null,
18 44138 jjdelcerro
                null,
19
                null,
20 44098 jjdelcerro
                "Object",
21
                false
22 43939 jjdelcerro
        );
23 43512 jjdelcerro
    }
24
25
    @Override
26 44138 jjdelcerro
    public boolean allowConstantFolding() {
27
        return false;
28 43939 jjdelcerro
    }
29
30
    @Override
31 44138 jjdelcerro
    public Object call(Interpreter interpreter, Object[] args) throws Exception {
32
        Object value = null;
33
        for (Object arg : args) {
34
            value = arg;
35
            System.err.print(Objects.toString(arg, ""));
36 43512 jjdelcerro
        }
37 44138 jjdelcerro
        System.err.println();
38
        return value;
39 43512 jjdelcerro
    }
40
}