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-08, ISC License, Christian Gruen, Lukas Kircher

Field Summary
 boolean uptodate
          Statistics flag.
 
Fields inherited from class org.basex.util.Set
size
 
Constructor Summary
Names()
          Empty Constructor.
Names(DataInput in)
          Constructor, specifying an input file.
 
Method Summary
 int counter(int id)
          Returns the tag counter (number of indexed keys).
 void finish(DataOutput out)
          Writes the names to the specified output stream.
 int index(byte[] k, byte[] v)
          Indexes a name and returns its unique id.
 void index(int i, byte[] v)
          Evaluates the value for the specified key id.
 byte[] info()
          Returns index information.
 void init()
          Initializes the statistics.
 boolean noLeaf(int id)
          Returns node flag for the specified id.
 void noleaf(int id, boolean l)
          Sets node flag for the specified id.
 StatsKey stat(int id)
          Returns the statistics for the specified key id.
 
Methods inherited from class org.basex.util.Set
add, delete, id, key, keys, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uptodate

public boolean uptodate
Statistics flag.

Constructor Detail

Names

public Names()
Empty Constructor.


Names

public Names(DataInput in)
      throws java.io.IOException
Constructor, specifying an input file.

Parameters:
in - input stream
Throws:
java.io.IOException - I/O exception
Method Detail

init

public void init()
Initializes the statistics.


index

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

Parameters:
k - name to be found
v - value, evaluated in statistics
Returns:
name id

index

public void index(int i,
                  byte[] v)
Evaluates the value for the specified key id.

Parameters:
i - key id
v - value, used for statistics

finish

public void finish(DataOutput out)
            throws java.io.IOException
Writes the names to the specified output stream.

Parameters:
out - output stream
Throws:
java.io.IOException - in case the file could not be written

counter

public int counter(int id)
Returns the tag counter (number of indexed keys).

Parameters:
id - token id
Returns:
tag counter

noleaf

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

Parameters:
id - token id
l - node flag

stat

public StatsKey stat(int id)
Returns the statistics for the specified key id.

Parameters:
id - id
Returns:
statistics

noLeaf

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

Parameters:
id - token id
Returns:
the indexed token

info

public byte[] info()
Returns index information.

Returns:
statistics string