|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.data.Data
public abstract class Data
This class provides access to the database storage. Note that the methods of this class are optimized for performance. They will not check if correct data is requested, i.e. if a text is requested, a pre value must points to a text node. All nodes in the table are accessed by their implicit pre value. The following restrictions are imposed on the data:
COMMON ATTRIBUTES: - Byte 0: KIND: Node kind (2-0) ELEMENT NODES: - Byte 0: ATTS: Number of attributes (7-3) - Byte 1-2: NAME: Namespace Flag (15), Name (14-0) - Byte 3: NURI: Namespace URI - Byte 4- 7: DIST: Distance to parent node - Byte 8-11: SIZE: Number of descendants - Byte 12-15: UNID: Unique Node ID DOCUMENT NODES: - Byte 3- 7: TEXT: Text reference - Byte 8-11: SIZE: Number of descendants - Byte 12-15: UNID: Unique Node ID TEXT, COMMENT, PI NODES: - Byte 3- 7: TEXT: Text reference - Byte 8-11: DIST: Distance to parent node - Byte 12-15: UNID: Unique Node ID ATTRIBUTE NODES: - Byte 0: DIST: Distance to parent node (7-3) - Byte 1-2: NAME: Namespace Flag (15), Name (14-0) - Byte 3- 7: TEXT: Attribute value reference - Byte 11: NURI: Namespace (7-3) - Byte 12-15: UNID: Unique Node ID
Nested Class Summary | |
---|---|
static class |
Data.Type
Index types. |
Field Summary | |
---|---|
static byte |
ATTR
Node kind: Attribute. |
Names |
atts
Attribute name index. |
static byte |
COMM
Node kind: Comment. |
static byte |
DOC
Node kind: Document. |
static byte |
ELEM
Node kind: Element. |
DeepFS |
fs
File system reference. |
MetaData |
meta
Meta data. |
int |
nameID
Index Reference for name tag. |
Namespaces |
ns
Namespace index. |
PathSummary |
path
Path Summary. |
static byte |
PI
Node kind: Processing Instruction. |
int |
sizeID
Index References. |
Names |
tags
Tag index. |
static byte |
TEXT
Node kind: Text. |
Constructor Summary | |
---|---|
Data()
|
Method Summary | |
---|---|
byte[] |
atom(int pre)
Returns an atomized content for any node kind. |
void |
attr(int pre,
int d,
int tn,
byte[] vl,
int u,
boolean ne)
Adds an attribute entry to the internal update buffer. |
int |
attSize(int pre,
int k)
Returns a number of attributes. |
void |
buffer(int s)
Sets the update buffer to a new size. |
void |
close()
Closes the current database. |
abstract void |
closeIndex(Data.Type index)
Closes the specified index. |
void |
delete(int pre)
Deletes a node and its descendants. |
int[] |
doc()
Returns the document nodes. |
void |
doc(int pre,
int s,
byte[] vl)
Adds a document entry to the internal update buffer. |
void |
elem(int d,
int tn,
int as,
int s,
int u,
boolean ne)
Adds an element entry to the internal update buffer. |
abstract void |
flush()
Flushes the table data. |
int |
id(int pre)
Returns a unique node id. |
IndexIterator |
ids(IndexToken token)
Returns the indexed id references for the specified token. |
byte[] |
info(Data.Type type)
Returns info on the specified index structure. |
void |
init()
Dissolves the references to often used tag names and attributes. |
void |
insert(int pre)
Inserts the internal buffer to the storage without updating the table structure. |
void |
insert(int ipre,
int ipar,
MemData md)
Inserts a data instance at the specified pre value. |
void |
insertAttr(int pre,
int par,
MemData dt)
Inserts attributes. |
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 k)
Returns a tag, attribute or pi name. |
int |
nrIDs(IndexToken token)
Returns the number of indexed id references for the specified token. |
Atts |
ns(int pre)
Returns namespace key and value ids. |
boolean |
nsFlag(int pre)
Returns a namespace flag. |
int |
parent(int pre,
int k)
Returns a pre value of the parent node. |
int |
pre(int id)
Returns a pre value. |
void |
rename(int pre,
int k,
byte[] nm,
byte[] uri)
Renames (updates) an element, attribute or pi name. |
void |
replace(int pre,
int k,
byte[] val)
Replaces (updates) a text, comment, pi or attribute value. |
abstract void |
setIndex(Data.Type type,
Index ind)
Assigns the specified index. |
int |
size(int pre,
int k)
Returns a size value (number of descendant table entries). |
void |
size(int pre,
int k,
int v)
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 d,
byte[] vl,
int k)
Adds a text entry to the internal update buffer. |
abstract int |
textLen(int pre,
boolean text)
Returns a text (text, comment, pi) length. |
abstract double |
textNum(int pre,
boolean text)
Returns a text (text, comment, pi) as double value. |
String |
toString()
|
String |
toString(int s,
int e)
Returns a string representation of the specified table range. |
int |
uri(int pre,
int k)
Returns a reference to the tag or attribute namespace URI. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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 MetaData meta
public Names tags
public Names atts
public Namespaces ns
public PathSummary path
public DeepFS fs
public int nameID
public int sizeID
Constructor Detail |
---|
public Data()
Method Detail |
---|
public void init() throws IOException
IOException
- I/O exceptionpublic final void close() throws IOException
IOException
- I/O exceptionpublic abstract void flush()
public abstract void closeIndex(Data.Type index) throws IOException
index
- index to be closed
IOException
- I/O exceptionpublic abstract void setIndex(Data.Type type, Index ind)
type
- index to be openedind
- index instancepublic final IndexIterator ids(IndexToken token)
token
- index token reference
public final int nrIDs(IndexToken token)
token
- text to be found
public final int[] doc()
public final byte[] info(Data.Type type)
type
- index type
public final byte[] atom(int pre)
pre
- pre value
public final int pre(int id)
id
- unique node id
public final int id(int pre)
pre
- pre value
public final int kind(int pre)
pre
- pre value
public final int parent(int pre, int k)
pre
- pre valuek
- node kind
public final int size(int pre, int k)
pre
- pre valuek
- node kind
public final int attSize(int pre, int k)
pre
- pre valuek
- node kind
public final int name(int pre)
pre
- pre value
public final byte[] name(int pre, int k)
pre
- pre valuek
- node kind
public final int uri(int pre, int k)
pre
- pre valuek
- node kind
public final boolean nsFlag(int pre)
pre
- pre value
public final Atts ns(int pre)
pre
- pre value
public abstract byte[] text(int pre, boolean text)
pre
- pre valuetext
- text/attribute flag
public abstract double textNum(int pre, boolean text)
pre
- pre valuetext
- text/attribute flag
public abstract int textLen(int pre, boolean text)
pre
- pre valuetext
- text/attribute flag
public final void rename(int pre, int k, byte[] nm, byte[] uri)
pre
- pre valuek
- node kindnm
- new tag, attribute or pi nameuri
- uripublic final void replace(int pre, int k, byte[] val)
pre
- pre valuek
- node kindval
- value to be updated (tag name, text, comment, pi)public final void delete(int pre)
pre
- pre value of the node to deletepublic final void insertAttr(int pre, int par, MemData dt)
pre
- pre valuepar
- parent of nodedt
- data instance to copy frompublic final void insert(int ipre, int ipar, MemData md)
ipre
- value at which to insert new dataipar
- parent pre value of nodemd
- data instance to copy frompublic final void size(int pre, int k, int v)
pre
- pre referencek
- node kindv
- value to be storedpublic final void buffer(int s)
s
- number of table entriespublic final void insert(int pre)
pre
- insert positionpublic void doc(int pre, int s, byte[] vl)
pre
- pre values
- node sizevl
- document namepublic final void elem(int d, int tn, int as, int s, int u, boolean ne)
d
- parent distancetn
- tag name indexas
- number of attributess
- node sizeu
- namespace uri referencene
- namespace flagpublic final void text(int pre, int d, byte[] vl, int k)
pre
- insert positiond
- parent distancevl
- tag name or text nodek
- node kindpublic final void attr(int pre, int d, int tn, byte[] vl, int u, boolean ne)
pre
- pre valued
- parent distancetn
- attribute namevl
- attribute valueu
- namespace uri referencene
- namespace flagpublic String toString(int s, int e)
s
- start pre valuee
- end pre value
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |