Java Doc for BTree.java in  » Database-DBMS » JDBM » jdbm » btree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » JDBM » jdbm.btree 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   jdbm.btree.BTree

BTree
public class BTree implements Externalizable(Code)
B+Tree persistent indexing data structure. B+Trees are optimized for block-based, random I/O storage because they store multiple keys on one tree node (called BPage). In addition, the leaf nodes directly contain (inline) the values associated with the keys, allowing a single (or sequential) disk read of all the values on the page.

B+Trees are n-airy, yeilding log(N) search cost. They are self-balancing, preventing search performance degradation when the size of the tree grows.

Keys and associated values must be Serializable objects. The user is responsible to supply a serializable Comparator object to be used for the ordering of entries, which are also called Tuple. The B+Tree allows traversing the keys in forward and reverse order using a TupleBrowser obtained from the browse() methods.

This implementation does not directly support duplicate keys, but it is possible to handle duplicates by inlining or referencing an object collection as a value.

There is no limit on key size or value size, but it is recommended to keep both as small as possible to reduce disk I/O. This is especially true for the key size, which impacts all non-leaf BPage objects.
author:
   Alex Boisvert
version:
   $Id: BTree.java,v 1.6 2005/06/25 23:12:31 doomdark Exp $


Inner Class :static class EmptyBrowser extends TupleBrowser

Field Summary
final public static  intDEFAULT_SIZE
    
protected  Comparator_comparator
     Comparator used to index entries.
protected  int_entries
    
protected  Serializer_keySerializer
    
protected  int_pageSize
     Number of entries in each BPage.
protected transient  RecordManager_recman
    
protected  Serializer_valueSerializer
    
final static  longserialVersionUID
     Version id for serialization.

Constructor Summary
public  BTree()
     No-argument constructor used by serialization.

Method Summary
public synchronized  TupleBrowserbrowse()
     Get a browser initially positioned at the beginning of the BTree.
public synchronized  TupleBrowserbrowse(Object key)
     Get a browser initially positioned just before the given key.

WARNING:  If you make structural modifications to the BTree during browsing, you will get inconsistent browing results.
Parameters:
  key - Key used to position the browser.

public static  BTreecreateInstance(RecordManager recman, Comparator comparator)
     Create a new persistent BTree, with 16 entries per node.
public static  BTreecreateInstance(RecordManager recman, Comparator comparator, Serializer keySerializer, Serializer valueSerializer)
     Create a new persistent BTree, with 16 entries per node.
public static  BTreecreateInstance(RecordManager recman, Comparator comparator, Serializer keySerializer, Serializer valueSerializer, int pageSize)
     Create a new persistent BTree with the given number of entries per node.
public synchronized  Objectfind(Object key)
     Find the value associated with the given key.
Parameters:
  key - Lookup key.
public synchronized  TuplefindGreaterOrEqual(Object key)
     Find the value associated with the given key, or the entry immediately following this key in the ordered BTree.
Parameters:
  key - Lookup key.
public  longgetRecid()
     Return the persistent record identifier of the BTree.
public synchronized  Objectinsert(Object key, Object value, boolean replace)
     Insert an entry in the BTree.

The BTree cannot store duplicate entries.

public static  BTreeload(RecordManager recman, long recid)
     Load a persistent BTree.
public  voidreadExternal(ObjectInput in)
     Implement Externalizable interface.
public synchronized  Objectremove(Object key)
     Remove an entry with the given key from the BTree.
public synchronized  intsize()
     Return the number of entries (size) of the BTree.
public  voidwriteExternal(ObjectOutput out)
     Implement Externalizable interface.

Field Detail
DEFAULT_SIZE
final public static int DEFAULT_SIZE(Code)
Default page size (number of entries per node)



_comparator
protected Comparator _comparator(Code)
Comparator used to index entries.



_entries
protected int _entries(Code)
Total number of entries in the BTree



_keySerializer
protected Serializer _keySerializer(Code)
Serializer used to serialize index keys (optional)



_pageSize
protected int _pageSize(Code)
Number of entries in each BPage.



_recman
protected transient RecordManager _recman(Code)
Page manager used to persist changes in BPages



_valueSerializer
protected Serializer _valueSerializer(Code)
Serializer used to serialize index values (optional)



serialVersionUID
final static long serialVersionUID(Code)
Version id for serialization.




Constructor Detail
BTree
public BTree()(Code)
No-argument constructor used by serialization.




Method Detail
browse
public synchronized TupleBrowser browse() throws IOException(Code)
Get a browser initially positioned at the beginning of the BTree.

WARNING:  If you make structural modifications to the BTree during browsing, you will get inconsistent browing results. Browser positionned at the beginning of the BTree.




browse
public synchronized TupleBrowser browse(Object key) throws IOException(Code)
Get a browser initially positioned just before the given key.

WARNING:  If you make structural modifications to the BTree during browsing, you will get inconsistent browing results.
Parameters:
  key - Key used to position the browser. If null, the browserwill be positionned after the last entry of the BTree.(Null is considered to be an "infinite" key) Browser positionned just before the given key.




createInstance
public static BTree createInstance(RecordManager recman, Comparator comparator) throws IOException(Code)
Create a new persistent BTree, with 16 entries per node.
Parameters:
  recman - Record manager used for persistence.
Parameters:
  comparator - Comparator used to order index entries



createInstance
public static BTree createInstance(RecordManager recman, Comparator comparator, Serializer keySerializer, Serializer valueSerializer) throws IOException(Code)
Create a new persistent BTree, with 16 entries per node.
Parameters:
  recman - Record manager used for persistence.
Parameters:
  keySerializer - Serializer used to serialize index keys (optional)
Parameters:
  valueSerializer - Serializer used to serialize index values (optional)
Parameters:
  comparator - Comparator used to order index entries



createInstance
public static BTree createInstance(RecordManager recman, Comparator comparator, Serializer keySerializer, Serializer valueSerializer, int pageSize) throws IOException(Code)
Create a new persistent BTree with the given number of entries per node.
Parameters:
  recman - Record manager used for persistence.
Parameters:
  comparator - Comparator used to order index entries
Parameters:
  keySerializer - Serializer used to serialize index keys (optional)
Parameters:
  valueSerializer - Serializer used to serialize index values (optional)
Parameters:
  pageSize - Number of entries per page (must be even).



find
public synchronized Object find(Object key) throws IOException(Code)
Find the value associated with the given key.
Parameters:
  key - Lookup key. Value associated with the key, or null if not found.



findGreaterOrEqual
public synchronized Tuple findGreaterOrEqual(Object key) throws IOException(Code)
Find the value associated with the given key, or the entry immediately following this key in the ordered BTree.
Parameters:
  key - Lookup key. Value associated with the key, or a greater entry, or null if nogreater entry was found.



getRecid
public long getRecid()(Code)
Return the persistent record identifier of the BTree.



insert
public synchronized Object insert(Object key, Object value, boolean replace) throws IOException(Code)
Insert an entry in the BTree.

The BTree cannot store duplicate entries. An existing entry can be replaced using the replace flag. If an entry with the same key already exists in the BTree, its value is returned.
Parameters:
  key - Insert key
Parameters:
  value - Insert value
Parameters:
  replace - Set to true to replace an existing key-value pair. Existing value, if any.




load
public static BTree load(RecordManager recman, long recid) throws IOException(Code)
Load a persistent BTree.
Parameters:
  recman - RecordManager used to store the persistent btree
Parameters:
  recid - Record id of the BTree



readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)
Implement Externalizable interface.



remove
public synchronized Object remove(Object key) throws IOException(Code)
Remove an entry with the given key from the BTree.
Parameters:
  key - Removal key Value associated with the key, or null if no entry with givenkey existed in the BTree.



size
public synchronized int size()(Code)
Return the number of entries (size) of the BTree.



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)
Implement Externalizable interface.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.