org.basex.util
Class TokenList

java.lang.Object
  extended by org.basex.util.TokenList
All Implemented Interfaces:
java.lang.Iterable<byte[]>

public final class TokenList
extends java.lang.Object
implements java.lang.Iterable<byte[]>

This is a simple container for tokens (byte arrays).

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

Constructor Summary
TokenList()
          Default constructor.
TokenList(int is)
          Constructor.
 
Method Summary
 void add(byte[] v)
          Adds next value.
 boolean contains(byte[] v)
          Checks if the specified token is found in the list.
 byte[][] finish()
          Finishes the array.
 java.lang.String[] finishString()
          Finishes the list as string array.
 byte[] get(int p)
          Returns the specified value.
 java.util.Iterator<byte[]> iterator()
           
 void reset()
          Resets the integer list.
 void set(byte[] v, int p)
          Sets the specified value at the specified position.
 int size()
          Returns the number of entries.
 void size(int s)
          Sets the number of entries.
 void sort(boolean cs)
          Sorts the strings.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenList

public TokenList()
Default constructor.


TokenList

public TokenList(int is)
Constructor.

Parameters:
is - initial size of the list
Method Detail

add

public void add(byte[] v)
Adds next value.

Parameters:
v - value to be added

size

public int size()
Returns the number of entries.

Returns:
number of entries

size

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

Parameters:
s - number of entries

get

public byte[] get(int p)
Returns the specified value.

Parameters:
p - position
Returns:
value

set

public void set(byte[] v,
                int p)
Sets the specified value at the specified position.

Parameters:
v - value
p - position

contains

public boolean contains(byte[] v)
Checks if the specified token is found in the list.

Parameters:
v - token to be checked
Returns:
true if value is found

finish

public byte[][] finish()
Finishes the array.

Returns:
array

finishString

public java.lang.String[] finishString()
Finishes the list as string array.

Returns:
array

reset

public void reset()
Resets the integer list.


sort

public void sort(boolean cs)
Sorts the strings.

Parameters:
cs - respect case sensitivity

iterator

public java.util.Iterator<byte[]> iterator()
Specified by:
iterator in interface java.lang.Iterable<byte[]>

toString

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