Class SequenceIndexer<T extends BinarySequence>

  • All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Comparator<java.lang.Long>
    Direct Known Subclasses:
    SuffixIndexerNmer

    public class SequenceIndexer<T extends BinarySequence>
    extends java.lang.Object
    implements java.util.Comparator<java.lang.Long>, java.lang.Iterable<T>
    A collection of sequences that are indexed using some algorithm Note: The ID is just the position in the array. That is why the array should not change the order of the elements (only append new ones or replace old ones).
    Author:
    pcingola
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.util.Collection<T> sequences)
      Add a collection of sequences
      int add​(T sequence)
      Add a sequence to this index
      int compare​(java.lang.Long reference1, java.lang.Long reference2)
      Compare two references
      T get​(int idx)
      Get sequence in entry number 'idx'
      java.util.Iterator<T> iterator()  
      int size()
      Number of sequences in this index
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • add

        public void add​(java.util.Collection<T> sequences)
        Add a collection of sequences
        Parameters:
        sequences -
      • add

        public int add​(T sequence)
        Add a sequence to this index
        Parameters:
        sequence -
        Returns:
        Index to this sequence (a number that can be used to retrieve this sequence)
      • compare

        public int compare​(java.lang.Long reference1,
                           java.lang.Long reference2)
        Compare two references
        Specified by:
        compare in interface java.util.Comparator<T extends BinarySequence>
        Parameters:
        reference1 -
        reference2 -
        Returns:
      • get

        public T get​(int idx)
        Get sequence in entry number 'idx'
        Parameters:
        idx -
        Returns:
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T extends BinarySequence>
      • size

        public int size()
        Number of sequences in this index
        Returns: