Java Doc for BTree.java in  » RSS-RDF » sesame » org » openrdf » sail » nativerdf » 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 » RSS RDF » sesame » org.openrdf.sail.nativerdf.btree 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openrdf.sail.nativerdf.btree.BTree

BTree
public class BTree (Code)
Implementation of an on-disk B-Tree using the java.nio classes that are available in JDK 1.4 and newer. Documentation about B-Trees can be found on-line at the following URLs:
  • http://cis.stvincent.edu/swd/btree/btree.html
  • ,
  • http://bluerwhite.org/btree/
  • , and
  • http://semaphorecorp.com/btp/algo.html
  • .
The first reference was used to implement this class.

TODO: clean up code
author:
   Arjohn Kampman




Constructor Summary
public  BTree(File dataFile, int blockSize, int valueSize)
     Creates a new BTree that uses an instance of DefaultRecordComparator to compare values.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node.
public  BTree(File dataFile, int blockSize, int valueSize, boolean forceSync)
     Creates a new BTree that uses an instance of DefaultRecordComparator to compare values.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node.
public  BTree(File dataFile, int blockSize, int valueSize, RecordComparator comparator)
     Creates a new BTree that uses the supplied RecordComparator to compare the values that are or will be stored in the B-Tree.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node.
public  BTree(File dataFile, int blockSize, int valueSize, RecordComparator comparator, boolean forceSync)
     Creates a new BTree that uses the supplied RecordComparator to compare the values that are or will be stored in the B-Tree.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node.

Method Summary
public  voidclear()
     Removes all values from the B-Tree.
public  voidclose()
     Closes any opened files and release any resources used by this B-Tree.
public  byte[]get(byte[] key)
     Gets the value that matches the specified key.
Parameters:
  key - A value that is equal to the value that should be retrieved, atleast as far as the RecordComparator of this BTree is concerned.
public  FilegetFile()
     Gets the file that this BTree operates on.
public  longgetValueCountEstimate()
     Returns an estimate for the number of values stored in this BTree.
public  byte[]insert(byte[] value)
     Inserts the supplied value into the B-Tree.
public  RecordIteratoriterateAll()
     Returns an iterator that iterates over all values in this B-Tree.
public  RecordIteratoriterateRange(byte[] minValue, byte[] maxValue)
     Returns an iterator that iterates over all values between minValue and maxValue, inclusive.
public  RecordIteratoriterateRangedValues(byte[] searchKey, byte[] searchMask, byte[] minValue, byte[] maxValue)
     Returns an iterator that iterates over all values between minValue and maxValue (inclusive) and returns the values that match the supplied searchKey after searchMask has been applied to the value.
public  RecordIteratoriterateValues(byte[] searchKey, byte[] searchMask)
     Returns an iterator that iterates over all values and returns the values that match the supplied searchKey after searchMask has been applied to the value.
public static  voidmain(String[] args)
    
public  voidprint(PrintStream out)
    
public  byte[]remove(byte[] key)
     Removes the value that matches the specified key from the B-Tree.
Parameters:
  key - A key that matches the value that should be removed from theB-Tree.
public static  voidrunDebugTest(String[] args)
    
public static  voidrunPerformanceTest(String[] args)
    
public  voidsync()
     Writes any changes that are cached in memory to disk.


Constructor Detail
BTree
public BTree(File dataFile, int blockSize, int valueSize) throws IOException(Code)
Creates a new BTree that uses an instance of DefaultRecordComparator to compare values.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node. Ideally, thesize specified is the size of a block in the used file system.
Parameters:
  valueSize - The size (in bytes) of the fixed-length values that are or will bestored in the B-Tree.
throws:
  IOException - In case the initialization of the B-Tree file failed.
See Also:   DefaultRecordComparator



BTree
public BTree(File dataFile, int blockSize, int valueSize, boolean forceSync) throws IOException(Code)
Creates a new BTree that uses an instance of DefaultRecordComparator to compare values.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node. Ideally, thesize specified is the size of a block in the used file system.
Parameters:
  valueSize - The size (in bytes) of the fixed-length values that are or will bestored in the B-Tree.
Parameters:
  forceSync - Flag indicating whether updates should be synced to disk forcefullyby calling FileChannel.force(boolean). This may have asevere impact on write performance.
throws:
  IOException - In case the initialization of the B-Tree file failed.
See Also:   DefaultRecordComparator



BTree
public BTree(File dataFile, int blockSize, int valueSize, RecordComparator comparator) throws IOException(Code)
Creates a new BTree that uses the supplied RecordComparator to compare the values that are or will be stored in the B-Tree.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node. Ideally, thesize specified is the size of a block in the used file system.
Parameters:
  valueSize - The size (in bytes) of the fixed-length values that are or will bestored in the B-Tree.
Parameters:
  comparator - The RecordComparator to use for determining whether onevalue is smaller, larger or equal to another.
throws:
  IOException - In case the initialization of the B-Tree file failed.



BTree
public BTree(File dataFile, int blockSize, int valueSize, RecordComparator comparator, boolean forceSync) throws IOException(Code)
Creates a new BTree that uses the supplied RecordComparator to compare the values that are or will be stored in the B-Tree.
Parameters:
  dataFile - The file for the B-Tree.
Parameters:
  blockSize - The size (in bytes) of a file block for a single node. Ideally, thesize specified is the size of a block in the used file system.
Parameters:
  valueSize - The size (in bytes) of the fixed-length values that are or will bestored in the B-Tree.
Parameters:
  comparator - The RecordComparator to use for determining whether onevalue is smaller, larger or equal to another.
Parameters:
  forceSync - Flag indicating whether updates should be synced to disk forcefullyby calling FileChannel.force(boolean). This may have asevere impact on write performance.
throws:
  IOException - In case the initialization of the B-Tree file failed.




Method Detail
clear
public void clear() throws IOException(Code)
Removes all values from the B-Tree.
throws:
  IOException - If an I/O error occurred.



close
public void close() throws IOException(Code)
Closes any opened files and release any resources used by this B-Tree. Any pending changes will be synchronized to disk before closing. Once the B-Tree has been closes, it can no longer be used.



get
public byte[] get(byte[] key) throws IOException(Code)
Gets the value that matches the specified key.
Parameters:
  key - A value that is equal to the value that should be retrieved, atleast as far as the RecordComparator of this BTree is concerned. The value matching the key, or null if no such valuecould be found.



getFile
public File getFile()(Code)
Gets the file that this BTree operates on.



getValueCountEstimate
public long getValueCountEstimate() throws IOException(Code)
Returns an estimate for the number of values stored in this BTree.



insert
public byte[] insert(byte[] value) throws IOException(Code)
Inserts the supplied value into the B-Tree. In case an equal value is already present in the B-Tree this value is overwritten with the new value and the old value is returned by this method.
Parameters:
  value - The value to insert into the B-Tree. The old value that was replaced, if any.
throws:
  IOException - If an I/O error occurred.



iterateAll
public RecordIterator iterateAll()(Code)
Returns an iterator that iterates over all values in this B-Tree.



iterateRange
public RecordIterator iterateRange(byte[] minValue, byte[] maxValue)(Code)
Returns an iterator that iterates over all values between minValue and maxValue, inclusive.



iterateRangedValues
public RecordIterator iterateRangedValues(byte[] searchKey, byte[] searchMask, byte[] minValue, byte[] maxValue)(Code)
Returns an iterator that iterates over all values between minValue and maxValue (inclusive) and returns the values that match the supplied searchKey after searchMask has been applied to the value.



iterateValues
public RecordIterator iterateValues(byte[] searchKey, byte[] searchMask)(Code)
Returns an iterator that iterates over all values and returns the values that match the supplied searchKey after searchMask has been applied to the value.



main
public static void main(String[] args) throws Exception(Code)



print
public void print(PrintStream out) throws IOException(Code)



remove
public byte[] remove(byte[] key) throws IOException(Code)
Removes the value that matches the specified key from the B-Tree.
Parameters:
  key - A key that matches the value that should be removed from theB-Tree. The value that was removed from the B-Tree, or null ifno matching value was found.
throws:
  IOException - If an I/O error occurred.



runDebugTest
public static void runDebugTest(String[] args) throws Exception(Code)



runPerformanceTest
public static void runPerformanceTest(String[] args) throws Exception(Code)



sync
public void sync() throws IOException(Code)
Writes any changes that are cached in memory to disk.
throws:
  IOException -



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.