Package org.basex.data
Class MemData
java.lang.Object
org.basex.data.Data
org.basex.data.MemData
This class stores and organizes the database table and the index structures
for textual content in a compressed memory structure.
The table mapping is documented in
Data.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionMemData(MainOptions opts) Constructor for creating a new, empty database.MemData(PathIndex paths, Namespaces nspaces, MainOptions opts) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateIndex(IndexType type, Command cmd) Drops the specified index.protected voiddelete(int pre, boolean text) Deletes the specified text entry.voidDrops the specified index.voidfinishUpdate(MainOptions opts) Finishes an update operation: removes the update file and the exclusive lock.voidflush(boolean all) Flushes updated data.booleaninMemory()Indicates if this data instance is in main memory or on disk.voidstartUpdate(MainOptions opts) Starts an update operation: writes a file to disk to indicate that an update is going on, and exclusively locks the table file.byte[]text(int pre, boolean text) Returns a text (text, comment, pi, document) or attribute value.doubletextDbl(int pre, boolean text) Returns a text (text, comment, pi, document) or attribute value as double value.longtextItr(int pre, boolean text) Returns a text (text, comment, pi, document) or attribute value as integer value.inttextLen(int pre, boolean text) Returns the byte length of a (possibly compressed) text (text, comment, pi, document).protected longtextRef(byte[] value, boolean text) Generates a reference for a text (text, comment, pi, pi, document) or attribute value.protected voidupdateText(int pre, byte[] value, int kind) Updates the specified text or attribute value.values(boolean text) Returns the string values of the database.Methods inherited from class org.basex.data.Data
atom, attr, attSize, attValue, close, closed, costs, defaultNs, delete, dist, dist, doc, elem, id, id, index, indexAdd, indexDelete, info, insert, insert, insertAttr, iter, kind, name, nameId, namespaces, nsFlag, nsFlag, parent, pre, qname, replace, size, size, text, textRef, textRef, toString, update, update, uriId
-
Constructor Details
-
MemData
Constructor.- Parameters:
paths- path indexnspaces- namespacesopts- database options
-
MemData
Constructor for creating a new, empty database.- Parameters:
opts- database options
-
-
Method Details
-
createIndex
Description copied from class:DataDrops the specified index.- Specified by:
createIndexin classData- Parameters:
type- index to be droppedcmd- calling command- Throws:
IOException- I/O exception
-
dropIndex
Description copied from class:DataDrops the specified index.- Specified by:
dropIndexin classData- Parameters:
type- index to be dropped- Throws:
BaseXException- database exception
-
startUpdate
Description copied from class:DataStarts an update operation: writes a file to disk to indicate that an update is going on, and exclusively locks the table file.- Specified by:
startUpdatein classData- Parameters:
opts- main options
-
finishUpdate
Description copied from class:DataFinishes an update operation: removes the update file and the exclusive lock.- Specified by:
finishUpdatein classData- Parameters:
opts- main options
-
flush
public void flush(boolean all) Description copied from class:DataFlushes updated data. -
text
public byte[] text(int pre, boolean text) Description copied from class:DataReturns a text (text, comment, pi, document) or attribute value. -
textItr
public long textItr(int pre, boolean text) Description copied from class:DataReturns a text (text, comment, pi, document) or attribute value as integer value.Long.MIN_VALUEis returned if the input is no valid integer. -
textDbl
public double textDbl(int pre, boolean text) Description copied from class:DataReturns a text (text, comment, pi, document) or attribute value as double value.Double.NaNis returned if the input is no valid double. -
textLen
public int textLen(int pre, boolean text) Description copied from class:DataReturns the byte length of a (possibly compressed) text (text, comment, pi, document). -
inMemory
public boolean inMemory()Description copied from class:DataIndicates if this data instance is in main memory or on disk. -
values
Returns the string values of the database.- Parameters:
text- text/attribute flag- Returns:
- set
-
delete
protected void delete(int pre, boolean text) Description copied from class:DataDeletes the specified text entry. -
updateText
protected void updateText(int pre, byte[] value, int kind) Description copied from class:DataUpdates the specified text or attribute value.- Specified by:
updateTextin classData- Parameters:
pre- pre valuevalue- contentkind- node kind
-
textRef
protected long textRef(byte[] value, boolean text) Description copied from class:DataGenerates a reference for a text (text, comment, pi, pi, document) or attribute value.
-