org.basex.util
Class IntList

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

public final class IntList
extends java.lang.Object

This is a simple container for native int values.

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

Field Summary
 int[] list
          Value array.
 int size
          Current array size.
 
Constructor Summary
IntList()
          Default constructor.
IntList(int is)
          Constructor, specifying an initial list size.
IntList(int[] v)
          Constructor, specifying an initial array.
 
Method Summary
 void add(int v)
          Adds next value.
 boolean contains(int v)
          Checks if the specified value is found in the list.
static IntList createOrder(byte[][] tok, boolean num, boolean asc)
          Sorts the specified tokens and returns an IntList instance with the sort order of all tokens.
 int[] finish()
          Finishes the int array.
 void remove(int i)
          Remove a value.
 void reset()
          Resets the integer list.
 void set(int v, int p)
          Sets a value at the specified position.
 void sort()
          Sorts the int values.
 void sort(byte[][] tok, boolean num, boolean asc)
          Sorts the array in the order of the specified token array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

public int[] list
Value array.


size

public int size
Current array size.

Constructor Detail

IntList

public IntList()
Default constructor.


IntList

public IntList(int is)
Constructor, specifying an initial list size.

Parameters:
is - initial size of the list

IntList

public IntList(int[] v)
Constructor, specifying an initial array.

Parameters:
v - initial list values
Method Detail

add

public void add(int v)
Adds next value.

Parameters:
v - value to be added

remove

public void remove(int i)
Remove a value.

Parameters:
i - index of the value to be remove

set

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

Parameters:
v - value to be added
p - position

contains

public boolean contains(int v)
Checks if the specified value is found in the list.

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

finish

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

Returns:
int array

reset

public void reset()
Resets the integer list.


createOrder

public static IntList createOrder(byte[][] tok,
                                  boolean num,
                                  boolean asc)
Sorts the specified tokens and returns an IntList instance with the sort order of all tokens.

Parameters:
tok - token array to sort by
num - numeric sort
asc - ascending
Returns:
sorted integer list

sort

public void sort()
Sorts the int values.


sort

public void sort(byte[][] tok,
                 boolean num,
                 boolean asc)
Sorts the array in the order of the specified token array. This sort algorithm is derived from Java's highly optimized {Arrays#sort} array sort algorithms.

Parameters:
tok - token array to sort by
num - numeric sort
asc - ascending

toString

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