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