org.basex.util
Class Atts

java.lang.Object
  extended by org.basex.util.Atts

public final class Atts
extends java.lang.Object

This is a simple container for attributes (name/string pairs).

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Constructor Summary
Atts()
          Default constructor.
Atts(byte[] name, byte[] string)
          Constructor, specifying an initial entry.
 
Method Summary
 Atts add(byte[] name, byte[] string)
          Adds the next name/string pair.
 boolean contains(byte[] name)
          Checks if the specified name is found.
 void delete(int i)
          Deletes the specified entry.
 int get(byte[] name)
          Returns the offset to the specified name.
 byte[] name(int i)
          Returns the name at the specified index position.
 Atts reset()
          Resets the container.
 int size()
          Returns the number of attributes.
 void size(int s)
          Sets the number of attributes.
 byte[] string(byte[] name)
          Returns the string for the specified name, or null.
 byte[] string(int i)
          Returns the string at the specified index position.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Atts

public Atts()
Default constructor.


Atts

public Atts(byte[] name,
            byte[] string)
Constructor, specifying an initial entry.

Parameters:
name - name to be added
string - string to be added
Method Detail

add

public Atts add(byte[] name,
                byte[] string)
Adds the next name/string pair.

Parameters:
name - name to be added
string - string to be added
Returns:
self reference

delete

public void delete(int i)
Deletes the specified entry.

Parameters:
i - entry offset

contains

public boolean contains(byte[] name)
Checks if the specified name is found.

Parameters:
name - name to be found
Returns:
result of check

get

public int get(byte[] name)
Returns the offset to the specified name.

Parameters:
name - name to be found
Returns:
offset or -1

name

public byte[] name(int i)
Returns the name at the specified index position.

Parameters:
i - index
Returns:
name

string

public byte[] string(int i)
Returns the string at the specified index position.

Parameters:
i - index
Returns:
string

string

public byte[] string(byte[] name)
Returns the string for the specified name, or null.

Parameters:
name - name to be found
Returns:
offset or -1

size

public int size()
Returns the number of attributes.

Returns:
number of attributes

size

public void size(int s)
Sets the number of attributes.

Parameters:
s - number of attributes

reset

public Atts reset()
Resets the container.

Returns:
self reference

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object