Revision 10627 trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/strategies/DistinctDataSource.java
DistinctDataSource.java | ||
---|---|---|
3 | 3 |
import java.util.Comparator; |
4 | 4 |
import java.util.TreeSet; |
5 | 5 |
|
6 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
6 | 7 |
import com.hardcode.gdbms.engine.data.DataSource; |
7 | 8 |
import com.hardcode.gdbms.engine.data.FieldNameAccessSupport; |
8 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
9 | 9 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
10 | 10 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
11 | 11 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
... | ... | |
46 | 46 |
/** |
47 | 47 |
* @see com.hardcode.gdbms.engine.data.DataSource#start() |
48 | 48 |
*/ |
49 |
public void start() throws DriverException { |
|
49 |
public void start() throws ReadDriverException {
|
|
50 | 50 |
dataSource.start(); |
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
/** |
54 | 54 |
* @see com.hardcode.gdbms.engine.data.DataSource#stop() |
55 | 55 |
*/ |
56 |
public void stop() throws DriverException { |
|
56 |
public void stop() throws ReadDriverException {
|
|
57 | 57 |
dataSource.stop(); |
58 | 58 |
} |
59 | 59 |
|
... | ... | |
68 | 68 |
/** |
69 | 69 |
* @see com.hardcode.gdbms.engine.data.DataSource#getFieldIndexByName(java.lang.String) |
70 | 70 |
*/ |
71 |
public int getFieldIndexByName(String fieldName) throws DriverException { |
|
71 |
public int getFieldIndexByName(String fieldName) throws ReadDriverException {
|
|
72 | 72 |
return fnaSupport.getFieldIndexByName(fieldName); |
73 | 73 |
} |
74 | 74 |
|
... | ... | |
77 | 77 |
* int) |
78 | 78 |
*/ |
79 | 79 |
public Value getFieldValue(long rowIndex, int fieldId) |
80 |
throws DriverException { |
|
80 |
throws ReadDriverException {
|
|
81 | 81 |
return dataSource.getFieldValue(indexes[(int) rowIndex], fieldId); |
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
/** |
85 | 85 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldCount() |
86 | 86 |
*/ |
87 |
public int getFieldCount() throws DriverException { |
|
87 |
public int getFieldCount() throws ReadDriverException {
|
|
88 | 88 |
return dataSource.getFieldCount(); |
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
/** |
92 | 92 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldName(int) |
93 | 93 |
*/ |
94 |
public String getFieldName(int fieldId) throws DriverException { |
|
94 |
public String getFieldName(int fieldId) throws ReadDriverException {
|
|
95 | 95 |
return dataSource.getFieldName(fieldId); |
96 | 96 |
} |
97 | 97 |
|
98 | 98 |
/** |
99 | 99 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getRowCount() |
100 | 100 |
*/ |
101 |
public long getRowCount() throws DriverException { |
|
101 |
public long getRowCount() throws ReadDriverException {
|
|
102 | 102 |
return indexes.length; |
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
/** |
106 | 106 |
* @see com.hardcode.gdbms.engine.data.driver.ReadAccess#getFieldType(int) |
107 | 107 |
*/ |
108 |
public int getFieldType(int i) throws DriverException { |
|
108 |
public int getFieldType(int i) throws ReadDriverException {
|
|
109 | 109 |
return dataSource.getFieldType(i); |
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
/** |
113 | 113 |
* DOCUMENT ME! |
114 |
* |
|
115 |
* @throws DriverException DOCUMENT ME! |
|
116 | 114 |
* @throws EvaluationException DOCUMENT ME! |
115 |
* @throws ReadDriverException TODO |
|
117 | 116 |
* @throws RuntimeException DOCUMENT ME! |
118 | 117 |
*/ |
119 |
public void filter() throws DriverException, EvaluationException {
|
|
118 |
public void filter() throws EvaluationException, ReadDriverException {
|
|
120 | 119 |
int[] idx = new int[(int) dataSource.getRowCount()]; |
121 | 120 |
TreeSet h = new TreeSet(new Comparator() { |
122 | 121 |
public int compare(Object o1, Object o2) { |
... | ... | |
164 | 163 |
System.arraycopy(idx, 0, indexes, 0, index); |
165 | 164 |
} |
166 | 165 |
|
167 |
public int getFieldWidth(int i) throws DriverException { |
|
166 |
public int getFieldWidth(int i) throws ReadDriverException {
|
|
168 | 167 |
return dataSource.getFieldType(i); |
169 | 168 |
} |
170 | 169 |
} |
Also available in: Unified diff