You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BigIndexData.java 2.2KB

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