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 / ListFunction.java @ 44738

History | View | Annotate | Download (1.02 KB)

1 44138 jjdelcerro
package org.gvsig.expressionevaluator.impl.function.programming;
2 43512 jjdelcerro
3 44138 jjdelcerro
import java.util.ArrayList;
4
import java.util.Arrays;
5 43512 jjdelcerro
import org.apache.commons.lang3.Range;
6 44262 jjdelcerro
import static org.gvsig.expressionevaluator.ExpressionBuilder.FUNCTION_LIST;
7 43939 jjdelcerro
import org.gvsig.expressionevaluator.Function;
8 43521 jjdelcerro
import org.gvsig.expressionevaluator.Interpreter;
9 43512 jjdelcerro
import org.gvsig.expressionevaluator.spi.AbstractFunction;
10
11 44138 jjdelcerro
public class ListFunction extends AbstractFunction {
12
13
    public ListFunction() {
14
        super(Function.GROUP_PROGRAMMING,
15 44262 jjdelcerro
                FUNCTION_LIST,
16 44138 jjdelcerro
                Range.between(0, Integer.MAX_VALUE),
17 44098 jjdelcerro
                null,
18 44138 jjdelcerro
                null,
19
                null,
20
                "List",
21 44098 jjdelcerro
                false
22 43939 jjdelcerro
        );
23 43512 jjdelcerro
    }
24
25
    @Override
26 44138 jjdelcerro
    public boolean allowConstantFolding() {
27
        return false;
28 43939 jjdelcerro
    }
29 44138 jjdelcerro
30 43939 jjdelcerro
    @Override
31 43521 jjdelcerro
    public Object call(Interpreter interpreter, Object[] args) throws Exception {
32 44138 jjdelcerro
        ArrayList<Object> list = new ArrayList<>();
33
        list.addAll(Arrays.asList(args));
34
        return list;
35 43939 jjdelcerro
    }
36 43512 jjdelcerro
}