1 30 31 32 package org.hsqldb; 33 34 41 public class ResultBase { 42 43 public Record rRoot; 44 protected Record rTail; 45 protected int iSize; 46 47 public ResultBase() {} 48 49 public ResultIterator iterator() { 50 return new ResultIterator(); 51 } 52 53 public class ResultIterator { 54 55 boolean removed; 56 int counter; 57 Record current = rRoot; 58 Record last; 59 60 public boolean hasNext() { 61 return counter < iSize; 62 } 63 64 public boolean next() { 65 66 if (hasNext()) { 67 removed = false; 68 69 if (counter != 0) { 70 last = current; 71 current = current.next; 72 } 73 74 counter++; 75 76 return true; 77 } else { 78 return false; 79 } 80 } 81 82 public boolean previous() { 83 return false; 84 } 85 86 public boolean absolute(int rows) { 87 return false; 88 } 89 90 public boolean relative(int rows) { 91 return false; 92 } 93 94 public boolean beforeFirst() { 95 return false; 96 } 97 98 public boolean afterLast() { 99 return false; 100 } 101 102 public boolean isBeforeFirst() { 103 return false; 104 } 105 106 public boolean isAfterLast() { 107 return false; 108 } 109 110 public void remove() { 111 112 if (counter <= iSize && counter != 0 &&!removed) { 113 removed = true; 114 115 if (current == rTail) { 116 rTail = last; 117 } 118 119 if (current == rRoot) { 120 current = rRoot = rRoot.next; 121 } else { 122 current = last; 123 last = null; 124 current.next = current.next.next; 125 } 126 127 iSize--; 128 counter--; 129 130 return; 131 } 132 } 133 } 134 } 135 | Popular Tags |