org.basex.util
Class Atts

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

public final class Atts
extends ElementList

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

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

Field Summary
 
Fields inherited from class org.basex.util.list.ElementList
factor, size
 
Constructor Summary
Atts()
          Default constructor.
Atts(byte[] name, byte[] value)
          Constructor, specifying an initial entry.
 
Method Summary
 Atts add(byte[] name, byte[] value)
          Adds the next name/value pair.
 Atts clear()
          Clears the container.
 boolean contains(byte[] name)
          Checks if the specified name is found.
 Atts copy()
          Creates a shallow copy which shares all keys and values.
 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.
 java.lang.String toString()
           
 byte[] value(byte[] name)
          Returns the value for the specified name, or null.
 byte[] value(int i)
          Returns the value at the specified index position.
 
Methods inherited from class org.basex.util.list.ElementList
isEmpty, newSize, newSize, reset, size, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Atts

public Atts()
Default constructor.


Atts

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

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

add

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

Parameters:
name - name to be added
value - value 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

value

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

Parameters:
i - index
Returns:
value

value

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

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

clear

public Atts clear()
Clears the container.

Returns:
self reference

toString

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

copy

public Atts copy()
Creates a shallow copy which shares all keys and values.

Returns:
shallow copy