Statistics
| Revision:

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 @ 44198

History | View | Annotate | Download (1.69 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 CALLER = 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 Caller 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 Caller {
49
        public Code obj();
50
        
51
        public String methodname();
52
    }
53

    
54
    public static final Formatter<Code> EMPTY_FORMATTER = new Formatter<Code>() {
55
        @Override
56
        public boolean canApply(Code value) {
57
            return false;
58
        }
59

    
60
        @Override
61
        public String format(Code value) {
62
            return "";
63
        }
64
    };
65

    
66
    public int code();
67

    
68
    public Value toValue();
69

    
70
    public Value toValue(ExpressionBuilder builder);
71
    
72
    public String toString(Formatter<Code> formatter);
73
    
74
    public void link(SymbolTable symbolTable);
75
    
76
}