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 table mapping is documented in Data.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • MemData

      public MemData(PathIndex paths, Namespaces nspaces, MainOptions opts)
      Constructor.
      Parameters:
      paths - path index
      nspaces - namespaces
      opts - database options
    • MemData

      public MemData(MainOptions opts)
      Constructor for creating a new, empty database.
      Parameters:
      opts - database options
  • Method Details

    • createIndex

      public void createIndex(IndexType type, Command cmd) throws IOException
      Description copied from class: Data
      Drops the specified index.
      Specified by:
      createIndex in class Data
      Parameters:
      type - index to be dropped
      cmd - calling command
      Throws:
      IOException - I/O exception
    • dropIndex

      public void dropIndex(IndexType type) throws BaseXException
      Description copied from class: Data
      Drops the specified index.
      Specified by:
      dropIndex in class Data
      Parameters:
      type - index to be dropped
      Throws:
      BaseXException - database exception
    • startUpdate

      public void startUpdate(MainOptions opts)
      Description copied from class: Data
      Starts an update operation: writes a file to disk to indicate that an update is going on, and exclusively locks the table file.
      Specified by:
      startUpdate in class Data
      Parameters:
      opts - main options
    • finishUpdate

      public void finishUpdate(MainOptions opts)
      Description copied from class: Data
      Finishes an update operation: removes the update file and the exclusive lock.
      Specified by:
      finishUpdate in class Data
      Parameters:
      opts - main options
    • flush

      public void flush(boolean all)
      Description copied from class: Data
      Flushes updated data.
      Specified by:
      flush in class Data
      Parameters:
      all - flush all data
    • text

      public byte[] text(int pre, boolean text)
      Description copied from class: Data
      Returns a text (text, comment, pi, document) or attribute value.
      Specified by:
      text in class Data
      Parameters:
      pre - pre value
      text - text/attribute flag
      Returns:
      atomized value
    • textItr

      public long textItr(int pre, boolean text)
      Description copied from class: Data
      Returns a text (text, comment, pi, document) or attribute value as integer value. Long.MIN_VALUE is returned if the input is no valid integer.
      Specified by:
      textItr in class Data
      Parameters:
      pre - pre value
      text - text/attribute flag
      Returns:
      numeric value
    • textDbl

      public double textDbl(int pre, boolean text)
      Description copied from class: Data
      Returns a text (text, comment, pi, document) or attribute value as double value. Double.NaN is returned if the input is no valid double.
      Specified by:
      textDbl in class Data
      Parameters:
      pre - pre value
      text - text/attribute flag
      Returns:
      numeric value
    • textLen

      public int textLen(int pre, boolean text)
      Description copied from class: Data
      Returns the byte length of a (possibly compressed) text (text, comment, pi, document).
      Specified by:
      textLen in class Data
      Parameters:
      pre - pre value
      text - text/attribute flag
      Returns:
      length
    • inMemory

      public boolean inMemory()
      Description copied from class: Data
      Indicates if this data instance is in main memory or on disk.
      Specified by:
      inMemory in class Data
      Returns:
      result of check
    • values

      public TokenSet values(boolean text)
      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: Data
      Deletes the specified text entry.
      Specified by:
      delete in class Data
      Parameters:
      pre - pre value
      text - text (text, comment or pi) or attribute flag
    • updateText

      protected void updateText(int pre, byte[] value, int kind)
      Description copied from class: Data
      Updates the specified text or attribute value.
      Specified by:
      updateText in class Data
      Parameters:
      pre - pre value
      value - content
      kind - node kind
    • textRef

      protected long textRef(byte[] value, boolean text)
      Description copied from class: Data
      Generates a reference for a text (text, comment, pi, pi, document) or attribute value.
      Specified by:
      textRef in class Data
      Parameters:
      value - text to be indexed
      text - text/attribute flag
      Returns:
      reference