Class IdPreMap

java.lang.Object
org.basex.index.IdPreMap

public class IdPreMap extends Object
Updatable ID-PRE mapping.
Author:
BaseX Team 2005-21, BSD License, Dimitar Popov
  • Constructor Summary

    Constructors
    Constructor
    Description
    IdPreMap(int id)
    Constructor.
    Constructs a map by reading it from a file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(int pre, int id, int c)
    Deletes records.
    final void
    finish(int base)
    Finishes database creation.
    void
    insert(int pre, int id, int c)
    Inserts a new record.
    int
    pre(int id)
    Finds the PRE value of a given ID.
    int
    Returns the size of the map.
     
    final void
    write(IOFile file)
    Write the map to the specified file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IdPreMap

      public IdPreMap(int id)
      Constructor.
      Parameters:
      id - last inserted ID
    • IdPreMap

      public IdPreMap(IOFile f) throws IOException
      Constructs a map by reading it from a file.
      Parameters:
      f - file to read from
      Throws:
      IOException - I/O error while reading from the file
  • Method Details

    • write

      public final void write(IOFile file) throws IOException
      Write the map to the specified file.
      Parameters:
      file - file to write to
      Throws:
      IOException - I/O error while writing to the file
    • finish

      public final void finish(int base)
      Finishes database creation.
      Parameters:
      base - last id
    • pre

      public int pre(int id)
      Finds the PRE value of a given ID.
      Parameters:
      id - ID
      Returns:
      PRE or -1 if the ID is already deleted
    • insert

      public void insert(int pre, int id, int c)
      Inserts a new record.
      Parameters:
      pre - record PRE
      id - record ID
      c - number of inserted records
    • delete

      public void delete(int pre, int id, int c)
      Deletes records.
      Parameters:
      pre - PRE of the first record
      id - ID of the first deleted record
      c - number of deleted records (negative)
    • size

      public int size()
      Returns the size of the map.
      Returns:
      number of stored tuples
    • toString

      public String toString()
      Overrides:
      toString in class Object