comparison src/org/dancres/blitz/entry/ci/CacheLineLocatorImpl.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.entry.ci;
2
3 import java.io.IOException;
4
5 import org.dancres.blitz.oid.OID;
6
7 import org.dancres.blitz.entry.TupleLocator;
8
9 /**
10 Used by CacheIndexer.
11 */
12 class CacheLineLocatorImpl implements TupleLocator {
13 private Object[] theOIDs;
14 private CacheLine theCacheLine;
15
16 private int theIndex = 0;
17 private OID theCurrent;
18
19 CacheLineLocatorImpl(Object[] aListOfOIDs, CacheLine aCacheLine) {
20 theOIDs = aListOfOIDs;
21 theCacheLine = aCacheLine;
22 }
23
24 /**
25 Invoke this to load the next matching Tuple.
26
27 @return <code>true</code> if there was a tuple, <code>false</code>
28 otherwise
29 */
30 public boolean fetchNext() throws IOException {
31 if (theIndex >= theOIDs.length)
32 return false;
33
34 theCurrent = (OID) theOIDs[theIndex++];
35 return true;
36 }
37
38 /**
39 @return the OID of the tuple just fetched with
40 <code>fetchNext</code>
41 */
42 public OID getOID() {
43 return theCurrent;
44 }
45
46 /**
47 When you've finished with the TupleLocator instance, call release.
48 */
49 public void release() throws IOException {
50 // System.out.println("Iterated: " + theIndex);
51 }
52 }