public class ArraysAlgos
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<int[]> |
comparatorItemsetSameSize
A Comparator for comparing two itemsets having the same size using the lexical order.
|
Constructor and Description |
---|
ArraysAlgos() |
Modifier and Type | Method and Description |
---|---|
static boolean |
allTheSameExceptLastItem(int[] itemset1,
int[] itemset2)
This method checks if this itemset is the same as another itemset
except for the last item.
|
static int[] |
appendIntegerToArray(int[] array,
int integer)
Append an integer at the end of an array of integers.
|
static int[] |
cloneItemSetMinusAnItemset(int[] itemset,
int[] itemsetToNotKeep)
Make a copy of this itemset but exclude a set of items
|
static int[] |
cloneItemSetMinusOneItem(int[] itemset,
java.lang.Integer itemToRemove)
Make a copy of this itemset but exclude a given item
|
static int[] |
concatenate(int[] prefix,
int[] suffix)
Method to concatenate two arrays in a new array
|
static boolean |
contains(int[] itemset,
int item)
Check if an a sorted list of integers contains an integer.
|
static boolean |
containsLEX(int[] itemset,
int item)
This method checks if the item "item" is in the itemset.
|
static boolean |
containsLEX(java.lang.Integer[] itemset,
java.lang.Integer item,
int maxItemInArray)
This method checks if an item "item" is in the itemset "itemset".
|
static boolean |
containsLEXPlus(int[] itemset,
int item)
This method checks if the item "item" is in the itemset.
|
static boolean |
containsOrEquals(java.lang.Integer[] itemset1,
java.lang.Integer[] itemset2)
Check if an itemset contains another itemset.
|
static double[] |
convertStringArrayToDoubleArray(java.lang.String[] tokens)
Convert a string array to a double array
|
static boolean |
includedIn(int[] itemset1,
int[] itemset2)
Check if a sorted itemset is contained in another
|
static boolean |
includedIn(int[] itemset1,
int itemset1Length,
int[] itemset2)
Check if a sorted itemset is contained in another
|
static int[] |
intersectTwoSortedArrays(int[] array1,
int[] array2)
This method performs the intersection of two sorted arrays of integers and return a new sorted array.
|
static int |
sameAs(int[] itemset1,
int[] itemsets2,
int posRemoved)
Method to compare two sorted list of integers and see if they are the same,
while ignoring an item from the second list of integer.
|
public static java.util.Comparator<int[]> comparatorItemsetSameSize
public static int[] cloneItemSetMinusOneItem(int[] itemset, java.lang.Integer itemToRemove)
itemToRemove
- the given itempublic static int[] cloneItemSetMinusAnItemset(int[] itemset, int[] itemsetToNotKeep)
itemsetToNotKeep
- the set of items to be excludedpublic static boolean allTheSameExceptLastItem(int[] itemset1, int[] itemset2)
itemset1
- the first itemsetitemset2
- the second itemsetpublic static int[] concatenate(int[] prefix, int[] suffix)
prefix
- the first arraysuffix
- the second arraypublic static int[] intersectTwoSortedArrays(int[] array1, int[] array2)
a
- the first arrayb
- the second arraypublic static boolean containsOrEquals(java.lang.Integer[] itemset1, java.lang.Integer[] itemset2)
itemset1
- the first itemsetitemset2
- the second itemsetpublic static boolean containsLEX(java.lang.Integer[] itemset, java.lang.Integer item, int maxItemInArray)
itemset
- an itemsetitem
- the itemmaxItemInArray
- the largest item in the itemsetpublic static int sameAs(int[] itemset1, int[] itemsets2, int posRemoved)
itemset1
- the first itemsetitemsets2
- the second itemsetposRemoved
- the position of an item that should be ignored from "itemset2" to perform the comparison.public static boolean includedIn(int[] itemset1, int[] itemset2)
itemset1
- the first itemsetitemset2
- the second itemsetpublic static boolean includedIn(int[] itemset1, int itemset1Length, int[] itemset2)
itemset1
- the first itemsetlength
- of the first itemsetitemset2
- the second itemsetpublic static boolean containsLEXPlus(int[] itemset, int item)
itemset
- an itemsetitem
- the itempublic static boolean containsLEX(int[] itemset, int item)
itemset
- an itemsetitem
- the itempublic static boolean contains(int[] itemset, int item)
itemset
- the sorted list of integersitem
- the integerpublic static int[] appendIntegerToArray(int[] array, int integer)
array
- the arrayinteger
- the integerpublic static double[] convertStringArrayToDoubleArray(java.lang.String[] tokens)
tokens
- a string array