|
|||||||||
| 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.MemData
public class MemData
This class stores and organizes the database table and the index structures for textual content in a compressed memory structure. Each node occupies 64 bits. The current storage layout looks like follows:
ELEMENTS: - Byte 0: Node kind (TAG) - Byte 1: Tag Reference - Byte 2: Number of attributes - Byte 4- 7: Number of descendants (size) - Byte 4- 7: Relative parent reference TEXT NODES: - Byte 0: Node kind (TEXT/PI/COMM) - Byte 0- 3: Text reference - Byte 4- 7: Parent Reference ATTRIBUTE NODES: - Byte 0: Node kind (ATTR) - Byte 1: Attribute name reference - Byte 2: Relative parent reference - Byte 4- 7: Attribute value Reference
| Field Summary |
|---|
| Fields inherited from class org.basex.data.Data |
|---|
ATTR, atts, COMM, contentID, deepfs, dirID, DOC, ELEM, fileID, meta, nameID, PI, size, sizeID, suffixID, tags, TEXT, timeID |
| Constructor Summary | |
|---|---|
MemData(int cap,
Names tag,
Names att)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAtt(byte[] a,
byte[] v,
int p)
Convenience method for adding an attribute. |
void |
addAtt(int a,
byte[] v,
int d)
Adds an attribute. |
void |
addElem(byte[] t,
int d,
int a,
int s,
int k)
Convenience method for adding an element. |
void |
addElem(int t,
int d,
int a,
int s,
int k)
Adds an element. |
void |
addText(byte[] t,
int d,
int k)
Adds a text node. |
void |
append(MemData d,
int p)
Copies some data. |
int |
attID(byte[] v)
Returns the id for the specified attribute value. |
int |
attNameID(int pre)
Returns an attribute name id (reference to the attribute name index). |
double |
attNum(int pre)
Returns an attribute value as double value. |
int |
attSize(int pre,
int kind)
Returns a number of attributes. |
byte[] |
attToken(int id)
Returns the index value for the specified attribute value id. |
byte[] |
attValue(int pre)
Returns an attribute value. |
void |
close()
Closes the current database. |
void |
closeIndex(Index.TYPE index)
Closes the specified index. |
void |
delete(int pre)
Deletes a node and its descendants. |
void |
finishTag(int pre)
Adds the size value to the table. |
void |
flush()
Flushes the table data. |
int[][] |
ftIDs(byte[] word,
FTOption ftOption)
Returns the indexed id references for the specified fulltext token. |
int |
id(int pre)
Returns a unique node id. |
void |
info(PrintOutput out)
Returns info on the index structures. |
void |
insert(int pre,
int par,
byte[] tag,
byte kind)
Inserts a tag name, text node, comment or processing instruction. |
void |
insert(int pre,
int par,
byte[] name,
byte[] v)
Inserts an attribute. |
void |
insert(int pre,
int par,
Data d)
Insert a data instance at the specified pre value. |
void |
insert(MemData d,
int pos)
Inserts a data instance at the specified position. |
int |
kind(int pre)
Returns a node kind. |
int |
nrFTIDs(byte[] token)
Returns the number of indexed id references for the specified token. |
void |
openIndex(Index.TYPE type,
Index ind)
Opens the specified index. |
int |
parent(int pre,
int kind)
Returns a pre value of the parent node. |
int |
pre(int id)
Returns a pre value. |
int |
size(int pre,
int kind)
Returns a size value (number of descendant table entries). |
int |
tagID(int pre)
Returns a tag id (reference to the tag index). |
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. |
byte[] |
textToken(int id)
Returns the index value for the specified index id. |
void |
update(int pre,
byte[] text)
Updates a tag name, text node, comment or processing instruction. |
void |
update(int pre,
byte[] attName,
byte[] attValue)
Updates an attribute name and value. |
| Methods inherited from class org.basex.data.Data |
|---|
atom, atomNum, attName, attNameID, attValue, ids, initNames, noLeaf, nrIDs, nrTags, tag, tagID |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemData(int cap,
Names tag,
Names att)
cap - initial array capacitytag - tag indexatt - attribute name index| Method Detail |
|---|
public final void addAtt(byte[] a,
byte[] v,
int p)
a - attribute namev - attribute valuep - parent
public final void addAtt(int a,
byte[] v,
int d)
a - attribute namev - attribute valued - distance
public final void addElem(byte[] t,
int d,
int a,
int s,
int k)
t - tagd - distancea - number of attributess - node sizek - node kind
public final void addElem(int t,
int d,
int a,
int s,
int k)
t - tagd - distancea - number of attributess - node sizek - node kind
public final void addText(byte[] t,
int d,
int k)
t - text to be addedd - distancek - node kind
public final void append(MemData d,
int p)
d - data referencep - positionpublic final int attID(byte[] v)
v - attribute value
public final int attNameID(int pre)
Data
attNameID in class Datapre - pre value
public final double attNum(int pre)
Data
attNum in class Datapre - pre value
public final int attSize(int pre,
int kind)
Data
attSize in class Datapre - pre valuekind - node kind
public final byte[] attToken(int id)
id - index id
public final byte[] attValue(int pre)
Data
attValue in class Datapre - pre value
public void close()
Data
close in class Datapublic void closeIndex(Index.TYPE index)
Data
closeIndex in class Dataindex - index to be closedpublic final void delete(int pre)
Data
delete in class Datapre - pre value of the node to deletepublic final void finishTag(int pre)
pre - closing pre tagpublic void flush()
Data
flush in class Data
public int[][] ftIDs(byte[] word,
FTOption ftOption)
Data
ftIDs in class Dataword - token to be looked upftOption - fulltext options
public final int id(int pre)
Data
id in class Datapre - pre value
public final void info(PrintOutput out)
Data
info in class Dataout - output stream
public final void insert(int pre,
int par,
byte[] tag,
byte kind)
Data
insert in class Datapre - pre valuepar - parent of nodetag - value to be insertedkind - node kind
public void insert(int pre,
int par,
byte[] name,
byte[] v)
Data
insert in class Datapre - pre valuepar - parent of nodename - attribute namev - attribute value
public final void insert(int pre,
int par,
Data d)
Data
insert in class Datapre - pre valuepar - parent of noded - data instance to copy from
public final void insert(MemData d,
int pos)
d - data instancepos - insertion positionpublic final int kind(int pre)
Data
kind in class Datapre - pre value
public final int nrFTIDs(byte[] token)
Data
nrFTIDs in class Datatoken - token to be looked up
public void openIndex(Index.TYPE type,
Index ind)
Data
openIndex in class Datatype - index to be openedind - index instance
public final int parent(int pre,
int kind)
Data
parent in class Datapre - pre valuekind - node kind
public final int pre(int id)
Data
pre in class Dataid - unique node id
public final int size(int pre,
int kind)
Data
size in class Datapre - pre valuekind - node kind
public final int tagID(int pre)
Data
tagID in class Datapre - pre value
public final byte[] text(int pre)
Data
text in class Datapre - pre value
public final int textLen(int pre)
Data
textLen in class Datapre - pre value
public final double textNum(int pre)
Data
textNum in class Datapre - pre value
public final byte[] textToken(int id)
id - index id
public final void update(int pre,
byte[] text)
Data
update in class Datapre - pre of the text node to changetext - value to be updated
public final void update(int pre,
byte[] attName,
byte[] attValue)
Data
update in class Datapre - pre of node to insert afterattName - attribute nameattValue - attribute value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||