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