cc.redberry.core.utils
Class MathUtils
- java.lang.Object
-
- cc.redberry.core.utils.MathUtils
-
public final class MathUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static int[]getSortedDistinct(int[] values)Sort array & return array with removed repetitive values.static int[]intSetDifference(int[] a, int[] b)Return the set difference B - A for int sets A and B.
Sets A and B must be represented as two sorted int arrays.
Repetitive values in A or B not allowed.static int[]intSetUnion(int[] a, int[] b)Return the union B + A for integer sets A and B.
Sets A and B must be represented as two sorted integer arrays.
Repetitive values in A or B not allowed.
-
-
-
Method Detail
-
getSortedDistinct
public static int[] getSortedDistinct(int[] values)
Sort array & return array with removed repetitive values.- Parameters:
values- input array (this method will quickSort this array)- Returns:
- sorted array of distinct values
-
intSetDifference
public static int[] intSetDifference(int[] a, int[] b)Return the set difference B - A for int sets A and B.
Sets A and B must be represented as two sorted int arrays.
Repetitive values in A or B not allowed.- Parameters:
a- sorted array of distinct values. (set A)b- sorted array of distinct values. (set B)- Returns:
- the set of elements in B but not in A
-
intSetUnion
public static int[] intSetUnion(int[] a, int[] b)Return the union B + A for integer sets A and B.
Sets A and B must be represented as two sorted integer arrays.
Repetitive values in A or B not allowed.- Parameters:
a- sorted array of distinct values. (set A)b- sorted array of distinct values. (set B)- Returns:
- the set of elements from B and from A
-
-
DataMelt 3.0 © DataMelt by jWork.ORG