01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.result;
07:
08: import org.h2.value.Value;
09:
10: /**
11: * A simple row that contains data for only one column.
12: */
13: public class SimpleRowValue implements SearchRow {
14:
15: private int pos;
16: private int index;
17: private int virtualColumnCount;
18: private Value data;
19:
20: public SimpleRowValue(int columnCount) {
21: this .virtualColumnCount = columnCount;
22: }
23:
24: public int getColumnCount() {
25: return virtualColumnCount;
26: }
27:
28: public int getPos() {
29: return pos;
30: }
31:
32: public Value getValue(int idx) {
33: return idx == index ? data : null;
34: }
35:
36: public void setPos(int pos) {
37: this .pos = pos;
38: }
39:
40: public void setValue(int idx, Value v) {
41: index = idx;
42: data = v;
43: }
44:
45: public String toString() {
46: return "( /* " + pos + " */ " + data.getSQL() + " )";
47: }
48:
49: }
|