|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.util.Array
public final class Array
This class provides convenience methods for handling arrays
and serves as an extension to the Arrays
class of Java.
Field Summary | |
---|---|
static int |
CAPACITY
Initial default size for new arrays. |
static double |
RESIZE
Default factor for resizing dynamic arrays. |
Method Summary | ||
---|---|---|
static int[] |
add(int[] ar,
int e)
Adds an entry to the end of an array and returns the new array. |
|
static
|
add(T[] ar,
T e)
Adds an entry to the end of an array and returns the new array. |
|
static
|
copy(java.lang.Object[] source,
T[] target)
Copies entries from one array to another. |
|
static byte[][] |
copyOf(byte[][] a,
int s)
Copies the specified array. |
|
static int[][] |
copyOf(int[][] a,
int s)
Copies the specified array. |
|
static java.lang.String[] |
copyOf(java.lang.String[] a,
int s)
Copies the specified array. |
|
static int[] |
createOrder(byte[][] vals,
boolean num,
boolean asc)
Sorts the specified tokens and returns an integer array with offsets to the sorted tokens. |
|
static int[] |
createOrder(double[] vals,
boolean asc)
Sorts the specified doubles and returns an integer array with offsets to the sorted doubles. |
|
static int[] |
createOrder(int[] vals,
boolean asc)
Sorts the specified integers and returns an integer array with offsets to the sorted integers. |
|
static
|
delete(T[] ar,
int p)
Removes an array entry at the specified position. |
|
static void |
move(java.lang.Object ar,
int pos,
int off,
int l)
Moves entries inside an array. |
|
static int |
newSize(int old)
Returns a value for a new array size, which will always be larger than the specified value. |
|
static int |
newSize(int old,
double factor)
Returns a value for a new array size, which will always be larger than the specified value. |
|
static void |
reverse(byte[] arr)
Reverses the order of the elements in the given array. |
|
static void |
reverse(java.lang.Object[] arr,
int pos,
int len)
Reverses the order of all elements in the given interval. |
|
static void |
swap(int[] arr,
int a,
int b)
Swaps two entries of the given int array. |
|
static void |
swap(int[] arr,
int a,
int b,
int n)
Swaps arr[a .. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CAPACITY
public static final double RESIZE
Method Detail |
---|
public static byte[][] copyOf(byte[][] a, int s)
a
- array to be copieds
- new array size
public static int[][] copyOf(int[][] a, int s)
a
- array to be copieds
- new array size
public static java.lang.String[] copyOf(java.lang.String[] a, int s)
a
- array to be copieds
- new array size
public static <T> T[] add(T[] ar, T e)
T
- array typear
- array to be resizede
- entry to be added
public static int[] add(int[] ar, int e)
ar
- array to be resizede
- entry to be added
public static void move(java.lang.Object ar, int pos, int off, int l)
ar
- arraypos
- positionoff
- move offsetl
- lengthpublic static <T> T[] copy(java.lang.Object[] source, T[] target)
T
- object typesource
- source arraytarget
- target array
public static <T> T[] delete(T[] ar, int p)
T
- array typear
- array to be resizedp
- position
public static int[] createOrder(byte[][] vals, boolean num, boolean asc)
vals
- values to sort bynum
- numeric sortasc
- ascending
public static int[] createOrder(double[] vals, boolean asc)
vals
- values to sort byasc
- ascending
public static int[] createOrder(int[] vals, boolean asc)
vals
- values to sort byasc
- ascending
public static void reverse(byte[] arr)
arr
- arraypublic static void reverse(java.lang.Object[] arr, int pos, int len)
arr
- arraypos
- position of first element of the intervallen
- length of the intervalpublic static int newSize(int old)
old
- old size
public static int newSize(int old, double factor)
old
- old sizefactor
- resize factor; must be larger than or equal to 1
public static void swap(int[] arr, int a, int b)
arr
- arraya
- first positionb
- second positionpublic static void swap(int[] arr, int a, int b, int n)
arr
- order arraya
- first offsetb
- second offsetn
- number of values
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |