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 / obj / CodeBlockFunction.java @ 43939
History | View | Annotate | Download (1.22 KB)
1 | 43939 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.obj; |
---|---|---|---|
2 | 43512 | jjdelcerro | |
3 | import org.apache.commons.lang3.Range; |
||
4 | 43939 | jjdelcerro | import org.gvsig.expressionevaluator.Code; |
5 | import org.gvsig.expressionevaluator.Code.Caller.Arguments; |
||
6 | import org.gvsig.expressionevaluator.Function; |
||
7 | 43521 | jjdelcerro | import org.gvsig.expressionevaluator.Interpreter; |
8 | 43512 | jjdelcerro | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
9 | |||
10 | 43939 | jjdelcerro | public class CodeBlockFunction extends AbstractFunction { |
11 | 43512 | jjdelcerro | |
12 | 43939 | jjdelcerro | public CodeBlockFunction() {
|
13 | super(
|
||
14 | Function.GROUP_OTHER, |
||
15 | "CodeBlock",
|
||
16 | Range.between(0,Integer.MAX_VALUE), |
||
17 | "",
|
||
18 | "CodeBlock( arguments... )"
|
||
19 | ); |
||
20 | 43512 | jjdelcerro | } |
21 | |||
22 | @Override
|
||
23 | 43939 | jjdelcerro | public boolean useArgumentsInsteadObjects() { |
24 | return true; |
||
25 | } |
||
26 | |||
27 | @Override
|
||
28 | 43521 | jjdelcerro | public Object call(Interpreter interpreter, Object[] args) throws Exception { |
29 | 43939 | jjdelcerro | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
30 | } |
||
31 | |||
32 | @Override
|
||
33 | public Object call(Interpreter interpreter, Arguments args) throws Exception { |
||
34 | Object value = null; |
||
35 | for (Code arg : args) {
|
||
36 | value = interpreter.run(arg); |
||
37 | 43512 | jjdelcerro | } |
38 | 43939 | jjdelcerro | return value;
|
39 | 43512 | jjdelcerro | } |
40 | |||
41 | } |