Class IDListStandard_Map

  • All Implemented Interfaces:
    IDList

    public class IDListStandard_Map
    extends java.lang.Object
    implements IDList
    Inspired in SPMF. Implementation of a Idlist for ClaSP. This IdList is based on a hash map of entries >, and it makes a correspondence between a sid, denoted by the Integer, with the apperances of the pattern in that sequence, denoted by the list of positions. In that list we will have positions with the where an appearance of the pattern can be found, and is increasingly sorted in the itemset timestamps first, and the item positions later. In order to make the join operation, we will do it entry by entry, for those entries shared by two sequences. Copyright Antonio Gomariz PeƱalver 2013 This file is part of the SPMF DATA MINING SOFTWARE (http://www.philippe-fournier-viger.com/spmf). SPMF is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SPMF is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SPMF. If not, see .
    Author:
    agomariz
    • Constructor Summary

      Constructors 
      Constructor Description
      IDListStandard_Map()
      The standard constructor.
      IDListStandard_Map​(java.util.Map<java.lang.Integer,​java.util.List<Position>> sequencePositionsEntries)
      It creates an IdList from a map of >
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAppearance​(java.lang.Integer sequence, Position positionItem)
      It adds an appearance for the sequence and a position item given as parameter in the current IdList
      void addAppearancesInSequence​(java.lang.Integer sid, java.util.List<Position> itemsets)
      It adds the appearances for the sequence and the position items list given as parameter in the current IdList
      java.util.Map<java.lang.Integer,​java.util.List<Position>> appearingInMap()
      It gets a map with a match between the sequences where the pattern associated with this IdList appears, and the position items of that sequence where the pattern is identified
      void clear()
      It clears the attributes of this IdList
      java.util.Map<java.lang.Integer,​java.util.List<Position>> getSequencePositionsEntries()
      It gets the map that codes that appearances of the pattern in this IdList
      int getSupport()
      Get the minimum relative support outlined by the IdList, i.e.
      int getTotalElementsAfterPrefixes()
      It returns the number of elements that appears after each appearance of the pattern associated with the IdList
      IDList join​(IDList idList, boolean equals, int minSupport)
      It return the intersection IdList that results from the current object and the IdList given as an argument.
      static void sclear()  
      void setAppearingIn​(Pattern pattern)
      It moves to a pattern the sequences where the Idlist is active.
      void setAppearingIn​(Trie trie)
      It set in the Trie object, given as parameter, the sequence identifiers where the pattern associated with the IdList appears
      void SetOriginalSequenceLengths​(java.util.Map<java.lang.Integer,​java.lang.Integer> map)
      It sets the original lengths of the database sequences
      void setTotalElementsAfterPrefixes​(int i)
      It sets the number of elements that appears after each appearance of the pattern associated with the IdList
      java.lang.String toString()
      Get a string representation of this IdList
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IDListStandard_Map

        public IDListStandard_Map()
        The standard constructor. It creates an empty IdList.
      • IDListStandard_Map

        public IDListStandard_Map​(java.util.Map<java.lang.Integer,​java.util.List<Position>> sequencePositionsEntries)
        It creates an IdList from a map of >
        Parameters:
        sequencePositionsEntries -
    • Method Detail

      • join

        public IDList join​(IDList idList,
                           boolean equals,
                           int minSupport)
        It return the intersection IdList that results from the current object and the IdList given as an argument.
        Specified by:
        join in interface IDList
        Parameters:
        idList - IdList with which we join the current IdList.
        equals - Flag indicating if we want a intersection for equal relation, or, if it is false, an after relation.
        minSupport - Minimum relative support.
        Returns:
        the intersection
      • getSequencePositionsEntries

        public java.util.Map<java.lang.Integer,​java.util.List<Position>> getSequencePositionsEntries()
        It gets the map that codes that appearances of the pattern in this IdList
        Returns:
        the map
      • getSupport

        public int getSupport()
        Description copied from interface: IDList
        Get the minimum relative support outlined by the IdList, i.e. the number of sequences with any appearance on it.
        Specified by:
        getSupport in interface IDList
        Returns:
        the minsup value
      • addAppearance

        public void addAppearance​(java.lang.Integer sequence,
                                  Position positionItem)
        It adds an appearance for the sequence and a position item given as parameter in the current IdList
        Parameters:
        sequence - Sequence identifier where the appearence occurs
        positionItem - Itemset timestamp where the appearance occurs
      • addAppearancesInSequence

        public void addAppearancesInSequence​(java.lang.Integer sid,
                                             java.util.List<Position> itemsets)
        It adds the appearances for the sequence and the position items list given as parameter in the current IdList
        Parameters:
        sid - Sequence identifier where the appearence occurs
        itemsets - Itemset timestamps where the appearances occur
      • toString

        public java.lang.String toString()
        Get a string representation of this IdList
        Specified by:
        toString in interface IDList
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation
      • setAppearingIn

        public void setAppearingIn​(Trie trie)
        It set in the Trie object, given as parameter, the sequence identifiers where the pattern associated with the IdList appears
        Specified by:
        setAppearingIn in interface IDList
        Parameters:
        trie -
      • clear

        public void clear()
        It clears the attributes of this IdList
        Specified by:
        clear in interface IDList
      • sclear

        public static void sclear()
      • appearingInMap

        public java.util.Map<java.lang.Integer,​java.util.List<Position>> appearingInMap()
        Description copied from interface: IDList
        It gets a map with a match between the sequences where the pattern associated with this IdList appears, and the position items of that sequence where the pattern is identified
        Specified by:
        appearingInMap in interface IDList
        Returns:
        the map
      • getTotalElementsAfterPrefixes

        public int getTotalElementsAfterPrefixes()
        It returns the number of elements that appears after each appearance of the pattern associated with the IdList
        Specified by:
        getTotalElementsAfterPrefixes in interface IDList
        Returns:
        the number of elements
      • setTotalElementsAfterPrefixes

        public void setTotalElementsAfterPrefixes​(int i)
        It sets the number of elements that appears after each appearance of the pattern associated with the IdList
        Specified by:
        setTotalElementsAfterPrefixes in interface IDList
        Parameters:
        i - the number of elements
      • SetOriginalSequenceLengths

        public void SetOriginalSequenceLengths​(java.util.Map<java.lang.Integer,​java.lang.Integer> map)
        It sets the original lengths of the database sequences
        Specified by:
        SetOriginalSequenceLengths in interface IDList
        Parameters:
        map -
      • setAppearingIn

        public void setAppearingIn​(Pattern pattern)
        It moves to a pattern the sequences where the Idlist is active.
        Specified by:
        setAppearingIn in interface IDList
        Parameters:
        pattern - the pattern