|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.resources.XArray
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
.
Method Summary | |
static boolean |
hasNaN(double[] array)
Returns if the specified array contains at least one NaN value. |
static boolean |
hasNaN(float[] array)
Returns if the specified array contains at least one NaN value. |
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 if all elements in the specified array are in increasing order. |
static boolean |
isSorted(char[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isSorted(double[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isSorted(float[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isSorted(int[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isSorted(long[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isSorted(short[] array)
Returns if all elements in the specified array are in increasing order. |
static boolean |
isStrictlySorted(int[] array)
Returns if all elements in the specified array are in strictly 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.
|
static java.lang.String |
toString(java.lang.Object array,
java.util.Locale locale)
Returns a string representation of an array of numbers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.Object[] resize(java.lang.Object[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static double[] resize(double[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static float[] resize(float[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static long[] resize(long[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static int[] resize(int[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static short[] resize(short[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static byte[] resize(byte[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static char[] resize(char[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static boolean[] resize(boolean[] array, int length)
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.
array
- Table to copy.length
- Length of the desired table.
array
, of length
length
and containing the data from
array
.public static java.lang.Object[] remove(java.lang.Object[] array, int index, int length)
array
- Table from which to grab the elements.index
- array
index of the first element to grab.
All subsequent array
elements can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static double[] remove(double[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static float[] remove(float[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static long[] remove(long[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static int[] remove(int[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static short[] remove(short[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static byte[] remove(byte[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static char[] remove(char[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static boolean[] remove(boolean[] array, int index, int length)
array
- Table from which to grab elements.index
- array
index of the first element to grab.
All subsequent elements of array
can be moved forward.length
- Number of elements to grab.
array
data with the
extracted elements. This method can directly return
dst
, but most often it returns a newly created
table.public static java.lang.Object[] insert(java.lang.Object[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static double[] insert(double[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static float[] insert(float[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static long[] insert(long[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static int[] insert(int[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static short[] insert(short[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static byte[] insert(byte[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static char[] insert(char[] array, int index, int length)
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static boolean[] insert(boolean[] array, int index, int length)
false
.
array
- Table in which to insert spaces.index
- array
index where spaces should be inserted.
All array
elements which have an index equal
to or higher than index
will be moved
forward.length
- Number of spaces to insert.
array
data with the
additional space. This method can directly return
dst
, but most often it returns a newly
created table.public static java.lang.Object[] insert(java.lang.Object[] src, int src_pos, java.lang.Object[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static double[] insert(double[] src, int src_pos, double[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static float[] insert(float[] src, int src_pos, float[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static long[] insert(long[] src, int src_pos, long[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static int[] insert(int[] src, int src_pos, int[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static short[] insert(short[] src, int src_pos, short[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static byte[] insert(byte[] src, int src_pos, byte[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static char[] insert(char[] src, int src_pos, char[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static boolean[] insert(boolean[] src, int src_pos, boolean[] dst, int dst_pos, int length)
src
table
will be entirely or partially inserted into the dst
table.
src
- Tablea to insert into dst
.src_pos
- Index of the first data item of src
to
insert into dst
.dst
- Table in which to insert src
data.dst_pos
- dst
index in which to insert
src
data. All elements of
dst
whose index is equal to or greater than
dst_pos
will be moved forward.length
- Number of src
data items to insert.
src
and dst
. This method can directly return
dst
, but never src
. It most
often returns a newly created table.public static boolean isSorted(char[] array)
public static boolean isSorted(byte[] array)
public static boolean isSorted(short[] array)
public static boolean isSorted(int[] array)
public static boolean isSorted(long[] array)
public static boolean isSorted(float[] array)
NaN
values are unordered, they may appears anywhere in the array; they
will be ignored. This method is usefull in assertions.
public static boolean isSorted(double[] array)
NaN
values are unordered, they may appears anywhere in the array; they
will be ignored. This method is usefull in assertions.
public static boolean isStrictlySorted(int[] array)
public static boolean hasNaN(double[] array)
NaN
value.
public static boolean hasNaN(float[] array)
NaN
value.
public static java.lang.String toString(java.lang.Object array, java.util.Locale locale)
Number
.
array
- The array to format.locale
- The locale for formatting.
LineFormat
instead?
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |