Package com.compomics.util
Class ArrayUtil
java.lang.Object
com.compomics.util.ArrayUtil
Utility functions to work with arrays.
- Author:
- Marc Vaudel, Harald Barsnes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]concatenate(byte[] array1, byte[] array2, int len2) Convenience method to merge two byte arrays.static char[]concatenate(char[] array1, char[] array2, int len2) Appends the second array to the first array.static double[]concatenate(double[] array1, double[] array2, int len2) Appends the second array to the first array.static char[]makeUnique(char[] array) Returns an array containing the unique characters of the given array.static double[]scaleToMax(double[] values) Scales the given values using the maximum value.static double[]scaleToMax(double[] values, boolean percent) Scales the given values using the maximum value.static double[]scaleValues(double[] values, double refIntensity) Scales the values using the reference value.static double[]scaleValues(double[] values, double refIntensity, boolean percent) Scales the values using the reference value.
-
Constructor Details
-
ArrayUtil
public ArrayUtil()
-
-
Method Details
-
concatenate
public static char[] concatenate(char[] array1, char[] array2, int len2) Appends the second array to the first array.- Parameters:
array1- The first array.array2- The second array.len2- The length of the second array to copy- Returns:
- The concatenation of array1 and array2.
-
concatenate
public static double[] concatenate(double[] array1, double[] array2, int len2) Appends the second array to the first array.- Parameters:
array1- The first array.array2- The second array.len2- The length of the second array to copy- Returns:
- The concatenation of array1 and array2.
-
concatenate
public static byte[] concatenate(byte[] array1, byte[] array2, int len2) Convenience method to merge two byte arrays.- Parameters:
array1- First byte array.array2- Second byte array.len2- The length of the second array to copy- Returns:
- A concatenation of the first and the second arrays.
-
makeUnique
public static char[] makeUnique(char[] array) Returns an array containing the unique characters of the given array.- Parameters:
array- the array- Returns:
- the unique array
-
scaleValues
public static double[] scaleValues(double[] values, double refIntensity) Scales the values using the reference value.- Parameters:
values- The values to scale.refIntensity- The reference value.- Returns:
- The scaled values.
-
scaleValues
public static double[] scaleValues(double[] values, double refIntensity, boolean percent) Scales the values using the reference value.- Parameters:
values- The values to scale.refIntensity- The reference value.percent- If true, the values are returned in the [0-100] range.- Returns:
- The scaled values.
-
scaleToMax
public static double[] scaleToMax(double[] values) Scales the given values using the maximum value.- Parameters:
values- The values to scale.- Returns:
- The given values scaled using the maximum value.
-
scaleToMax
public static double[] scaleToMax(double[] values, boolean percent) Scales the given values using the maximum value.- Parameters:
values- The values to scale.percent- If true, the values are returned in the [0-100] range.- Returns:
- The given values scaled using the maximum value.
-