org.basex.util
Class IntList

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

public class IntList
extends Object

This is a simple container for native int values.

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

Constructor Summary
IntList()
          Default constructor.
IntList(double f)
          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.
 int find(int v)
          Searches for the specified value via binary search.
 int[] finish()
          Finishes the int array.
 int get(int p)
          Returns the specified value.
 void reset()
          Resets the integer list.
 void set(int v, int p)
          Sets a value at the specified position.
 int size()
          Returns the number of entries.
 void sort()
          Sorts the data.
 void sort(byte[][] tok, boolean num, boolean asc)
          Sorts the data in the order of the specified token array.
 void sort(double[] num, boolean asc)
          Sorts the data in the order of the specified numeric array.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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(double f)
Constructor.

Parameters:
f - resize factor

IntList

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

Parameters:
v - initial list values
Method Detail

add

public final void add(int v)
Adds next value.

Parameters:
v - value to be added

size

public final int size()
Returns the number of entries.

Returns:
number of entries

get

public final int get(int p)
Returns the specified value.

Parameters:
p - position
Returns:
value

set

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

Parameters:
v - value to be added
p - position

contains

public final 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

find

public final int find(int v)
Searches for the specified value via binary search. Note that the values must be sorted.

Parameters:
v - value to find
Returns:
index of the search key, or the negative insertion point - 1

finish

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

Returns:
int array

reset

public final void reset()
Resets the integer list.


sort

public void sort()
Sorts the data.


sort

public final void sort(byte[][] tok,
                       boolean num,
                       boolean asc)
Sorts the data in the order of the specified token array. Note that the input array will be resorted as well. - Sorting is derived from Java's sort algorithms in the {Arrays} class.

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

sort

public final void sort(double[] num,
                       boolean asc)
Sorts the data in the order of the specified numeric array. Note that the input array will be resorted as well. - Sorting is derived from Java's sort algorithms in the {Arrays} class.

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

toString

public String toString()
Overrides:
toString in class Object