Class AbstractOrderedItemset

  • Direct Known Subclasses:
    Itemset

    public abstract class AbstractOrderedItemset
    extends AbstractItemset
    This is an abstract class indicating general methods that an ordered itemset should have, and is designed for ordered itemsets where items are sorted by lexical order and no item can appear twice.
    Author:
    Philippe Fournier-Viger
    See Also:
    AbstractItemset
    • Constructor Detail

      • AbstractOrderedItemset

        public AbstractOrderedItemset()
    • Method Detail

      • getAbsoluteSupport

        public abstract int getAbsoluteSupport()
        Get the support of this itemset
        Specified by:
        getAbsoluteSupport in class AbstractItemset
        Returns:
        the support of this itemset
      • size

        public abstract int size()
        Get the size of this itemset
        Specified by:
        size in class AbstractItemset
        Returns:
        the size of this itemset
      • get

        public abstract java.lang.Integer get​(int position)
        Get the item at a given position of this itemset
        Parameters:
        position - the position of the item to be returned
        Returns:
        the item
      • getLastItem

        public java.lang.Integer getLastItem()
        Get the last item.
        Returns:
        the last item.
      • toString

        public java.lang.String toString()
        Get this itemset as a string
        Specified by:
        toString in class AbstractItemset
        Returns:
        a string representation of this itemset
      • getRelativeSupport

        public double getRelativeSupport​(int nbObject)
        Get the relative support of this itemset (a percentage) as a double
        Specified by:
        getRelativeSupport in class AbstractItemset
        Parameters:
        nbObject - the number of transactions in the database where this itemset was found
        Returns:
        the relative support of the itemset as a double
      • contains

        public boolean contains​(java.lang.Integer item)
        Check if this itemset contains a given item.
        Specified by:
        contains in class AbstractItemset
        Parameters:
        item - the item
        Returns:
        true if the item is contained in this itemset
      • containsAll

        public boolean containsAll​(AbstractOrderedItemset itemset2)
        This methods checks if another itemset is contained in this one.
        Parameters:
        itemset2 - the other itemset
        Returns:
        true if it is contained
      • isEqualTo

        public boolean isEqualTo​(AbstractOrderedItemset itemset2)
        This method compare this itemset with another itemset to see if they are equal. The method assume that the two itemsets are lexically ordered.
        Parameters:
        itemset2 - an itemset
        Returns:
        true or false
      • isEqualTo

        public boolean isEqualTo​(int[] itemset)
        This method compare this itemset with another itemset to see if they are equal. The method assume that the two itemsets are lexically ordered.
        Parameters:
        an - itemset
        Returns:
        true or false
      • allTheSameExceptLastItemV2

        public boolean allTheSameExceptLastItemV2​(AbstractOrderedItemset itemset2)
        This method checks if this itemset is the same as another itemset except for the last item.
        Parameters:
        itemset2 - the second itemset
        Returns:
        true if they are the same except for the last item
      • allTheSameExceptLastItem

        public java.lang.Integer allTheSameExceptLastItem​(AbstractOrderedItemset itemset2)
        Check if the items from this itemset are all the same as those of another itemset except the last item and that itemset2 is lexically smaller than this itemset. If all these conditions are satisfied, this method return the last item of itemset2. Otherwise it returns null.
        Returns:
        the last item of itemset2, otherwise, null.