svn-gvsig-desktop / trunk / libraries / libGDBMS / src / com / hardcode / gdbms / engine / instruction / LValueTermAdapter.java @ 466
History | View | Annotate | Download (2.48 KB)
1 |
/*
|
---|---|
2 |
* Created on 12-oct-2004
|
3 |
*/
|
4 |
package com.hardcode.gdbms.engine.instruction; |
5 |
|
6 |
import com.hardcode.gdbms.engine.data.DataSource; |
7 |
import com.hardcode.gdbms.engine.data.DriverException; |
8 |
import com.hardcode.gdbms.engine.values.Value; |
9 |
|
10 |
|
11 |
/**
|
12 |
* Adaptador
|
13 |
*
|
14 |
* @author Fernando Gonz?lez Cort?s
|
15 |
*/
|
16 |
public class LValueTermAdapter extends AbstractExpression |
17 |
implements FieldSupport {
|
18 |
private DataSource[] tables; |
19 |
private DataSource source; |
20 |
private Field field = null; |
21 |
|
22 |
/**
|
23 |
* @see com.hardcode.gdbms.engine.instruction.Expression#getFieldName()
|
24 |
*/
|
25 |
public String getFieldName() { |
26 |
return Utilities.getText(getEntity()); |
27 |
} |
28 |
|
29 |
/**
|
30 |
* @see com.hardcode.gdbms.engine.instruction.Expression#simplify()
|
31 |
*/
|
32 |
public void simplify() { |
33 |
} |
34 |
|
35 |
/**
|
36 |
* @see com.hardcode.gdbms.engine.instruction.CachedExpression#evaluate(long)
|
37 |
*/
|
38 |
public Value evaluate(long row) throws SemanticException, DriverException { |
39 |
return getField().evaluateExpression(row);
|
40 |
} |
41 |
|
42 |
/**
|
43 |
* Obtiene el campo al que referencia este adaptador
|
44 |
*
|
45 |
* @return Field
|
46 |
*
|
47 |
* @throws AmbiguousFieldNameException Si hay varios campos con el mismo
|
48 |
* nombre y no se especific? la tabla
|
49 |
* @throws FieldNotFoundException Si no hay ning?n campo con ese nombre
|
50 |
* @throws DriverException Si se produjo un error en el driver
|
51 |
* @throws SemanticException Si existe alg?n error sem?ntico en la
|
52 |
* instrucci?n
|
53 |
*/
|
54 |
private Field getField() |
55 |
throws AmbiguousFieldNameException, FieldNotFoundException,
|
56 |
DriverException, SemanticException { |
57 |
if (field == null) { |
58 |
field = FieldFactory.createField(tables, getFieldName(), source); |
59 |
} |
60 |
|
61 |
return field;
|
62 |
} |
63 |
|
64 |
/**
|
65 |
* @see com.hardcode.gdbms.engine.instruction.CachedExpression#isLiteral()
|
66 |
*/
|
67 |
public boolean isLiteral() { |
68 |
return false; |
69 |
} |
70 |
|
71 |
/**
|
72 |
* @see com.hardcode.gdbms.engine.instruction.FieldSupport#setTables(com.hardcode.gdbms.engine.data.DataSource[])
|
73 |
*/
|
74 |
public void setTables(DataSource[] tables) { |
75 |
this.tables = tables;
|
76 |
} |
77 |
|
78 |
/**
|
79 |
* @see com.hardcode.gdbms.engine.instruction.FieldSupport#setDataSource(com.hardcode.gdbms.engine.data.DataSource)
|
80 |
*/
|
81 |
public void setDataSource(DataSource source) { |
82 |
this.source = source;
|
83 |
} |
84 |
|
85 |
/**
|
86 |
* @see com.hardcode.gdbms.engine.instruction.Expression#calculateLiteralCondition()
|
87 |
*/
|
88 |
public void calculateLiteralCondition() { |
89 |
} |
90 |
} |