comparison src/org/dancres/blitz/entry/ci/CacheLine.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.util.Set;
4 import java.util.HashSet;
5
6 import java.util.ArrayList;
7 import java.util.LinkedList;
8 import java.util.List;
9
10 import org.dancres.blitz.oid.OID;
11
12 import org.dancres.blitz.entry.TupleLocator;
13 import org.dancres.blitz.entry.EntrySleeve;
14
15 /**
16 Maintains a list of all entries with the same hashcode for a particular
17 field.
18 */
19 class CacheLine {
20 private Set theIds = new HashSet();
21
22 TupleLocator getLocator() {
23 if (theIds.size() == 0)
24 return ArrayLocatorImpl.EMPTY_LOCATOR;
25 else
26 return new CacheLineLocatorImpl(getIdList(), this);
27 }
28
29 private Object[] getIdList() {
30 Object[] myIds = new Object[theIds.size()];
31 theIds.toArray(myIds);
32
33 return myIds;
34 }
35
36 void insert(EntrySleeve aSleeve) {
37 theIds.add(aSleeve.getOID());
38 }
39
40 void remove(EntrySleeve aSleeve) {
41 theIds.remove(aSleeve.getOID());
42 }
43
44 int getSize() {
45 return theIds.size();
46 }
47 }