1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package tools.gsf.facade.sql;
18
19 import COM.FutureTense.Interfaces.IList;
20
21
22
23
24
25
26
27 public abstract class AbstractIList implements IList {
28 private String name;
29 private int currentRow;
30
31 protected AbstractIList(final String name) {
32 this.name = name;
33 }
34
35 public final String getName() {
36 return name;
37 }
38
39 public final void rename(final String newname) {
40 name = newname;
41 }
42
43 public final boolean moveTo(final int i) {
44 if (1 <= i && i <= numRows()) {
45 currentRow = i;
46 return true;
47 } else {
48 return false;
49 }
50 }
51
52 public final boolean moveToRow(final int how, final int row) {
53 if (numRows() == 0) {
54 return false;
55 }
56 switch (how) {
57 case first:
58 currentRow = 1;
59 return true;
60 case gotorow:
61 return moveTo(row);
62 case last:
63 currentRow = numRows();
64 return true;
65 case next:
66 if (currentRow == -1) {
67 return false;
68 }
69 ++currentRow;
70 if (currentRow > numRows()) {
71 currentRow = -1;
72 return false;
73 }
74 return true;
75 case prev:
76 if (currentRow == -1) {
77 return false;
78 }
79 --currentRow;
80 if (currentRow == 0) {
81 currentRow = -1;
82 return false;
83 }
84 return true;
85 default:
86 return false;
87 }
88 }
89
90 public final boolean atEnd() {
91 return currentRow == -1;
92 }
93
94 public final boolean hasData() {
95 return numRows() > 0;
96 }
97
98 public final int currentRow() {
99 return currentRow;
100 }
101
102 }