Class Sequence


  • public class Sequence
    extends java.lang.Object
    Inspired in SPMF Implementation of a sequence. A sequence is defined as a list of itemsets and can have an identifier. 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
      Sequence​(int id)
      Standard constructor for a sequence
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(int indexItemset, Item item)
      It adds an item in the specified itemset of the sequence
      void addItemset​(Itemset itemset)
      It adds an itemset in the last position of the sequence
      Sequence cloneSequence()
      It clones a sequence
      Itemset get​(int index)
      It gets a particular itemset from the sequence
      int getId()
      It returns the sequence ID
      java.util.List<Itemset> getItemsets()
      It gets the list of itemsets in this sequence
      long getTimeLength()
      It returns the time length of the sequence, i.e.
      int length()
      It returns the number of items that the sequence has
      Itemset remove​(int indexItemset)
      It removes the specified itemset from the sequence
      Item remove​(int indexItemset, int indexItem)
      It removes the specified item from the specified itemset in the sequence
      void setID​(int id)
      Set the sequence id of this sequence
      int size()
      It returns the number of itemsets that the sequence has
      java.lang.String toString()
      Get the string representation of this sequence
      • Methods inherited from class java.lang.Object

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

      • Sequence

        public Sequence​(int id)
        Standard constructor for a sequence
        Parameters:
        id - The sequence identifier
    • Method Detail

      • addItemset

        public void addItemset​(Itemset itemset)
        It adds an itemset in the last position of the sequence
        Parameters:
        itemset - the itemset to add
      • addItem

        public void addItem​(int indexItemset,
                            Item item)
        It adds an item in the specified itemset of the sequence
        Parameters:
        indexItemset - Itemset index where we want to insert the item
        item - The item that we want to insert
      • remove

        public Itemset remove​(int indexItemset)
        It removes the specified itemset from the sequence
        Parameters:
        indexItemset - Itemset index of itemset that we want to remove
        Returns:
        the itemset that has been removed
      • remove

        public Item remove​(int indexItemset,
                           int indexItem)
        It removes the specified item from the specified itemset in the sequence
        Parameters:
        indexItemset - Itemset index from where we want to remove the item
        indexItem - Item index that we want to remove
        Returns:
        the removed item
      • cloneSequence

        public Sequence cloneSequence()
        It clones a sequence
        Returns:
        the clone sequence
      • toString

        public java.lang.String toString()
        Get the string representation of this sequence
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation
      • getId

        public int getId()
        It returns the sequence ID
        Returns:
        the sequence id of this sequence
      • getItemsets

        public java.util.List<Itemset> getItemsets()
        It gets the list of itemsets in this sequence
        Returns:
        the list of itemsets
      • get

        public Itemset get​(int index)
        It gets a particular itemset from the sequence
        Parameters:
        index - The itemset index in which we are interested in
        Returns:
        the itemset
      • size

        public int size()
        It returns the number of itemsets that the sequence has
        Returns:
        the number of itemsets
      • length

        public int length()
        It returns the number of items that the sequence has
        Returns:
        the number of items
      • getTimeLength

        public long getTimeLength()
        It returns the time length of the sequence, i.e. the timestamp of the last itemset minus the timestamp of the first itemset
        Returns:
        the time length
      • setID

        public void setID​(int id)
        Set the sequence id of this sequence
        Parameters:
        id - the sequence id