1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*
Copyright (c) 2008 Health Market Science, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
You can contact Health Market Science at info@healthmarketscience.com
or at the following address:
Health Market Science
2700 Horizon Drive
Suite 200
King of Prussia, PA 19406
*/
package com.healthmarketscience.jackcess;
import java.io.IOException;
/**
* Implementation of an Access table index which supports large indexes.
* @author James Ahlborn
*/
public class BigIndex extends Index {
/** Cache which manages the index pages */
private final IndexPageCache _pageCache;
public BigIndex(Table table, int uniqueEntryCount,
int uniqueEntryCountOffset) {
super(table, uniqueEntryCount, uniqueEntryCountOffset);
_pageCache = new IndexPageCache(this);
}
@Override
protected void updateImpl() throws IOException {
_pageCache.write();
}
@Override
protected void readIndexEntries()
throws IOException
{
_pageCache.setRootPageNumber(getRootPageNumber());
}
@Override
protected DataPage findDataPage(Entry entry)
throws IOException
{
return _pageCache.findCacheDataPage(entry);
}
@Override
protected DataPage getDataPage(int pageNumber)
throws IOException
{
return _pageCache.getCacheDataPage(pageNumber);
}
@Override
public String toString() {
return super.toString() + "\n" + _pageCache.toString();
}
/**
* Used by unit tests to validate the internal status of the index.
*/
void validate() throws IOException {
_pageCache.validate();
}
}
|