|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.core.Progress
org.basex.build.Builder
public abstract class Builder
This class provides an interface for building database instances.
The specified Parser
send events to this class whenever nodes
are to be added or closed. The builder implementation decides whether
the nodes are stored on disk or kept in memory.
Field Summary | |
---|---|
int |
elms
Element counter. |
MetaData |
meta
Meta data on built database. |
int |
size
Table size. |
Method Summary | |
---|---|
abstract void |
addAttr(int n,
int s,
byte[] v,
int d)
Adds an attribute to the database. |
abstract void |
addDoc(byte[] tok)
Adds a document node to the database. |
abstract void |
addElem(int tok,
int tns,
int dis,
int as,
boolean n)
Adds an element node to the database. |
abstract void |
addText(byte[] tok,
int dis,
byte kind)
Adds a text node to the database. |
Data |
build(Parser p,
java.lang.String db)
Builds the database by running the specified parser. |
abstract void |
close()
Closes open references. |
void |
comment(TokenBuilder com)
Stores a comment. |
java.lang.String |
det()
Returns short information on this process. |
void |
emptyElem(byte[] tag,
Atts att)
Stores an empty element. |
void |
encoding(java.lang.String enc)
Sets the document encoding. |
void |
endDoc()
Closes a document node. |
void |
endElem(byte[] tag)
Closes an element. |
abstract Data |
finish()
Finishes the build process and returns a database reference. |
abstract Builder |
init(java.lang.String db)
Initializes the database construction. |
void |
nodeAndText(byte[] tag,
Atts att,
byte[] txt)
Convenience method for adding an element and text node. |
void |
pi(TokenBuilder pi)
Stores a processing instruction. |
double |
prog()
Returns progress information. |
abstract void |
setAttValue(int pre,
byte[] val)
Stores an attribute value to the specified table position. |
abstract void |
setSize(int pre,
int val)
Stores a size value to the specified table position. |
void |
startDoc(byte[] doc)
Opens a document node. |
int |
startElem(byte[] tag,
Atts att)
Opens a new element node. |
void |
startNS(byte[] name,
byte[] val)
Adds a new namespace; called by the building instance. |
void |
text(TokenBuilder t,
boolean w)
Stores a text node. |
java.lang.String |
tit()
Returns short information on this process. |
Methods inherited from class org.basex.core.Progress |
---|
checkStop, detail, progress, progress, stop, title |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public MetaData meta
public int size
public int elms
Method Detail |
---|
public abstract Builder init(java.lang.String db) throws java.io.IOException
db
- name of database
java.io.IOException
- in case of parsing or writing problemspublic abstract Data finish() throws java.io.IOException
java.io.IOException
- in case of parsing or writing problemspublic abstract void close() throws java.io.IOException
java.io.IOException
- in case of parsing or writing problemspublic abstract void addDoc(byte[] tok) throws java.io.IOException
tok
- the token to be added (tag name or content)
java.io.IOException
- in case of parsing or writing problemspublic abstract void addElem(int tok, int tns, int dis, int as, boolean n) throws java.io.IOException
setSize(int, int)
has
to be called with the final size value.
tok
- the tag name referencetns
- the tag namespacedis
- distance (relative parent reference)as
- number of attributesn
- element has namespaces
java.io.IOException
- in case of parsing or writing problemspublic abstract void addAttr(int n, int s, byte[] v, int d) throws java.io.IOException
n
- attribute names
- namespacev
- attribute valued
- distance (relative parent reference)
java.io.IOException
- in case of parsing or writing problemspublic abstract void addText(byte[] tok, int dis, byte kind) throws java.io.IOException
tok
- the token to be added (tag name or content)dis
- distance (relative parent reference)kind
- the node kind
java.io.IOException
- in case of parsing or writing problemspublic abstract void setSize(int pre, int val) throws java.io.IOException
pre
- pre referenceval
- value to be stored
java.io.IOException
- in case of parsing or writing problemspublic abstract void setAttValue(int pre, byte[] val) throws java.io.IOException
pre
- pre referenceval
- value to be stored
java.io.IOException
- in case of parsing or writing problemspublic final Data build(Parser p, java.lang.String db) throws java.io.IOException
p
- parser instancedb
- name of database
java.io.IOException
- in case of parsing or writing problemspublic final void startDoc(byte[] doc) throws java.io.IOException
doc
- document name
java.io.IOException
- in case of parsing or writing problemspublic final void endDoc() throws java.io.IOException
java.io.IOException
- in case of parsing or writing problemspublic final void startNS(byte[] name, byte[] val)
name
- the attribute name to be processedval
- attribute valuepublic final int startElem(byte[] tag, Atts att) throws java.io.IOException
tag
- tag nameatt
- attributes
java.io.IOException
- in case of parsing or writing problemspublic final void emptyElem(byte[] tag, Atts att) throws java.io.IOException
tag
- tag nameatt
- attributes
java.io.IOException
- in case of parsing or writing problemspublic final void endElem(byte[] tag) throws java.io.IOException
tag
- tag name
java.io.IOException
- in case of parsing or writing problemspublic final void text(TokenBuilder t, boolean w) throws java.io.IOException
t
- text valuew
- whitespace flag
java.io.IOException
- in case of parsing or writing problemspublic final void comment(TokenBuilder com) throws java.io.IOException
com
- comment text
java.io.IOException
- in case of parsing or writing problemspublic final void pi(TokenBuilder pi) throws java.io.IOException
pi
- processing instruction name and value
java.io.IOException
- in case of parsing or writing problemspublic final void encoding(java.lang.String enc)
enc
- encodingpublic final void nodeAndText(byte[] tag, Atts att, byte[] txt) throws java.io.IOException
tag
- the tag to be processedatt
- attributestxt
- text node
java.io.IOException
- in case of parsing or writing problemspublic final java.lang.String tit()
Progress
public final java.lang.String det()
Progress
det
in class Progress
public final double prog()
Progress
prog
in class Progress
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |