Documentation of 'ca.pfv.spmf.algorithms.ArraysAlgos' Java class
ArraysAlgos
ca.pfv.spmf.algorithms

Class ArraysAlgos



  • public class ArraysAlgos
    extends java.lang.Object
    This class provides a set of basic methods that can be used with itemsets represented as arrays of integers. All the methods are static methods so that they can be used in any classes.
    • Field Summary

      Fields 
      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 Summary

      Constructors 
      Constructor and Description
      ArraysAlgos() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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[] 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 boolean includedIn(int[] itemset1, 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • comparatorItemsetSameSize

        public static java.util.Comparator<int[]> comparatorItemsetSameSize
        A Comparator for comparing two itemsets having the same size using the lexical order.
    • Constructor Detail

      • ArraysAlgos

        public ArraysAlgos()
    • Method Detail

      • cloneItemSetMinusOneItem

        public static int[] cloneItemSetMinusOneItem(int[] itemset,
                                                     java.lang.Integer itemToRemove)
        Make a copy of this itemset but exclude a given item
        Parameters:
        itemToRemove - the given item
        Returns:
        the copy
      • cloneItemSetMinusAnItemset

        public static int[] cloneItemSetMinusAnItemset(int[] itemset,
                                                       int[] itemsetToNotKeep)
        Make a copy of this itemset but exclude a set of items
        Parameters:
        itemsetToNotKeep - the set of items to be excluded
        Returns:
        the copy
      • allTheSameExceptLastItem

        public static boolean allTheSameExceptLastItem(int[] itemset1,
                                                       int[] itemset2)
        This method checks if this itemset is the same as another itemset except for the last item. It assumes that both itemsets have the same length.
        Parameters:
        itemset1 - the first itemset
        itemset2 - the second itemset
        Returns:
        true if they are the same except for the last item
      • concatenate

        public static int[] concatenate(int[] prefix,
                                        int[] suffix)
        Method to concatenate two arrays in a new array
        Parameters:
        prefix - the first array
        suffix - the second array
        Returns:
        the resulting array
      • intersectTwoSortedArrays

        public static int[] intersectTwoSortedArrays(int[] array1,
                                                     int[] array2)
        This method performs the intersection of two sorted arrays of integers and return a new sorted array.
        Parameters:
        a - the first array
        b - the second array
        Returns:
        the resulting sorted array
      • containsOrEquals

        public static boolean containsOrEquals(java.lang.Integer[] itemset1,
                                               java.lang.Integer[] itemset2)
        Check if an itemset contains another itemset. It assumes that itemsets are sorted according to the lexical order.
        Parameters:
        itemset1 - the first itemset
        itemset2 - the second itemset
        Returns:
        true if the first itemset contains the second itemset
      • containsLEX

        public 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". It assumes that items in the itemset are sorted in lexical order and that the largest item in the itemset is known.
        Parameters:
        itemset - an itemset
        item - the item
        maxItemInArray - the largest item in the itemset
        Returns:
        returnt true if the item appears in the itemset
      • sameAs

        public 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. This methods is used by some Apriori algorithms.
        Parameters:
        itemset1 - the first itemset
        itemsets2 - the second itemset
        posRemoved - the position of an item that should be ignored from "itemset2" to perform the comparison.
        Returns:
        0 if they are the same, 1 if itemset is larger according to lexical order, -1 if smaller.
      • includedIn

        public static boolean includedIn(int[] itemset1,
                                         int[] itemset2)
        Check if a sorted itemset is contained in another
        Parameters:
        itemset1 - the first itemset
        itemset2 - the second itemset
        Returns:
        true if yes, otherwise false
      • containsLEXPlus

        public static boolean containsLEXPlus(int[] itemset,
                                              int item)
        This method checks if the item "item" is in the itemset. It asumes that items in the itemset are sorted in lexical order This version also checks that if the item "item" was added it would be the largest one according to the lexical order.
        Parameters:
        itemset - an itemset
        item - the item
        Returns:
        return true if the above conditions are met, otherwise false
      • containsLEX

        public static boolean containsLEX(int[] itemset,
                                          int item)
        This method checks if the item "item" is in the itemset. It assumes that items in the itemset are sorted in lexical order
        Parameters:
        itemset - an itemset
        item - the item
        Returns:
        return true if the item
      • contains

        public static boolean contains(int[] itemset,
                                       int item)
        Check if an a sorted list of integers contains an integer.
        Parameters:
        itemset - the sorted list of integers
        item - the integer
        Returns:
        true if the item appears in the list, false otherwise

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.