Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.geotools.resources
Class XArray  view XArray download XArray.java

java.lang.Object
  extended byorg.geotools.resources.XArray

public final class XArray
extends java.lang.Object

Simple operations on arrays. This class provides a central place for inserting and deleting elements in an array, as well as resizing the array. This class may be removed if JavaSoft provide some language construct functionally equivalent to C/C++'s realloc.

Version:
$Id: XArray.java,v 1.5 2003/02/09 23:38:12 lbruand Exp $

Field Summary
static java.lang.String CVSID
           
 
Constructor Summary
private XArray()
          All object constructions of this class are forbidden.
 
Method Summary
private static java.lang.Object doInsert(java.lang.Object array, int index, int length)
          Inserts spaces into the middle of a table.
private static java.lang.Object doInsert(java.lang.Object src, int src_pos, java.lang.Object dst, int dst_pos, int length)
          Inserts a table slice into another table.
private static java.lang.Object doRemove(java.lang.Object array, int index, int length)
          Grabs elements from the middle of a table.
private static java.lang.Object doResize(java.lang.Object array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static boolean[] insert(boolean[] src, int src_pos, boolean[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static boolean[] insert(boolean[] array, int index, int length)
          Inserts spaces into the middle of a table.
static byte[] insert(byte[] src, int src_pos, byte[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static byte[] insert(byte[] array, int index, int length)
          Inserts spaces into the middle of a table.
static char[] insert(char[] src, int src_pos, char[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static char[] insert(char[] array, int index, int length)
          Inserts spaces into the middle of a table.
static double[] insert(double[] src, int src_pos, double[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static double[] insert(double[] array, int index, int length)
          Inserts spaces into the middle of a table.
static float[] insert(float[] src, int src_pos, float[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static float[] insert(float[] array, int index, int length)
          Inserts spaces into the middle of a table.
static int[] insert(int[] array, int index, int length)
          Inserts spaces into the middle of a table.
static int[] insert(int[] src, int src_pos, int[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static long[] insert(long[] array, int index, int length)
          Inserts spaces into the middle of a table.
static long[] insert(long[] src, int src_pos, long[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static java.lang.Object[] insert(java.lang.Object[] array, int index, int length)
          Inserts spaces into the middle of a table.
static java.lang.Object[] insert(java.lang.Object[] src, int src_pos, java.lang.Object[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static short[] insert(short[] array, int index, int length)
          Inserts spaces into the middle of a table.
static short[] insert(short[] src, int src_pos, short[] dst, int dst_pos, int length)
          Inserts a table slice into another table.
static boolean isSorted(byte[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean isSorted(double[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean isSorted(float[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean isSorted(int[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean isSorted(long[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean isSorted(short[] array)
          Returns true if all elements in the specified array are in increasing order.
static boolean[] remove(boolean[] array, int index, int length)
          Grabs elements from the middle of a table.
static byte[] remove(byte[] array, int index, int length)
          Grabs elements from the middle of a table.
static char[] remove(char[] array, int index, int length)
          Grabs elements from the middle of a table.
static double[] remove(double[] array, int index, int length)
          Grabs elements from the middle of a table.
static float[] remove(float[] array, int index, int length)
          Grabs elements from the middle of a table.
static int[] remove(int[] array, int index, int length)
          Grabs elements from the middle of a table.
static long[] remove(long[] array, int index, int length)
          Grabs elements from the middle of a table.
static java.lang.Object[] remove(java.lang.Object[] array, int index, int length)
          Grabs elements from the middle of a table.
static short[] remove(short[] array, int index, int length)
          Grabs elements from the middle of a table.
static boolean[] resize(boolean[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static byte[] resize(byte[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static char[] resize(char[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static double[] resize(double[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static float[] resize(float[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static int[] resize(int[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static long[] resize(long[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static java.lang.Object[] resize(java.lang.Object[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
static short[] resize(short[] array, int length)
          Returns a new table which contains the same elements as array but with the length specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVSID

public static final java.lang.String CVSID
See Also:
Constant Field Values
Constructor Detail

XArray

private XArray()
All object constructions of this class are forbidden.

Method Detail

doResize

private static java.lang.Object doResize(java.lang.Object array,
                                         int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static java.lang.Object[] resize(java.lang.Object[] array,
                                        int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static double[] resize(double[] array,
                              int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static float[] resize(float[] array,
                             int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static long[] resize(long[] array,
                            int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static int[] resize(int[] array,
                           int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static short[] resize(short[] array,
                             int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static byte[] resize(byte[] array,
                            int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static char[] resize(char[] array,
                            int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


resize

public static boolean[] resize(boolean[] array,
                               int length)
Returns a new table which contains the same elements as array but with the length specified. If the desired length is longer than the initial length of the array table, the returned table will contain all the elements of array as well as the elements initialised to null at the end of the table. If, on the contrary, the desired length is shorter than the initial length of the array table, the table will be truncated (that is to say the surplus array elements will be forgotten). If the length of array is equal to length, then array will be returned as it stands.


doRemove

private static java.lang.Object doRemove(java.lang.Object array,
                                         int index,
                                         int length)
Grabs elements from the middle of a table.


remove

public static java.lang.Object[] remove(java.lang.Object[] array,
                                        int index,
                                        int length)
Grabs elements from the middle of a table.


remove

public static double[] remove(double[] array,
                              int index,
                              int length)
Grabs elements from the middle of a table.


remove

public static float[] remove(float[] array,
                             int index,
                             int length)
Grabs elements from the middle of a table.


remove

public static long[] remove(long[] array,
                            int index,
                            int length)
Grabs elements from the middle of a table.


remove

public static int[] remove(int[] array,
                           int index,
                           int length)
Grabs elements from the middle of a table.


remove

public static short[] remove(short[] array,
                             int index,
                             int length)
Grabs elements from the middle of a table.


remove

public static byte[] remove(byte[] array,
                            int index,
                            int length)
Grabs elements from the middle of a table.


remove

public static char[] remove(char[] array,
                            int index,
                            int length)
Grabs elements from the middle of a table.


remove

public static boolean[] remove(boolean[] array,
                               int index,
                               int length)
Grabs elements from the middle of a table.


doInsert

private static java.lang.Object doInsert(java.lang.Object array,
                                         int index,
                                         int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of null elements.


insert

public static java.lang.Object[] insert(java.lang.Object[] array,
                                        int index,
                                        int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of null elements.


insert

public static double[] insert(double[] array,
                              int index,
                              int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static float[] insert(float[] array,
                             int index,
                             int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static long[] insert(long[] array,
                            int index,
                            int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static int[] insert(int[] array,
                           int index,
                           int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static short[] insert(short[] array,
                             int index,
                             int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static byte[] insert(byte[] array,
                            int index,
                            int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static char[] insert(char[] array,
                            int index,
                            int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of zeros.


insert

public static boolean[] insert(boolean[] array,
                               int index,
                               int length)
Inserts spaces into the middle of a table. These "spaces" will be made up of false.


doInsert

private static java.lang.Object doInsert(java.lang.Object src,
                                         int src_pos,
                                         java.lang.Object dst,
                                         int dst_pos,
                                         int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static java.lang.Object[] insert(java.lang.Object[] src,
                                        int src_pos,
                                        java.lang.Object[] dst,
                                        int dst_pos,
                                        int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static double[] insert(double[] src,
                              int src_pos,
                              double[] dst,
                              int dst_pos,
                              int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static float[] insert(float[] src,
                             int src_pos,
                             float[] dst,
                             int dst_pos,
                             int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static long[] insert(long[] src,
                            int src_pos,
                            long[] dst,
                            int dst_pos,
                            int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static int[] insert(int[] src,
                           int src_pos,
                           int[] dst,
                           int dst_pos,
                           int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static short[] insert(short[] src,
                             int src_pos,
                             short[] dst,
                             int dst_pos,
                             int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static byte[] insert(byte[] src,
                            int src_pos,
                            byte[] dst,
                            int dst_pos,
                            int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static char[] insert(char[] src,
                            int src_pos,
                            char[] dst,
                            int dst_pos,
                            int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


insert

public static boolean[] insert(boolean[] src,
                               int src_pos,
                               boolean[] dst,
                               int dst_pos,
                               int length)
Inserts a table slice into another table. The src table will be entirely or partially inserted into the dst table.


isSorted

public static boolean isSorted(byte[] array)
Returns true if all elements in the specified array are in increasing order. This method is usefull in assertions.


isSorted

public static boolean isSorted(short[] array)
Returns true if all elements in the specified array are in increasing order. This method is usefull in assertions.


isSorted

public static boolean isSorted(int[] array)
Returns true if all elements in the specified array are in increasing order. This method is usefull in assertions.


isSorted

public static boolean isSorted(long[] array)
Returns true if all elements in the specified array are in increasing order. This method is usefull in assertions.


isSorted

public static boolean isSorted(float[] array)
Returns true if all elements in the specified array are in increasing order. Since NaN values are unordered, they may appears anywhere in the array; they will be ignored. This method is usefull in assertions.


isSorted

public static boolean isSorted(double[] array)
Returns true if all elements in the specified array are in increasing order. Since NaN values are unordered, they may appears anywhere in the array; they will be ignored. This method is usefull in assertions.