org.basex.util
Class Array

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

public final class Array
extends Object

This class provides convenience methods for handling arrays and serves as an extension to the Arrays class of Java.

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

Method Summary
static
<T> T[]
add(T[] ar, T e)
          Resizes an array and adds an entry at the end.
static int[] createOrder(byte[][] tok, boolean num, boolean asc)
          Sorts the specified tokens and returns an integer array with offsets to of the sorted tokens.
static int[] createOrder(double[] tok, boolean asc)
          Sorts the specified numeric tokens and returns an integer array with offsets to of the sorted tokens.
static
<T> T[]
delete(T[] ar, int p)
          Removes an array entry at the specified position.
static void move(Object ar, int pos, int off, int l)
          Moves entries inside an array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static <T> T[] add(T[] ar,
                          T e)
Resizes an array and adds an entry at the end.

Type Parameters:
T - array type
Parameters:
ar - array to be resized
e - entry to be added
Returns:
array

move

public static void move(Object ar,
                        int pos,
                        int off,
                        int l)
Moves entries inside an array.

Parameters:
ar - array
pos - position
off - move offset
l - length

delete

public static <T> T[] delete(T[] ar,
                             int p)
Removes an array entry at the specified position.

Type Parameters:
T - array type
Parameters:
ar - array to be resized
p - position
Returns:
array

createOrder

public static int[] createOrder(byte[][] tok,
                                boolean num,
                                boolean asc)
Sorts the specified tokens and returns an integer array with offsets to of the sorted tokens.

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

createOrder

public static int[] createOrder(double[] tok,
                                boolean asc)
Sorts the specified numeric tokens and returns an integer array with offsets to of the sorted tokens.

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