Class Names

All Implemented Interfaces:
Iterable<byte[]>, Index

public final class Names extends TokenSet implements Index
This class indexes and organizes the element or attribute names used in an XML document.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen, Lukas Kircher
  • Constructor Details

    • Names

      public Names(MetaData meta)
      Default constructor.
      Parameters:
      meta - meta data
    • Names

      public Names(DataInput in, MetaData meta) throws IOException
      Constructor, specifying an input file.
      Parameters:
      in - input stream
      meta - meta data
      Throws:
      IOException - I/O exception
  • Method Details

    • init

      public void init()
      Initializes the index.
    • index

      public int index(byte[] name)
      Indexes a name, updates the statistics, and returns the name id.
      Parameters:
      name - name to be added
      Returns:
      name id
    • index

      public int index(byte[] name, byte[] value)
      Indexes a name, updates the statistics, and returns the name id.
      Parameters:
      name - name to be added
      value - value, added to statistics (can be null)
      Returns:
      name id
    • write

      public void write(DataOutput out) throws IOException
      Description copied from class: TokenSet
      Writes the data structure to the specified output.
      Overrides:
      write in class TokenSet
      Parameters:
      out - output stream
      Throws:
      IOException - I/O exception
    • stats

      public Stats stats(int id)
      Returns the statistics for the specified key id.
      Parameters:
      id - name id
      Returns:
      statistics (can be null)
    • info

      public byte[] info(MainOptions options)
      Description copied from interface: Index
      Returns information on the index structure.
      Specified by:
      info in interface Index
      Parameters:
      options - main options
      Returns:
      info
    • entries

      public EntryIterator entries(IndexEntries entries)
      Description copied from interface: Index
      Returns all entries that match the specified token.
      Specified by:
      entries in interface Index
      Parameters:
      entries - index entries
      Returns:
      entries
    • rehash

      protected void rehash(int newSize)
      Description copied from class: ASet
      Rehashes all entries.
      Overrides:
      rehash in class TokenSet
      Parameters:
      newSize - new hash size
    • close

      public void close()
      Description copied from interface: Index
      Closes the index.
      Specified by:
      close in interface Index
    • drop

      public boolean drop()
      Description copied from interface: Index
      Drops the index. Also returns true if the index does not exist.
      Specified by:
      drop in interface Index
      Returns:
      success flag
    • iter

      public IndexIterator iter(IndexSearch search)
      Description copied from interface: Index
      Returns an iterator for the index results.
      Specified by:
      iter in interface Index
      Parameters:
      search - index search definition
      Returns:
      sorted pre values for the token
    • costs

      public IndexCosts costs(IndexSearch search)
      Description copied from interface: Index
      Computes costs for performing the specified search. An integer is returned:
      • A negative value indicates that index access is not possible.
      • A value of zero indicates that no results will be returned.
      • A small value indicates that index access is fast.
      Smaller values are better, a value of zero indicates that no results will be returned.
      Specified by:
      costs in interface Index
      Parameters:
      search - index search definition
      Returns:
      cost estimation