public final class Resources extends java.lang.Object implements Index
This index organizes all database resources.
If updates are performed, the path order is discarded, as its continuous update would be more expensive in some cases (e.g. when bulk insertions of new documents are performed). A tree structure could be introduced to offer better general performance.
| Modifier and Type | Method and Description |
|---|---|
TokenList |
binaries(java.lang.String path)
Returns the database paths to all binary files that match the
specified path.
|
TokenBoolMap |
children(byte[] path,
boolean dir)
Returns the child resources for the given path.
|
void |
close()
Closes the index.
|
int |
count(IndexToken token)
Returns the (approximate/estimated) number of hits for the specified token.
|
void |
delete(int pre,
int size)
Deletes the specified entry and updates subsequent nodes.
|
int |
doc(java.lang.String path)
Returns the pre value of the node that matches the specified path,
or
-1. |
int |
doc(java.lang.String path,
boolean sort)
Returns the pre value of the document node matching the specified path.
|
IntList |
docs()
Returns the
pre values of all document nodes. |
IntList |
docs(java.lang.String path)
Returns the pre values of all document nodes matching the specified path.
|
EntryIterator |
entries(byte[] prefix)
Returns all entries that start with the specified prefix.
|
byte[] |
info()
Returns information on the index structure.
|
void |
init()
Initializes the index.
|
void |
insert(int pre,
Data d)
Adds entries to the index and updates subsequent nodes.
|
boolean |
isDir(byte[] path)
Determines whether the given path is the path to a directory.
|
IndexIterator |
iter(IndexToken token)
Returns an iterator for the index results.
|
void |
read(DataInput in)
Reads information on database resources from disk.
|
void |
rename(int pre,
byte[] value)
Updates the index after a document has been renamed.
|
void |
replace(int pre,
int size,
Data d)
Replaces entries in the index.
|
void |
write(DataOutput out)
Writes information on database resources to disk.
|
public Resources(Data d)
d - data referencepublic void read(DataInput in) throws java.io.IOException
in - input streamjava.io.IOException - I/O exceptionpublic void write(DataOutput out) throws java.io.IOException
out - output streamjava.io.IOException - I/O exceptionpublic IntList docs()
pre values of all document nodes.
A single dummy node is returned if the database is empty.public void init()
public void insert(int pre,
Data d)
pre - insertion positiond - data reference to be insertedpublic void delete(int pre,
int size)
pre - pre valuesize - number of deleted nodespublic void rename(int pre,
byte[] value)
pre - pre value of updated documentvalue - new namepublic void replace(int pre,
int size,
Data d)
pre - insertion positionsize - number of deleted nodesd - data reference to be copiedpublic IntList docs(java.lang.String path)
path - input pathpublic int doc(java.lang.String path)
-1.path - input pathpublic int doc(java.lang.String path,
boolean sort)
path - input pathsort - sort paths before accesspublic TokenList binaries(java.lang.String path)
path - input pathpublic boolean isDir(byte[] path)
path - given path (must be normalized, means one leading but
no trailing slash.public TokenBoolMap children(byte[] path, boolean dir)
path - pathdir - returns directoriesfalsepublic void close()
Indexpublic IndexIterator iter(IndexToken token)
Indexpublic int count(IndexToken token)
Indexpublic byte[] info()
Indexpublic EntryIterator entries(byte[] prefix)
Index