public abstract class Data
extends java.lang.Object
pre value, which is not stored itself, but
given by the table position. The following restrictions are imposed on the data:
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)
As all methods of this class are optimized for performance, no checks are
performed on the arguments (e.g.: if the string value of a text node is
requested, the specified pre value must point to a text node).| Modifier and Type | Field and Description |
|---|---|
Names |
atnindex
Attribute name index.
|
static byte |
ATTR
Node kind: attribute (code:
3). |
Index |
atvindex
Attribute value index.
|
static byte |
COMM
Node kind: comment (code:
4). |
static byte |
DOC
Node kind: document (code:
0). |
static byte |
ELEM
Node kind: element (code:
1). |
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 (code:
5). |
int |
pins
Number of current database users.
|
Resources |
resources
Resource index.
|
Names |
tagindex
Tag index.
|
static byte |
TEXT
Node kind: text (code:
2). |
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 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 |
finishUpdate()
Finishes an update operation: removes the update file and the exclusive lock.
|
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.
|
boolean |
inMemory()
Indicates if this data instance is in main memory or on disk.
|
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)
|
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.
|
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 boolean |
startUpdate()
Starts an update operation: writes a file to disk to indicate that an update is
going on, and exclusively locks the table.
|
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() |
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
0).public static final byte ELEM
1).public static final byte TEXT
2).public static final byte ATTR
3).public static final byte COMM
4).public static final byte PI
5).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()
public final boolean isEmpty()
public final boolean single()
public abstract void closeIndex(IndexToken.IndexType type)
type - index to be closedpublic abstract void setIndex(IndexToken.IndexType type, Index index)
type - index to be openedindex - index instancepublic abstract boolean startUpdate()
public abstract void finishUpdate()
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 boolean inMemory()
public final java.lang.String toString()
toString in class java.lang.Object