Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.data
Class MemData

    java.lang.Object
      org.basex.data.Data
          org.basex.data.MemData

    public final class MemData

extends Data

This class stores and organizes the database table and the index structures for textual content in a compressed memory structure. The storage equals the disk storage in `DiskData`.

Author:
  Workgroup DBIS, University of Konstanz 2005-09, ISC License, Christian Gruen

Field Summary

Fields inherited from class org.basex.data.Data
`ATTR, atts, COMM, DOC, ELEM, fs, meta, nameID, ns, path, PI, sizeID, tags, TEXT`

Constructor Summary
`MemData(int cap, Names tag, Names att, Namespaces n, PathSummary s)` Constructor.

Method Summary
`void` | `addAtt(long t, long n, byte[] v, long d)` Adds an attribute.
`void` | `addDoc(byte[] t, long s)` Adds an element.
`void` | `addElem(long t, long n, long d, long a, long s, boolean ne)` Adds an element.
`void` | `addText(byte[] t, long d, long k)` Adds a text node.
`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` | `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[] v)` Inserts an attribute.
`void` | `insert(int pre, int par, byte[] tag, int kind)` Inserts a tag name, text node, comment or processing instruction.
`void` | `insert(int pre, int par, Data d)` 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 k)` Returns a pre value of the parent node.
`int` | `pre(int id)` Returns a pre value.
`void` | `setAttValue(int pre, byte[] val)` Stores an attribute value to the table.
`void` | `setIndex(IndexToken.Type type, Index ind)` Assigns the specified index.
`void` | `setSize(int pre, long val)` Stores a size value to the table.
`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[] 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, attName, attNameID, attValue, doc, ids, info, initNames, nrIDs, tag, tagID`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MemData

    public MemData(int cap,
                   Names tag,
                   Names att,
                   Namespaces n,
                   PathSummary s)

  Constructor.

  Parameters:
    `cap` - initial array capacity
    `tag` - tag index
    `att` - attribute name index
    `n` - namespaces
    `s` - path summary

Method Detail

### flush

    public void flush()

  Description copied from class: `Data`
  Flushes the table data.

  Specified by:
    `flush` in class `Data`

### close

    public void close()

  Description copied from class: `Data`
  Closes the current database.

  Specified by:
    `close` in class `Data`

### closeIndex

    public void closeIndex(IndexToken.Type index)

  Description copied from class: `Data`
  Closes the specified index.

  Specified by:
    `closeIndex` in class `Data`
  Parameters:
    `index` - index to be closed

### setIndex

    public void setIndex(IndexToken.Type type,
                         Index ind)

  Description copied from class: `Data`
  Assigns the specified index.

  Specified by:
    `setIndex` in class `Data`
  Parameters:
    `type` - index to be opened
    `ind` - index instance

### id

    public int id(int pre)

  Description copied from class: `Data`
  Returns a unique node id.

  Specified by:
    `id` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    node id

### pre

    public int pre(int id)

  Description copied from class: `Data`
  Returns a pre value.

  Specified by:
    `pre` in class `Data`
  Parameters:
    `id` - unique node id
  Returns:
    pre value or -1 if id was not found

### kind

    public int kind(int pre)

  Description copied from class: `Data`
  Returns a node kind.

  Specified by:
    `kind` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    node kind

### parent

    public int parent(int pre,
                      int k)

  Description copied from class: `Data`
  Returns a pre value of the parent node.

  Specified by:
    `parent` in class `Data`
  Parameters:
    `pre` - pre value
    `k` - node kind
  Returns:
    pre value of the parent node

### attSize

    public int attSize(int pre,
                       int kind)

  Description copied from class: `Data`
  Returns a number of attributes.

  Specified by:
    `attSize` in class `Data`
  Parameters:
    `pre` - pre value
    `kind` - node kind
  Returns:
    number of attributes

### size

    public int size(int pre,
                    int k)

  Description copied from class: `Data`
  Returns a size value (number of descendant table entries).

  Specified by:
    `size` in class `Data`
  Parameters:
    `pre` - pre value
    `k` - node kind
  Returns:
    size value

### tagID

    public int tagID(int pre)

  Description copied from class: `Data`
  Returns a tag id (reference to the tag index).

  Specified by:
    `tagID` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    token reference

### tagNS

    public int tagNS(int pre)

  Description copied from class: `Data`
  Returns a tag namespace (reference to the tag namespace).

  Specified by:
    `tagNS` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    token reference

### ns

    public int[] ns(int pre)

  Description copied from class: `Data`
  Returns namespace key and value ids.

  Specified by:
    `ns` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    key and value ids

### attNameID

    public int attNameID(int pre)

  Description copied from class: `Data`
  Returns an attribute name id (reference to the attribute name index).

  Specified by:
    `attNameID` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    token reference

### attNS

    public int attNS(int pre)

  Description copied from class: `Data`
  Returns an attribute namespace (reference to the attribute namespace).

  Specified by:
    `attNS` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    token reference

### text

    public byte[] text(int pre)

  Description copied from class: `Data`
  Returns a text.

  Specified by:
    `text` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    atomized value

### textNum

    public double textNum(int pre)

  Description copied from class: `Data`
  Returns a text as double value.

  Specified by:
    `textNum` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    numeric value

### attValue

    public byte[] attValue(int pre)

  Description copied from class: `Data`
  Returns an attribute value.

  Specified by:
    `attValue` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    atomized value

### attNum

    public double attNum(int pre)

  Description copied from class: `Data`
  Returns an attribute value as double value.

  Specified by:
    `attNum` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    numeric value

### textLen

    public int textLen(int pre)

  Description copied from class: `Data`
  Returns a text length.

  Specified by:
    `textLen` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    length

### attLen

    public int attLen(int pre)

  Description copied from class: `Data`
  Returns an attribute value length.

  Specified by:
    `attLen` in class `Data`
  Parameters:
    `pre` - pre value
  Returns:
    length

### addDoc

    public void addDoc(byte[] t,
                       long s)

  Adds an element.

  Parameters:
    `t` - document name
    `s` - node size (+ 1)

### addElem

    public void addElem(long t,
                        long n,
                        long d,
                        long a,
                        long s,
                        boolean ne)

  Adds an element.

  Parameters:
    `t` - tag
    `n` - namespace
    `d` - distance
    `a` - number of attributes (+ 1)
    `s` - node size (+ 1)
    `ne` - element has namespaces

### addAtt

    public void addAtt(long t,
                       long n,
                       byte[] v,
                       long d)

  Adds an attribute.

  Parameters:
    `t` - attribute name
    `n` - namespace
    `v` - attribute value
    `d` - distance

### addText

    public void addText(byte[] t,
                        long d,
                        long k)

  Adds a text node.

  Parameters:
    `t` - text to be added
    `d` - distance
    `k` - node kind

### setSize

    public void setSize(int pre,
                        long val)

  Stores a size value to the table.

  Parameters:
    `pre` - pre reference
    `val` - value to be stored

### setAttValue

    public void setAttValue(int pre,
                            byte[] val)

  Stores an attribute value to the table.

  Parameters:
    `pre` - pre reference
    `val` - value to be stored

### delete

    public void delete(int pre)

  Description copied from class: `Data`
  Deletes a node and its descendants.

  Specified by:
    `delete` in class `Data`
  Parameters:
    `pre` - pre value of the node to delete

### update

    public void update(int pre,
                       byte[] attName,
                       byte[] attValue)

  Description copied from class: `Data`
  Updates an attribute name and value.

  Specified by:
    `update` in class `Data`
  Parameters:
    `pre` - pre of node to insert after
    `attName` - attribute name
    `attValue` - attribute value

### insert

    public void insert(int pre,
                       int par,
                       byte[] tag,
                       int kind)

  Description copied from class: `Data`
  Inserts a tag name, text node, comment or processing instruction.

  Specified by:
    `insert` in class `Data`
  Parameters:
    `pre` - pre value
    `par` - parent of node
    `tag` - value to be inserted
    `kind` - node kind

### insert

    public void insert(int pre,
                       int par,
                       byte[] name,
                       byte[] v)

  Description copied from class: `Data`
  Inserts an attribute.

  Specified by:
    `insert` in class `Data`
  Parameters:
    `pre` - pre value
    `par` - parent of node
    `name` - attribute name
    `v` - attribute value

### insert

    public void insert(int pre,
                       int par,
                       Data d)

  Description copied from class: `Data`
  Insert a data instance at the specified pre value. Note that the specified data instance must differ from this instance.

  Specified by:
    `insert` in class `Data`
  Parameters:
    `pre` - value at which to insert new data
    `par` - parent pre value of node
    `d` - data instance to copy from

### update

    public void update(int pre,
                       byte[] text)

  Description copied from class: `Data`
  Updates a tag name, text node, comment or processing instruction.

  Specified by:
    `update` in class `Data`
  Parameters:
    `pre` - pre of the text node to change
    `text` - value to be updated

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD