org.basex.util
Class TokenList

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

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

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

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

Field Summary
 byte[][] list
          Value array.
 
Constructor Summary
TokenList()
          Default constructor.
TokenList(double f)
          Constructor.
TokenList(int is)
          Constructor.
 
Method Summary
 void add(byte[] v)
          Adds next value.
 void add(int v)
          Adds next value.
 void add(String v)
          Adds next value.
 boolean contains(byte[] v)
          Checks if the specified token is found in the list.
 byte[][] finish()
          Finishes the array.
 String[] finishString()
          Finishes the list as string array.
 byte[] get(int p)
          Returns the specified value.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

public byte[][] list
Value array.

Constructor Detail

TokenList

public TokenList()
Default constructor.


TokenList

public TokenList(int is)
Constructor.

Parameters:
is - initial size of the list

TokenList

public TokenList(double f)
Constructor.

Parameters:
f - resize factor
Method Detail

add

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

Parameters:
v - value to be added

add

public void add(int v)
Adds next value.

Parameters:
v - value to be added

add

public void add(String 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 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 Iterator<byte[]> iterator()
Specified by:
iterator in interface Iterable<byte[]>

toString

public String toString()
Overrides:
toString in class Object