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 / CodeBlockFunction.java @ 44738
History | View | Annotate | Download (1.6 KB)
1 |
package org.gvsig.expressionevaluator.impl.function.programming; |
---|---|
2 |
|
3 |
import org.apache.commons.lang3.Range; |
4 |
import org.gvsig.expressionevaluator.Code; |
5 |
import org.gvsig.expressionevaluator.Codes; |
6 |
import org.gvsig.expressionevaluator.Function; |
7 |
import org.gvsig.expressionevaluator.Interpreter; |
8 |
import org.gvsig.expressionevaluator.impl.DefaultInterpreter; |
9 |
import org.gvsig.expressionevaluator.spi.AbstractFunction; |
10 |
|
11 |
public class CodeBlockFunction extends AbstractFunction { |
12 |
|
13 |
public static final String NAME = "BLOCK"; |
14 |
|
15 |
public CodeBlockFunction() {
|
16 |
super(Function.GROUP_PROGRAMMING,
|
17 |
NAME, |
18 |
Range.between(1,Integer.MAX_VALUE), |
19 |
"Evaluate each of the arguments sequentially.",
|
20 |
NAME+"( {{arguments...}} )",
|
21 |
null,
|
22 |
"Object",
|
23 |
false
|
24 |
); |
25 |
} |
26 |
|
27 |
@Override
|
28 |
public boolean isHidden() { |
29 |
return true; |
30 |
} |
31 |
|
32 |
@Override
|
33 |
public boolean useArgumentsInsteadObjects() { |
34 |
return true; |
35 |
} |
36 |
|
37 |
@Override
|
38 |
public boolean allowConstantFolding() { |
39 |
return false; |
40 |
} |
41 |
|
42 |
@Override
|
43 |
public Object call(Interpreter interpreter, Object[] args) throws Exception { |
44 |
throw new UnsupportedOperationException("Not supported yet."); |
45 |
} |
46 |
|
47 |
@Override
|
48 |
public Object call(Interpreter interpreter, Codes args) throws Exception { |
49 |
Object value = null; |
50 |
for (Code arg : args) {
|
51 |
// LLamamos a runCode para que no atrape los returns.
|
52 |
value = ((DefaultInterpreter)interpreter).runCode(arg); |
53 |
} |
54 |
return value;
|
55 |
} |
56 |
|
57 |
} |