public abstract class Data
extends java.lang.Object
COMMON ATTRIBUTES:
- Byte 0: KIND: Node kind (bits: 2-0)
- Byte 12-15: UNID: Unique Node ID
DOCUMENT NODES (kind = 0):
- Byte 3- 7: TEXT: Text reference
- Byte 8-11: SIZE: Number of descendants
ELEMENT NODES (kind = 1):
- Byte 0: ATTS: Number of attributes (bits: 7-3).
Calculated in real-time, if bit range is too small
- Byte 1- 2: NAME: Namespace Flag (bit: 15), Name (bits: 14-0)
- Byte 3: NURI: Namespace URI
- Byte 4- 7: DIST: Distance to parent node
- Byte 8-11: SIZE: Number of descendants
TEXT, COMMENT, PI NODES (kind = 2, 4, 5):
- Byte 3- 7: TEXT: Text reference
- Byte 8-11: DIST: Distance to parent node
ATTRIBUTE NODES (kind = 3):
- Byte 0: DIST: Distance to parent node (bits: 7-3)
Calculated in real-time, if bit range is too small
- Byte 1- 2: NAME: Namespace Flag (bit: 15), Name (bits: 14-0)
- Byte 3- 7: TEXT: Attribute value reference
- Byte 11: NURI: Namespace (bits: 7-3)
| Modifier and Type | Field and Description |
|---|---|
Names |
atnindex
Attribute name index.
|
static byte |
ATTR
Node kind: Attribute.
|
Index |
atvindex
Attribute value index.
|
static byte |
COMM
Node kind: Comment.
|
static byte |
DOC
Node kind: Document.
|
static byte |
ELEM
Node kind: Element.
|
Index |
ftxindex
Full-text index instance.
|
MetaData |
meta
Meta data.
|
Namespaces |
nspaces
Namespace index.
|
PathSummary |
paths
Path summary index.
|
static byte |
PI
Node kind: Processing Instruction.
|
int |
pins
Number of current database users.
|
Resources |
resources
Resource index.
|
Names |
tagindex
Tag index.
|
static byte |
TEXT
Node kind: Text.
|
Index |
txtindex
Text index.
|
| Constructor and Description |
|---|
Data() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
atom(int pre)
Returns an atomized content for any node kind.
|
void |
attr(int pre,
int dist,
int name,
byte[] value,
int uri,
boolean ne)
Adds an attribute entry to the internal update buffer.
|
int |
attSize(int pre,
int kind)
Returns a number of attributes.
|
byte[] |
attValue(int att,
int pre)
Finds the specified attribute and returns its value.
|
abstract void |
close()
Closes the current database.
|
abstract void |
closeIndex(IndexToken.IndexType type)
Closes the specified index.
|
int |
count(IndexToken token)
Returns the number of indexed pre references for the specified token.
|
void |
delete(int pre)
Deletes a node and its descendants.
|
protected abstract void |
delete(int pre,
boolean text)
Deletes the specified text entry.
|
void |
doc(int pre,
int size,
byte[] value)
Adds a document entry to the internal update buffer.
|
void |
elem(int dist,
int name,
int asize,
int size,
int uri,
boolean ne)
Adds an element entry to the internal update buffer.
|
abstract void |
flush()
Flushes the database.
|
int |
id(int pre)
Returns a unique node id.
|
protected abstract long |
index(int pre,
int id,
byte[] value,
int kind)
Indexes a text and returns the reference.
|
protected abstract void |
indexDelete(int pre,
int size)
Delete a node and its descendants from the corresponding indexes.
|
byte[] |
info(IndexToken.IndexType type)
Returns info on the specified index structure.
|
void |
insert(int pre)
Inserts the internal buffer to the storage
without updating the table structure.
|
void |
insert(int ipre,
int ipar,
Data data)
Inserts a data instance at the specified pre value.
|
void |
insertAttr(int pre,
int par,
Data data)
Inserts attributes.
|
boolean |
isEmpty()
Checks if the database contains no documents.
|
IndexIterator |
iter(IndexToken token)
Returns the indexed pre references for the specified token.
|
int |
kind(int pre)
Returns a node kind.
|
int |
name(int pre)
Returns a reference to the tag or attribute name id.
|
byte[] |
name(int pre,
int kind)
Returns a tag, attribute or pi name.
|
Atts |
ns(int pre)
Returns all namespace keys and values.
|
boolean |
nsFlag(int pre)
Returns the namespace flag of the addressed element.
|
void |
nsFlag(int pre,
boolean ne)
Sets the namespace flag.
|
int |
parent(int pre,
int kind)
Returns a pre value of the parent node.
|
abstract boolean |
pinned()
Checks if this database is also opened (pinned) by other instances.
|
int |
pre(int id)
Returns a pre value.
|
int[] |
pre(int[] ids,
int off,
int len)
Returns pre values.
|
void |
replace(int rpre,
Data data)
Replaces parts of the database with the specified data instance.
|
abstract void |
setIndex(IndexToken.IndexType type,
Index index)
Assigns the specified index.
|
boolean |
single()
Checks if the database contains a single document.
|
int |
size(int pre,
int kind)
Returns a size value (number of descendant table entries).
|
void |
size(int pre,
int kind,
int value)
Sets the size value.
|
abstract byte[] |
text(int pre,
boolean text)
Returns a text (text, comment, pi) or attribute value.
|
void |
text(int pre,
int dist,
byte[] value,
int kind)
Adds a text entry to the internal update buffer.
|
abstract double |
textDbl(int pre,
boolean text)
Returns a text (text, comment, pi) or attribute value as double value.
|
abstract long |
textItr(int pre,
boolean text)
Returns a text (text, comment, pi) or attribute value as integer value.
|
abstract int |
textLen(int pre,
boolean text)
Returns the byte length of a text (text, comment, pi).
|
java.lang.String |
toString() |
abstract boolean |
update(boolean updating)
Marks a database as updating.
|
void |
update(int pre,
int kind,
byte[] value)
Updates (replaces) the value of a single text, comment, pi or
attribute node.
|
void |
update(int pre,
int kind,
byte[] name,
byte[] uri)
Updates (renames) an element, attribute or pi name.
|
protected abstract void |
updateText(int pre,
byte[] value,
int kind)
Updates the specified text or attribute value.
|
int |
uri(int pre,
int kind)
Returns a reference to the namespace of the addressed element or attribute.
|
public static final byte DOC
public static final byte ELEM
public static final byte TEXT
public static final byte ATTR
public static final byte COMM
public static final byte PI
public final Resources resources
public MetaData meta
public Names tagindex
public Names atnindex
public Namespaces nspaces
public PathSummary paths
public Index txtindex
public Index atvindex
public Index ftxindex
public int pins
public abstract void close()
throws java.io.IOException
java.io.IOException - I/O exceptionpublic abstract void flush()
public final boolean isEmpty()
public final boolean single()
public abstract void closeIndex(IndexToken.IndexType type) throws java.io.IOException
type - index to be closedjava.io.IOException - I/O exceptionpublic abstract void setIndex(IndexToken.IndexType type, Index index)
type - index to be openedindex - index instancepublic abstract boolean update(boolean updating)
updating - updating flag (start/stop updating process)public abstract boolean pinned()
public final IndexIterator iter(IndexToken token)
token - index token referencepublic final int count(IndexToken token)
token - text to be foundpublic final byte[] info(IndexToken.IndexType type)
type - index typepublic final byte[] atom(int pre)
pre - pre valuepublic final int pre(int id)
id - unique node idpublic final int[] pre(int[] ids,
int off,
int len)
ids - unique node idsoff - start offsetlen - number of idspublic final int id(int pre)
pre - pre valuepublic final int kind(int pre)
pre - pre valuepublic final int parent(int pre,
int kind)
pre - pre valuekind - node kindpublic final int size(int pre,
int kind)
pre - pre valuekind - node kindpublic final int attSize(int pre,
int kind)
pre - pre valuekind - node kindpublic final byte[] attValue(int att,
int pre)
att - the attribute id of the attribute to be foundpre - pre valuepublic final int name(int pre)
pre - pre valuepublic final byte[] name(int pre,
int kind)
pre - pre valuekind - node kindpublic final int uri(int pre,
int kind)
pre - pre valuekind - node kindpublic final boolean nsFlag(int pre)
pre - pre valuepublic final Atts ns(int pre)
pre - pre valuepublic abstract byte[] text(int pre,
boolean text)
pre - pre valuetext - text/attribute flagpublic abstract long textItr(int pre,
boolean text)
pre - pre valuetext - text/attribute flagpublic abstract double textDbl(int pre,
boolean text)
pre - pre valuetext - text/attribute flagpublic abstract int textLen(int pre,
boolean text)
pre - pre valuetext - text/attribute flagpublic final void update(int pre,
int kind,
byte[] name,
byte[] uri)
pre - pre valuekind - node kindname - new tag, attribute or pi nameuri - uripublic final void update(int pre,
int kind,
byte[] value)
pre - pre value to be replacedkind - node kindvalue - value to be updated (tag name, text, comment, pi)public final void replace(int rpre,
Data data)
rpre - pre value to be replaceddata - replace datapublic final void delete(int pre)
pre - pre value of the node to deletepublic final void insertAttr(int pre,
int par,
Data data)
pre - pre valuepar - parent of nodedata - data instance to copy frompublic final void insert(int ipre,
int ipar,
Data data)
ipre - value at which to insert new dataipar - parent pre value of nodedata - data instance to copy frompublic final void size(int pre,
int kind,
int value)
pre - pre referencekind - node kindvalue - value to be storedprotected abstract void updateText(int pre,
byte[] value,
int kind)
pre - pre valuevalue - contentkind - node kindpublic final void nsFlag(int pre,
boolean ne)
pre - pre valuene - namespace flagpublic final void insert(int pre)
pre - insert positionprotected abstract void delete(int pre,
boolean text)
pre - pre valuetext - text (text, comment or pi) or attribute flagpublic final void doc(int pre,
int size,
byte[] value)
pre - pre valuesize - node sizevalue - document namepublic final void elem(int dist,
int name,
int asize,
int size,
int uri,
boolean ne)
dist - parent distancename - tag name indexasize - number of attributessize - node sizeuri - namespace uri referencene - namespace flagpublic final void text(int pre,
int dist,
byte[] value,
int kind)
pre - pre valuedist - parent distancevalue - string valuekind - node kindpublic final void attr(int pre,
int dist,
int name,
byte[] value,
int uri,
boolean ne)
pre - pre valuedist - parent distancename - attribute namevalue - attribute valueuri - namespace uri referencene - namespace flagprotected abstract long index(int pre,
int id,
byte[] value,
int kind)
pre - pre valueid - id valuevalue - text to be indexedkind - node kindprotected abstract void indexDelete(int pre,
int size)
pre - pre value of the node to deletesize - number of descendantspublic final java.lang.String toString()
toString in class java.lang.Object