org.basex.data
Class Namespaces

java.lang.Object
  extended by org.basex.util.Set
      extended by org.basex.data.Namespaces

public final class Namespaces
extends Set

This class organizes the namespaces of a database.

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

Constructor Summary
Namespaces()
          Default constructor.
Namespaces(DataInput in)
          Constructor, specifying an input stream.
 
Method Summary
 int add(byte[] p, byte[] u)
          Adds the specified namespace.
 void close(int p)
          Closes a node.
 int get(byte[] n)
          Returns the namespace offset for the specified qname.
 int get(byte[] n, int p)
          Returns the namespace for the specified name and pre value.
 int[] get(int p)
          Returns the namespace keys and values for the specified pre value.
 byte[] info()
          Prints some namespace info.
 void info(Map<TokenList> map, org.basex.data.NSNode n)
          Prints some namespace info.
 boolean open(int p)
          Opens a node.
 void print(PrintOutput out, int s, boolean all)
          Prints the namespace structure to the specified output stream.
 void write(DataOutput out)
          Writes the namespaces to disk.
 
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
 

Constructor Detail

Namespaces

public Namespaces()
Default constructor.


Namespaces

public Namespaces(DataInput in)
           throws java.io.IOException
Constructor, specifying an input stream.

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

add

public int add(byte[] p,
               byte[] u)
Adds the specified namespace.

Parameters:
p - namespace prefix
u - namespace uri
Returns:
value id

open

public boolean open(int p)
Opens a node.

Parameters:
p - current pre value
Returns:
true if new namespaces have been added

get

public int get(byte[] n)
Returns the namespace offset for the specified qname.

Parameters:
n - tag/attribute name
Returns:
namespace

write

public void write(DataOutput out)
           throws java.io.IOException
Writes the namespaces to disk.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

close

public void close(int p)
Closes a node.

Parameters:
p - current pre value

get

public int get(byte[] n,
               int p)
Returns the namespace for the specified name and pre value.

Parameters:
n - tag/attribute name
p - pre value
Returns:
namespace reference or 0 if no namespace was found

get

public int[] get(int p)
Returns the namespace keys and values for the specified pre value.

Parameters:
p - pre value
Returns:
namespace reference or 0 if no namespace was found

print

public void print(PrintOutput out,
                  int s,
                  boolean all)
           throws java.io.IOException
Prints the namespace structure to the specified output stream.

Parameters:
out - output stream
s - space for pre value
all - print all namespaces or just the root entries
Throws:
java.io.IOException - I/O exception

info

public byte[] info()
Prints some namespace info.

Returns:
statistics string

info

public void info(Map<TokenList> map,
                 org.basex.data.NSNode n)
Prints some namespace info.

Parameters:
map - namespace map
n - namespace node