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