public class BGraph
extends java.lang.Object
Constructor and Description |
---|
BGraph(java.lang.String path)
Instantiates a new directed graph object.
|
Modifier and Type | Method and Description |
---|---|
BNode |
add(long hash)
Ensures this graph contains a node with the specified identifier.
|
void |
close()
Flushes all the modifications to the database and closes it
|
boolean |
contains(long hash)
Returns
true if this graph contains a node with the
specified identifier. |
BNode |
get(long hash)
Returns the node object to which the specified identifier is
linked, or
null if this graph does not contain a node
with such identifier. |
java.util.SortedSet<java.lang.Long> |
keys()
Returns a sorted view of the keys in this graph.
|
long |
size()
Returns the number of nodes stored in this graph.
|
void |
sync()
Flushes all the modification performed to the graph to the
physical storage.
|
void |
update(BNode node)
Updates a node with a new value.
|
public BGraph(java.lang.String path) throws com.sleepycat.je.DatabaseException, java.io.FileNotFoundException
path
- directory where the database is storedjava.lang.Exception
- if the database cannot be accessedcom.sleepycat.je.DatabaseException
java.io.FileNotFoundException
public BNode get(long hash) throws com.sleepycat.je.DatabaseException
null
if this graph does not contain a node
with such identifier.hash
- node identifiernull
com.sleepycat.je.DatabaseException
- if a database failure occurspublic BNode add(long hash) throws com.sleepycat.je.DatabaseException
If the graph already contained a node with the identifier that node is returned, otherwise a new node object is added to the graph and returned.
hash
- node identifiercom.sleepycat.je.DatabaseException
- if a database failure occurspublic void update(BNode node) throws com.sleepycat.je.DatabaseException
node
- a node already stored on the databasejava.lang.IllegalArgumentException
- if the node was not already
stored on the databasecom.sleepycat.je.DatabaseException
- if a database failure occurspublic java.util.SortedSet<java.lang.Long> keys() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
- if a database failure occurspublic boolean contains(long hash) throws com.sleepycat.je.DatabaseException
true
if this graph contains a node with the
specified identifier.hash
- node identifiertrue
if the graph contains a node with
the identifier, false
otherwisecom.sleepycat.je.DatabaseException
- if a database failure occurspublic long size() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
- if a database failure occurspublic void sync() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
- if a database failure occurspublic void close() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
- if a database failure occurs