Package org.epics.util.array
Class CollectionNumbers
- java.lang.Object
-
- org.epics.util.array.CollectionNumbers
-
public class CollectionNumbers extends Object
Utilities to work with number collections.- Author:
- carcassi
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
arrayCopy(CollectionNumber src, byte[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static void
arrayCopy(CollectionNumber src, double[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static void
arrayCopy(CollectionNumber src, float[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static void
arrayCopy(CollectionNumber src, int[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static void
arrayCopy(CollectionNumber src, long[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static void
arrayCopy(CollectionNumber src, short[] dest, int destPos)
Copies the content of the collection to an array at the desired position.static ListNumber
toList(Object values)
Takes a primitive array and wraps it into the appropriate mutable array wrapper.static ArrayByte
toListByte(byte... values)
Takes a byte array and wraps it into an ArrayByte.static ArrayDouble
toListDouble(double... values)
Takes a double array and wraps it into an ArrayDouble.static ArrayFloat
toListFloat(float... values)
Takes a float array and wraps it into an ArrayFloat.static ArrayInteger
toListInt(int... values)
Takes an int array and wraps it into an ArrayInteger.static ArrayLong
toListLong(long... values)
Takes a long array and wraps it into an ArrayLong.static ArrayShort
toListShort(short... values)
Takes a short array and wraps it into an ArrayShort.static ArrayUByte
toListUByte(byte... values)
Takes an unsigned byte array and wraps it into an ArrayUByte.static ArrayUInteger
toListUInt(int... values)
Takes an unsigned int array and wraps it into an ArrayUInteger.static ArrayULong
toListULong(long... values)
Takes an unsigned long array and wraps it into an ArrayULong.static ArrayUShort
toListUShort(short... values)
Takes an unsigned short array and wraps it into an ArrayUShort.static ArrayByte
unmodifiableList(ArrayByte list)
Returns an unmodifiable view of the specified list.static ArrayDouble
unmodifiableList(ArrayDouble list)
Returns an unmodifiable view of the specified list.static ArrayFloat
unmodifiableList(ArrayFloat list)
Returns an unmodifiable view of the specified list.static ArrayInteger
unmodifiableList(ArrayInteger list)
Returns an unmodifiable view of the specified list.static ArrayLong
unmodifiableList(ArrayLong list)
Returns an unmodifiable view of the specified list.static ArrayShort
unmodifiableList(ArrayShort list)
Returns an unmodifiable view of the specified list.static ListByte
unmodifiableList(ListByte list)
Returns an unmodifiable view of the specified list.static ListDouble
unmodifiableList(ListDouble list)
Returns an unmodifiable view of the specified list.static ListFloat
unmodifiableList(ListFloat list)
Returns an unmodifiable view of the specified list.static ListInteger
unmodifiableList(ListInteger list)
Returns an unmodifiable view of the specified list.static ListLong
unmodifiableList(ListLong list)
Returns an unmodifiable view of the specified list.static ListNumber
unmodifiableList(ListNumber list)
Returns an unmodifiable view of the specified list.static ListShort
unmodifiableList(ListShort list)
Returns an unmodifiable view of the specified list.static ArrayByte
unmodifiableListByte(byte... values)
Returns an unmodifiableArrayByte
wrapper for the givenbyte
array.static ArrayDouble
unmodifiableListDouble(double... values)
Returns an unmodifiableArrayDouble
wrapper for the givendouble
array.static ArrayFloat
unmodifiableListFloat(float... values)
Returns an unmodifiableArrayFloat
wrapper for the givenfloat
array.static ArrayInteger
unmodifiableListInt(int... values)
Returns an unmodifiableArrayInteger
wrapper for the givenint
array.static ArrayLong
unmodifiableListLong(long... values)
Returns an unmodifiableArrayLong
wrapper for the givenlong
array.static ArrayShort
unmodifiableListShort(short... values)
Returns an unmodifiableArrayShort
wrapper for the givenshort
array.static ArrayUByte
unmodifiableListUByte(byte... values)
Returns an unmodifiableArrayUByte
wrapper for the given unsignedbyte
array.static ArrayUInteger
unmodifiableListUInt(int... values)
Returns an unmodifiableArrayUInteger
wrapper for the given unsignedint
array.static ArrayULong
unmodifiableListULong(long... values)
Returns an unmodifiableArrayULong
wrapper for the given unsignedlong
array.static ArrayUShort
unmodifiableListUShort(short... values)
Returns an unmodifiableArrayUShort
wrapper for the given unsignedshort
array.
-
-
-
Method Detail
-
toList
public static ListNumber toList(Object values)
Takes a primitive array and wraps it into the appropriate mutable array wrapper.- Parameters:
values
- a primitive array (e.g. int[])- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListDouble
public static ArrayDouble toListDouble(double... values)
Takes a double array and wraps it into an ArrayDouble.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListFloat
public static ArrayFloat toListFloat(float... values)
Takes a float array and wraps it into an ArrayFloat.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListLong
public static ArrayLong toListLong(long... values)
Takes a long array and wraps it into an ArrayLong.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListULong
public static ArrayULong toListULong(long... values)
Takes an unsigned long array and wraps it into an ArrayULong.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListInt
public static ArrayInteger toListInt(int... values)
Takes an int array and wraps it into an ArrayInteger.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListUInt
public static ArrayUInteger toListUInt(int... values)
Takes an unsigned int array and wraps it into an ArrayUInteger.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListShort
public static ArrayShort toListShort(short... values)
Takes a short array and wraps it into an ArrayShort.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListUShort
public static ArrayUShort toListUShort(short... values)
Takes an unsigned short array and wraps it into an ArrayUShort.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListByte
public static ArrayByte toListByte(byte... values)
Takes a byte array and wraps it into an ArrayByte.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
toListUByte
public static ArrayUByte toListUByte(byte... values)
Takes an unsigned byte array and wraps it into an ArrayUByte.- Parameters:
values
- a primitive array- Returns:
- a mutable wrapper
- Throws:
IllegalArgumentException
- if the given object is not a primitive array.
-
unmodifiableList
public static ListNumber unmodifiableList(ListNumber list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListDouble unmodifiableList(ListDouble list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListFloat unmodifiableList(ListFloat list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListLong unmodifiableList(ListLong list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListInteger unmodifiableList(ListInteger list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListShort unmodifiableList(ListShort list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ListByte unmodifiableList(ListByte list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayDouble unmodifiableList(ArrayDouble list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayFloat unmodifiableList(ArrayFloat list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayLong unmodifiableList(ArrayLong list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayInteger unmodifiableList(ArrayInteger list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayShort unmodifiableList(ArrayShort list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableList
public static ArrayByte unmodifiableList(ArrayByte list)
Returns an unmodifiable view of the specified list.- Parameters:
list
- the list for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified list.
-
unmodifiableListDouble
public static ArrayDouble unmodifiableListDouble(double... values)
Returns an unmodifiableArrayDouble
wrapper for the givendouble
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListFloat
public static ArrayFloat unmodifiableListFloat(float... values)
Returns an unmodifiableArrayFloat
wrapper for the givenfloat
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListLong
public static ArrayLong unmodifiableListLong(long... values)
Returns an unmodifiableArrayLong
wrapper for the givenlong
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListULong
public static ArrayULong unmodifiableListULong(long... values)
Returns an unmodifiableArrayULong
wrapper for the given unsignedlong
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListInt
public static ArrayInteger unmodifiableListInt(int... values)
Returns an unmodifiableArrayInteger
wrapper for the givenint
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListUInt
public static ArrayUInteger unmodifiableListUInt(int... values)
Returns an unmodifiableArrayUInteger
wrapper for the given unsignedint
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListShort
public static ArrayShort unmodifiableListShort(short... values)
Returns an unmodifiableArrayShort
wrapper for the givenshort
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListUShort
public static ArrayUShort unmodifiableListUShort(short... values)
Returns an unmodifiableArrayUShort
wrapper for the given unsignedshort
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListByte
public static ArrayByte unmodifiableListByte(byte... values)
Returns an unmodifiableArrayByte
wrapper for the givenbyte
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
unmodifiableListUByte
public static ArrayUByte unmodifiableListUByte(byte... values)
Returns an unmodifiableArrayUByte
wrapper for the given unsignedbyte
array.- Parameters:
values
- a primitive array.- Returns:
- an immutable wrapper.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, double[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, float[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, long[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, int[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, short[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
arrayCopy
public static void arrayCopy(CollectionNumber src, byte[] dest, int destPos)
Copies the content of the collection to an array at the desired position.- Parameters:
src
- the source number collection.dest
- the destination array.destPos
- starting position in the destination array.- Throws:
IndexOutOfBoundsException
- if copying would cause access of data outside array bounds.NullPointerException
- if eithersrc
ordest
isnull
.
-
-