Statistics
| Revision:

root / trunk / libraries / libGDBMS / src / main / java / com / hardcode / gdbms / engine / instruction / LiteralAdapter.java @ 10627

History | View | Annotate | Download (1.23 KB)

1
/*
2
 * Created on 12-oct-2004
3
 */
4
package com.hardcode.gdbms.engine.instruction;
5

    
6
import com.hardcode.gdbms.engine.values.Value;
7
import com.hardcode.gdbms.engine.values.ValueFactory;
8
import com.hardcode.gdbms.parser.SimpleNode;
9

    
10

    
11
/**
12
 * Adaptador
13
 *
14
 * @author Fernando Gonz?lez Cort?s
15
 */
16
public class LiteralAdapter extends AbstractExpression {
17
        /**
18
         * @see com.hardcode.gdbms.engine.instruction.Expression#getFieldName()
19
         */
20
        public String getFieldName() {
21
                return null;
22
        }
23

    
24
        /**
25
         * @see com.hardcode.gdbms.engine.instruction.Expression#simplify()
26
         */
27
        public void simplify() {
28
        }
29

    
30
        /**
31
         * @see com.hardcode.gdbms.engine.instruction.CachedExpression#evaluate(long)
32
         */
33
        public Value evaluate(long row) throws EvaluationException {
34
                SimpleNode n = getEntity();
35

    
36
                try {
37
            return ValueFactory.createValue(Utilities.getText(n),
38
                    Utilities.getType(n));
39
        } catch (SemanticException e) {
40
            throw new EvaluationException();
41
        }
42
        }
43

    
44
        /**
45
         * @see com.hardcode.gdbms.engine.instruction.CachedExpression#isLiteral()
46
         */
47
        public boolean isLiteral() {
48
                return true;
49
        }
50

    
51
        /**
52
         * @see com.hardcode.gdbms.engine.instruction.Expression#calculateLiteralCondition()
53
         */
54
        public void calculateLiteralCondition() {
55
        }
56
}