org.basex.index
Class Names

java.lang.Object
  extended by org.basex.util.Set
      extended by org.basex.index.Names

public final class Names
extends Set

This class indexes and organizes the tags or attribute names, used in an XML document.

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

Field Summary
 
Fields inherited from class org.basex.util.Set
size
 
Constructor Summary
Names(boolean t)
          Empty Constructor.
Names(java.lang.String db, boolean t)
          Constructor, specifying an input file.
 
Method Summary
 int counter(int id)
          Returns the tag counter.
 void finish(java.lang.String db)
          Finishes the index structure and optimizes its memory usage.
 int index(byte[] k)
          Indexes a key and returns its unique id.
 java.lang.String info()
          Returns index information.
 boolean noLeaf(int id)
          Returns node flag for the specified id.
 void noleaf(int id, boolean l)
          Sets node flag for the specified id.
 
Methods inherited from class org.basex.util.Set
add, id, key, keys, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Names

public Names(boolean t)
Empty Constructor.

Parameters:
t - index type (tags/attribute names).

Names

public Names(java.lang.String db,
             boolean t)
      throws java.io.IOException
Constructor, specifying an input file.

Parameters:
db - name of the database
t - index type (tags/attribute names).
Throws:
java.io.IOException - IO Exception
Method Detail

counter

public int counter(int id)
Returns the tag counter.

Parameters:
id - token id
Returns:
tag counter

finish

public void finish(java.lang.String db)
            throws java.io.IOException
Finishes the index structure and optimizes its memory usage.

Parameters:
db - name of the database
Throws:
java.io.IOException - in case the file could not be written

index

public int index(byte[] k)
Indexes a key and returns its unique id.

Parameters:
k - key to be found
Returns:
token id or -1 if token was not found

info

public java.lang.String info()
Returns index information.

Returns:
statistics string

noLeaf

public boolean noLeaf(int id)
Returns node flag for the specified id.

Parameters:
id - token id
Returns:
the indexed token

noleaf

public void noleaf(int id,
                   boolean l)
Sets node flag for the specified id.

Parameters:
id - token id
l - node flag