svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.api / src / main / java / org / gvsig / expressionevaluator / Code.java @ 44752
History | View | Annotate | Download (1.87 KB)
1 |
package org.gvsig.expressionevaluator; |
---|---|
2 |
|
3 |
import org.gvsig.expressionevaluator.ExpressionBuilder.Value; |
4 |
import org.gvsig.tools.visitor.Visitable; |
5 |
|
6 |
public interface Code extends Visitable { |
7 |
|
8 |
public static final int UNDEFINED = -1; |
9 |
public static final int CONSTANT = 0; |
10 |
public static final int IDENTIFIER = 1; |
11 |
public static final int CALLABLE = 2; |
12 |
public static final int METHOD = 3; |
13 |
public static final int CODES = 4; |
14 |
|
15 |
public interface Constant extends Code { |
16 |
|
17 |
public Object value(); |
18 |
|
19 |
} |
20 |
|
21 |
public interface Identifier extends Code { |
22 |
|
23 |
public String name(); |
24 |
|
25 |
} |
26 |
|
27 |
public interface Callable extends Code { |
28 |
|
29 |
public static final int FUNCTION = 0; |
30 |
public static final int BINARY_OPERATOR = 1; |
31 |
public static final int UNARY_OPERATOR = 2; |
32 |
|
33 |
|
34 |
public String name(); |
35 |
|
36 |
public Object call(Interpreter interpreter, Object[] args) throws Exception; |
37 |
|
38 |
public Function function();
|
39 |
|
40 |
public Function function(Function function);
|
41 |
|
42 |
public Codes parameters();
|
43 |
|
44 |
public int type(); |
45 |
|
46 |
} |
47 |
|
48 |
public interface Method extends Code { |
49 |
public Code instance();
|
50 |
|
51 |
public String methodname(); |
52 |
|
53 |
public Codes parameters();
|
54 |
|
55 |
public Object call(Interpreter interpreter, Object[] args) throws Exception; |
56 |
} |
57 |
|
58 |
public static final Formatter<Code> EMPTY_FORMATTER = new Formatter<Code>() { |
59 |
@Override
|
60 |
public boolean canApply(Code value) { |
61 |
return false; |
62 |
} |
63 |
|
64 |
@Override
|
65 |
public String format(Code value) { |
66 |
return ""; |
67 |
} |
68 |
}; |
69 |
|
70 |
public int code(); |
71 |
|
72 |
public Value toValue();
|
73 |
|
74 |
public Value toValue(ExpressionBuilder builder);
|
75 |
|
76 |
public String toString(Formatter<Code> formatter); |
77 |
|
78 |
public void link(SymbolTable symbolTable); |
79 |
|
80 |
public void replace(Code target, Code replacement); |
81 |
|
82 |
|
83 |
} |