|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.data.Data
org.basex.data.DiskData
public final class DiskData
This class stores and organizes the node table and the index structures for textual content. All nodes in the table are accessed by their implicit pre value. Some restrictions on the data are currently given:
ELEMENT NODES: - Byte 0: KIND: Node kind (ELEM) - Byte 1-2: NSPC: Namespace (4), NS Definition flag (1) and Name (11 bits) - Byte 3: ATTS: Number of attributes - 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 0: KIND: Node kind (DOC) - Byte 3- 7: TEXT: Text reference - Byte 8-11: SIZE: Number of descendants - Byte 12-15: UNID: Unique Node ID TEXT NODES: - Byte 0: KIND: Node kind (TEXT/COMM/PI) - 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: KIND: Node kind (ATTR) - Byte 1-2: NSPC: Namespace (4) and Name (11 bits) - Byte 3- 7: TEXT: Attribute value reference - Byte 11: DIST: Distance to parent node - Byte 12-15: UNID: Unique Node ID
Field Summary |
---|
Fields inherited from class org.basex.data.Data |
---|
ATTR, atts, COMM, DOC, ELEM, fs, meta, nameID, ns, PI, size, sizeID, skel, tags, TEXT |
Constructor Summary | |
---|---|
DiskData(java.lang.String db)
Default Constructor. |
|
DiskData(java.lang.String db,
boolean index)
Constructor, specifying if indexes are to be opened as well. |
Method Summary | |
---|---|
int |
attLen(int pre)
Returns an attribute value length. |
int |
attNameID(int pre)
Returns an attribute name id (reference to the attribute name index). |
int |
attNS(int pre)
Returns an attribute namespace (reference to the attribute namespace). |
double |
attNum(int pre)
Returns an attribute value as double value. |
int |
attSize(int pre,
int kind)
Returns a number of attributes. |
byte[] |
attValue(int pre)
Returns an attribute value. |
void |
close()
Closes the current database. |
void |
closeIndex(IndexToken.Type index)
Closes the specified index. |
void |
cls()
Closes the database without writing data back to disk. |
void |
delete(int pre)
Deletes a node and its descendants. |
void |
flush()
Flushes the table data. |
int |
id(int pre)
Returns a unique node id. |
void |
insert(int pre,
int par,
byte[] name,
byte[] val)
Inserts an attribute. |
void |
insert(int pre,
int par,
byte[] val,
int kind)
Inserts a tag name, text node, comment or processing instruction. |
void |
insert(int pre,
int par,
Data dt)
Insert a data instance at the specified pre value. |
int |
kind(int pre)
Returns a node kind. |
int[] |
ns(int pre)
Returns namespace key and value ids. |
int |
parent(int pre,
int kind)
Returns a pre value of the parent node. |
int |
pre(int id)
Returns a pre value. |
void |
setIndex(IndexToken.Type type,
Index index)
Assigns the specified index. |
int |
size(int pre,
int k)
Returns a size value (number of descendant table entries). |
int |
tagID(int pre)
Returns a tag id (reference to the tag index). |
int |
tagNS(int pre)
Returns a tag namespace (reference to the tag namespace). |
byte[] |
text(int pre)
Returns a text. |
int |
textLen(int pre)
Returns a text length. |
double |
textNum(int pre)
Returns a text as double value. |
void |
update(int pre,
byte[] val)
Updates a tag name, text node, comment or processing instruction. |
void |
update(int pre,
byte[] name,
byte[] val)
Updates an attribute name and value. |
Methods inherited from class org.basex.data.Data |
---|
atom, atomNum, attName, attNameID, attValue, doc, ids, info, initNames, nrIDs, tag, tagID, update |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiskData(java.lang.String db) throws java.io.IOException
db
- name of database
java.io.IOException
- IO Exceptionpublic DiskData(java.lang.String db, boolean index) throws java.io.IOException
db
- name of databaseindex
- open indexes
java.io.IOException
- IO ExceptionMethod Detail |
---|
public void flush()
Data
flush
in class Data
public void close() throws java.io.IOException
Data
close
in class Data
java.io.IOException
- in case the database could not be closedpublic void cls() throws java.io.IOException
java.io.IOException
- I/O exceptionpublic void closeIndex(IndexToken.Type index) throws java.io.IOException
Data
closeIndex
in class Data
index
- index to be closed
java.io.IOException
- in case the index could not be closedpublic void setIndex(IndexToken.Type type, Index index)
Data
setIndex
in class Data
type
- index to be openedindex
- index instancepublic int id(int pre)
Data
id
in class Data
pre
- pre value
public int pre(int id)
Data
pre
in class Data
id
- unique node id
public int kind(int pre)
Data
kind
in class Data
pre
- pre value
public int parent(int pre, int kind)
Data
parent
in class Data
pre
- pre valuekind
- node kind
public int attSize(int pre, int kind)
Data
attSize
in class Data
pre
- pre valuekind
- node kind
public int size(int pre, int k)
Data
size
in class Data
pre
- pre valuek
- node kind
public int tagID(int pre)
Data
tagID
in class Data
pre
- pre value
public int tagNS(int pre)
Data
tagNS
in class Data
pre
- pre value
public int[] ns(int pre)
Data
ns
in class Data
pre
- pre value
public int attNameID(int pre)
Data
attNameID
in class Data
pre
- pre value
public int attNS(int pre)
Data
attNS
in class Data
pre
- pre value
public byte[] text(int pre)
Data
text
in class Data
pre
- pre value
public byte[] attValue(int pre)
Data
attValue
in class Data
pre
- pre value
public double textNum(int pre)
Data
textNum
in class Data
pre
- pre value
public double attNum(int pre)
Data
attNum
in class Data
pre
- pre value
public int textLen(int pre)
Data
textLen
in class Data
pre
- pre value
public int attLen(int pre)
Data
attLen
in class Data
pre
- pre value
public void update(int pre, byte[] val)
Data
update
in class Data
pre
- pre of the text node to changeval
- value to be updatedpublic void update(int pre, byte[] name, byte[] val)
Data
update
in class Data
pre
- pre of node to insert aftername
- attribute nameval
- attribute valuepublic void delete(int pre)
Data
delete
in class Data
pre
- pre value of the node to deletepublic void insert(int pre, int par, byte[] val, int kind)
Data
insert
in class Data
pre
- pre valuepar
- parent of nodeval
- value to be insertedkind
- node kindpublic void insert(int pre, int par, byte[] name, byte[] val)
Data
insert
in class Data
pre
- pre valuepar
- parent of nodename
- attribute nameval
- attribute valuepublic void insert(int pre, int par, Data dt)
Data
insert
in class Data
pre
- pre valuepar
- parent of nodedt
- data instance to copy from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |