Class HashLongLongArray

java.lang.Object
org.snpeff.collections.HashLongLongArray

public class HashLongLongArray extends Object
A Hashinvalid input: '<'long, long[]> using primitive types instead or warped object The idea is to be able to add many long values for each key This could be implemented by simply doing HashMapinvalid input: '<'Long, Set > (but it would consume much more memory) Note: We call each 'long[]' a bucket WARNING: This collection does NOT allow elements to be deleted! But you can replace values.
Author:
pcingola
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(long key, long value)
    Return true if value is in the hash
    long[]
    getBucket(long key)
    Return all values for a given key WARNING: Not all elements in a bucket are used.
    int
    getBucketLength(long key)
    Return used length of a bucket
    int
    Get bucket length for latest bucket search WARNING: Obviously this is not a thread safe operation
    long[]
    Return an array with all the keys to this hash
    void
    put(long key, long value)
    Insert a invalid input: '<'key, value> pair How does it work? - bucket_number = hash.get( key ) - bu = bucket[ bucket_number ] - append 'value' to 'bu'
    boolean
    replace(long key, long value, long newValue)
    Replace a value with newValue
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • HashLongLongArray

      public HashLongLongArray()
  • Method Details

    • contains

      public boolean contains(long key, long value)
      Return true if value is in the hash
      Parameters:
      key -
      value -
    • getBucket

      public long[] getBucket(long key)
      Return all values for a given key WARNING: Not all elements in a bucket are used. Use getBucketLength(key) to know how many elements are used
      Parameters:
      key -
      Returns:
      All associated values, or null if key is not found
    • getBucketLength

      public int getBucketLength(long key)
      Return used length of a bucket
      Parameters:
      key -
      Returns:
    • getLatestBucketLength

      public int getLatestBucketLength()
      Get bucket length for latest bucket search WARNING: Obviously this is not a thread safe operation
      Returns:
    • keys

      public long[] keys()
      Return an array with all the keys to this hash
      Returns:
    • put

      public void put(long key, long value)
      Insert a invalid input: '<'key, value> pair How does it work? - bucket_number = hash.get( key ) - bu = bucket[ bucket_number ] - append 'value' to 'bu'
      Parameters:
      key -
      value -
    • replace

      public boolean replace(long key, long value, long newValue)
      Replace a value with newValue
      Parameters:
      key -
      value -
    • toString

      public String toString()
      Overrides:
      toString in class Object